Selectable disassemble modes in CLI debugger (fixes #113)
Jeffrey Pfau jeffrey@endrift.com
Sat, 30 Aug 2014 03:48:14 -0700
1 files changed,
19 insertions(+),
1 deletions(-)
jump to
M
src/debugger/cli-debugger.c
→
src/debugger/cli-debugger.c
@@ -30,6 +30,8 @@
static void _breakInto(struct CLIDebugger*, struct DebugVector*); static void _continue(struct CLIDebugger*, struct DebugVector*); static void _disassemble(struct CLIDebugger*, struct DebugVector*); +static void _disassembleArm(struct CLIDebugger*, struct DebugVector*); +static void _disassembleThumb(struct CLIDebugger*, struct DebugVector*); static void _next(struct CLIDebugger*, struct DebugVector*); static void _print(struct CLIDebugger*, struct DebugVector*); static void _printHex(struct CLIDebugger*, struct DebugVector*);@@ -43,6 +45,7 @@ static void _clearBreakpoint(struct CLIDebugger*, struct DebugVector*);
static void _setWatchpoint(struct CLIDebugger*, struct DebugVector*); static void _breakIntoDefault(int signal); +static void _disassembleMode(struct CLIDebugger*, struct DebugVector*, enum ExecutionMode mode); static void _printLine(struct CLIDebugger* debugger, uint32_t address, enum ExecutionMode mode); static struct {@@ -56,7 +59,11 @@ { "continue", _continue },
{ "d", _clearBreakpoint }, { "delete", _clearBreakpoint }, { "dis", _disassemble }, + { "dis/a", _disassembleArm }, + { "dis/t", _disassembleThumb }, { "disasm", _disassemble }, + { "disasm/a", _disassembleArm }, + { "disasm/t", _disassembleThumb }, { "i", _printStatus }, { "info", _printStatus }, { "n", _next },@@ -122,10 +129,21 @@ _printStatus(debugger, 0);
} static void _disassemble(struct CLIDebugger* debugger, struct DebugVector* dv) { + _disassembleMode(debugger, dv, debugger->d.cpu->executionMode); +} + +static void _disassembleArm(struct CLIDebugger* debugger, struct DebugVector* dv) { + _disassembleMode(debugger, dv, MODE_ARM); +} + +static void _disassembleThumb(struct CLIDebugger* debugger, struct DebugVector* dv) { + _disassembleMode(debugger, dv, MODE_THUMB); +} + +static void _disassembleMode(struct CLIDebugger* debugger, struct DebugVector* dv, enum ExecutionMode mode) { uint32_t address; int size; int wordSize; - enum ExecutionMode mode = debugger->d.cpu->executionMode; if (mode == MODE_ARM) { wordSize = WORD_SIZE_ARM;