mirror of https://github.com/mgba-emu/mgba.git
CLI debugger help
This commit is contained in:
parent
9cdc93eeed
commit
232ae47a6c
|
@ -37,6 +37,7 @@ static void _print(struct CLIDebugger*, struct DebugVector*);
|
||||||
static void _printBin(struct CLIDebugger*, struct DebugVector*);
|
static void _printBin(struct CLIDebugger*, struct DebugVector*);
|
||||||
static void _printHex(struct CLIDebugger*, struct DebugVector*);
|
static void _printHex(struct CLIDebugger*, struct DebugVector*);
|
||||||
static void _printStatus(struct CLIDebugger*, struct DebugVector*);
|
static void _printStatus(struct CLIDebugger*, struct DebugVector*);
|
||||||
|
static void _printHelp(struct CLIDebugger*, struct DebugVector*);
|
||||||
static void _quit(struct CLIDebugger*, struct DebugVector*);
|
static void _quit(struct CLIDebugger*, struct DebugVector*);
|
||||||
static void _readByte(struct CLIDebugger*, struct DebugVector*);
|
static void _readByte(struct CLIDebugger*, struct DebugVector*);
|
||||||
static void _readHalfword(struct CLIDebugger*, struct DebugVector*);
|
static void _readHalfword(struct CLIDebugger*, struct DebugVector*);
|
||||||
|
@ -52,39 +53,42 @@ static void _printLine(struct CLIDebugger* debugger, uint32_t address, enum Exec
|
||||||
static struct {
|
static struct {
|
||||||
const char* name;
|
const char* name;
|
||||||
DebuggerCommand* command;
|
DebuggerCommand* command;
|
||||||
|
const char* summary;
|
||||||
} _debuggerCommands[] = {
|
} _debuggerCommands[] = {
|
||||||
{ "b", _setBreakpoint },
|
{ "b", _setBreakpoint, "Set a breakpoint" },
|
||||||
{ "break", _setBreakpoint },
|
{ "break", _setBreakpoint, "Set a breakpoint" },
|
||||||
{ "c", _continue },
|
{ "c", _continue, "Continue execution" },
|
||||||
{ "continue", _continue },
|
{ "continue", _continue, "Continue execution" },
|
||||||
{ "d", _clearBreakpoint },
|
{ "d", _clearBreakpoint, "Delete a breakpoint" },
|
||||||
{ "delete", _clearBreakpoint },
|
{ "delete", _clearBreakpoint, "Delete a breakpoint" },
|
||||||
{ "dis", _disassemble },
|
{ "dis", _disassemble, "Disassemble instructions" },
|
||||||
{ "dis/a", _disassembleArm },
|
{ "dis/a", _disassembleArm, "Disassemble instructions as ARM" },
|
||||||
{ "dis/t", _disassembleThumb },
|
{ "dis/t", _disassembleThumb, "Disassemble instructions as Thumb" },
|
||||||
{ "disasm", _disassemble },
|
{ "disasm", _disassemble, "Disassemble instructions" },
|
||||||
{ "disasm/a", _disassembleArm },
|
{ "disasm/a", _disassembleArm, "Disassemble instructions as ARM" },
|
||||||
{ "disasm/t", _disassembleThumb },
|
{ "disasm/t", _disassembleThumb, "Disassemble instructions as Thumb" },
|
||||||
{ "i", _printStatus },
|
{ "h", _printHelp, "Print help" },
|
||||||
{ "info", _printStatus },
|
{ "help", _printHelp, "Print help" },
|
||||||
{ "n", _next },
|
{ "i", _printStatus, "Print the current status" },
|
||||||
{ "next", _next },
|
{ "info", _printStatus, "Print the current status" },
|
||||||
{ "p", _print },
|
{ "n", _next, "Execute next instruction" },
|
||||||
{ "p/t", _printBin },
|
{ "next", _next, "Execute next instruction" },
|
||||||
{ "p/x", _printHex },
|
{ "p", _print, "Print a value" },
|
||||||
{ "print", _print },
|
{ "p/t", _printBin, "Print a value as binary" },
|
||||||
{ "print/t", _printBin },
|
{ "p/x", _printHex, "Print a value as hexadecimal" },
|
||||||
{ "print/x", _printHex },
|
{ "print", _print, "Print a value" },
|
||||||
{ "q", _quit },
|
{ "print/t", _printBin, "Print a value as binary" },
|
||||||
{ "quit", _quit },
|
{ "print/x", _printHex, "Print a value as hexadecimal" },
|
||||||
{ "rb", _readByte },
|
{ "q", _quit, "Quit the emulator" },
|
||||||
{ "rh", _readHalfword },
|
{ "quit", _quit, "Quit the emulator" },
|
||||||
{ "rw", _readWord },
|
{ "rb", _readByte, "Read a byte from a specified offset" },
|
||||||
{ "status", _printStatus },
|
{ "rh", _readHalfword, "Read a halfword from a specified offset" },
|
||||||
{ "w", _setWatchpoint },
|
{ "rw", _readWord, "Read a word from a specified offset" },
|
||||||
{ "watch", _setWatchpoint },
|
{ "status", _printStatus, "Print the current status" },
|
||||||
{ "x", _breakInto },
|
{ "w", _setWatchpoint, "Set a watchpoint" },
|
||||||
{ 0, 0 }
|
{ "watch", _setWatchpoint, "Set a watchpoint" },
|
||||||
|
{ "x", _breakInto, "Break into attached debugger (for developers)" },
|
||||||
|
{ 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void _printPSR(union PSR psr) {
|
static inline void _printPSR(union PSR psr) {
|
||||||
|
@ -203,6 +207,24 @@ static void _printHex(struct CLIDebugger* debugger, struct DebugVector* dv) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void _printHelp(struct CLIDebugger* debugger, struct DebugVector* dv) {
|
||||||
|
UNUSED(debugger);
|
||||||
|
UNUSED(dv);
|
||||||
|
if (!dv) {
|
||||||
|
int i;
|
||||||
|
for (i = 0; _debuggerCommands[i].name; ++i) {
|
||||||
|
printf("%-10s %s\n", _debuggerCommands[i].name, _debuggerCommands[i].summary);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
int i;
|
||||||
|
for (i = 0; _debuggerCommands[i].name; ++i) {
|
||||||
|
if (strcmp(_debuggerCommands[i].name, dv->charValue) == 0) {
|
||||||
|
printf("%-10s %s\n", _debuggerCommands[i].name, _debuggerCommands[i].summary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline void _printLine(struct CLIDebugger* debugger, uint32_t address, enum ExecutionMode mode) {
|
static inline void _printLine(struct CLIDebugger* debugger, uint32_t address, enum ExecutionMode mode) {
|
||||||
char disassembly[48];
|
char disassembly[48];
|
||||||
struct ARMInstructionInfo info;
|
struct ARMInstructionInfo info;
|
||||||
|
|
Loading…
Reference in New Issue