Debuggeri[CDB]: Add breakpoint command.

Report back breakpoints with modules.
This commit is contained in:
Friedemann Kleint
2011-02-02 13:45:40 +01:00
parent acb36acf15
commit 285d216bed
10 changed files with 155 additions and 14 deletions

View File

@@ -101,6 +101,7 @@ enum Command {
CmdShutdownex,
CmdAddWatch,
CmdWidgetAt,
CmdBreakPoints,
CmdTest
};
@@ -158,6 +159,7 @@ static const CommandDescription commandDescriptions[] = {
{"shutdownex","Unhooks output callbacks.\nNeeds to be called explicitly only in case of remote debugging.",""},
{"addwatch","Add watch expression","<iname> <expression>"},
{"widgetat","Return address of widget at position","<x> <y>"},
{"breakpoints","List breakpoints with modules","[-h] [-v]"},
{"test","Testing command","-T type | -w watch-expression"}
};
@@ -984,6 +986,34 @@ extern "C" HRESULT CALLBACK widgetat(CIDebugClient *client, PCSTR argsIn)
return S_OK;
}
extern "C" HRESULT CALLBACK breakpoints(CIDebugClient *client, PCSTR argsIn)
{
ExtensionCommandContext exc(client);
int token;
std::string errorMessage;
bool humanReadable = false;
bool verbose = false;
StringList tokens = commandTokens<StringList>(argsIn, &token);
while (!tokens.empty() && tokens.front().size() == 2 && tokens.front().at(0) == '-') {
switch (tokens.front().at(1)) {
case 'h':
humanReadable = true;
break;
case 'v':
verbose = true;
break;
}
tokens.pop_front();
}
const std::string bp = gdbmiBreakpoints(exc.control(), exc.symbols(), humanReadable, verbose, &errorMessage);
if (bp.empty()) {
ExtensionContext::instance().report('N', token, 0, "breakpoints", errorMessage.c_str());
} else {
ExtensionContext::instance().reportLong('R', token, "breakpoints", bp);
}
return S_OK;
}
extern "C" HRESULT CALLBACK test(CIDebugClient *client, PCSTR argsIn)
{
enum Mode { Invalid, TestType, TestFixWatchExpression };