all repos — mgba @ 002624980646cc63720e133f9dafc3c51a6edb36

mGBA Game Boy Advance Emulator

Debugger: Add event dumping
Vicki Pfau vi@endrift.com
Mon, 28 Dec 2020 19:14:33 -0800
commit

002624980646cc63720e133f9dafc3c51a6edb36

parent

e27e3333052238777f4acdb029f02f1fee90626c

2 files changed, 13 insertions(+), 0 deletions(-)

jump to
M CHANGESCHANGES

@@ -13,6 +13,7 @@ - Read-only support for MBC6 flash memory

- 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
M src/debugger/cli-debugger.csrc/debugger/cli-debugger.c

@@ -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 @@ { "break", _setBreakpoint, "Is", "Set a breakpoint" },

{ "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" },

@@ -766,6 +769,15 @@

static void _printStatus(struct CLIDebugger* debugger, struct CLIDebugVector* dv) { UNUSED(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) {