Debugger[New CDB]: Fix disassembly.

Introduce GDBMI-based 'stack' extension command instead of the
builtin 'k' as this does not print the correct instruction pointer.
This commit is contained in:
Friedemann Kleint
2010-11-22 13:50:40 +01:00
parent 3e002e6d79
commit 7fbff9c3af
9 changed files with 171 additions and 103 deletions

View File

@@ -351,6 +351,37 @@ extern "C" HRESULT CALLBACK memory(CIDebugClient *Client, PCSTR argsIn)
return S_OK;
}
// Extension command 'stack'
// Report stack correctly as 'k' does not list instruction pointer
// correctly.
extern "C" HRESULT CALLBACK stack(CIDebugClient *Client, PCSTR argsIn)
{
ExtensionCommandContext exc(Client);
std::string errorMessage;
int token;
bool humanReadable = false;
unsigned maxFrames = 1000;
StringList tokens = commandTokens<StringList>(argsIn, &token);
if (!tokens.empty() && tokens.front() == "-h") {
humanReadable = true;
tokens.pop_front();
}
if (!tokens.empty())
integerFromString(tokens.front(), &maxFrames);
const std::string stack = gdbmiStack(exc.control(), exc.symbols(),
maxFrames, humanReadable, &errorMessage);
if (stack.empty()) {
ExtensionContext::instance().report('N', token, "stack", errorMessage.c_str());
} else {
ExtensionContext::instance().report('R', token, "stack", stack.c_str());
}
return S_OK;
}
// Extension command 'shutdownex' (shutdown is reserved):
// Unhook the output callbacks. This is normally done by the session
// inaccessible notification, however, this does not work for remote-controlled sessions.