Debugger: Add event dumping

This commit is contained in:
Vicki Pfau 2020-12-28 19:14:33 -08:00
parent e27e333305
commit 0026249806
2 changed files with 13 additions and 0 deletions

View File

@ -13,6 +13,7 @@ Features:
- New unlicensed GB mappers: Pokémon Jade/Diamond, BBD, and Hitek
- Stack tracing tools in ARM debugger (by ahigerd)
- Command scripts for CLI debugger (by ahigerd)
- Scheduled event dumping in CLI debugger
- ARM disassembler now resolves addresses to symbol names
- Add Game Boy Player feature support to ports
- Individual window types can now be toggled in debugging views

View File

@ -8,6 +8,7 @@
#include <mgba/internal/debugger/symbols.h>
#include <mgba/core/core.h>
#include <mgba/core/timing.h>
#include <mgba/core/version.h>
#include <mgba/internal/debugger/parser.h>
#include <mgba-util/string.h>
@ -66,6 +67,7 @@ static void _writeWord(struct CLIDebugger*, struct CLIDebugVector*);
static void _dumpByte(struct CLIDebugger*, struct CLIDebugVector*);
static void _dumpHalfword(struct CLIDebugger*, struct CLIDebugVector*);
static void _dumpWord(struct CLIDebugger*, struct CLIDebugVector*);
static void _events(struct CLIDebugger*, struct CLIDebugVector*);
#ifdef ENABLE_SCRIPTING
static void _source(struct CLIDebugger*, struct CLIDebugVector*);
#endif
@ -81,6 +83,7 @@ static struct CLIDebuggerCommandSummary _debuggerCommands[] = {
{ "continue", _continue, "", "Continue execution" },
{ "delete", _clearBreakpoint, "I", "Delete a breakpoint or watchpoint" },
{ "disassemble", _disassemble, "Ii", "Disassemble instructions" },
{ "events", _events, "", "Print list of scheduled events" },
{ "finish", _finish, "", "Execute until current stack frame returns" },
{ "help", _printHelp, "S", "Print help" },
{ "listb", _listBreakpoints, "", "List breakpoints" },
@ -768,6 +771,15 @@ static void _printStatus(struct CLIDebugger* debugger, struct CLIDebugVector* dv
debugger->system->printStatus(debugger->system);
}
static void _events(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
UNUSED(dv);
struct mTiming* timing = debugger->d.core->timing;
struct mTimingEvent* next = timing->root;
for (; next; next = next->next) {
debugger->backend->printf(debugger->backend, "%s in %i cycles\n", next->name, mTimingUntil(timing, next));
}
}
struct CLIDebugVector* CLIDVParse(struct CLIDebugger* debugger, const char* string, size_t length) {
if (!string || length < 1) {
return 0;