add debugger command to enable and disable
This commit is contained in:
parent
f105f28017
commit
abdece7737
@ -832,6 +832,23 @@ static bool registers(GB_gameboy_t *gb, char *arguments, char *modifiers, const
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Enable or disable software breakpoints */
|
||||
static bool softbreak(GB_gameboy_t *gb, char *arguments, char *modifiers, const debugger_command_t *command)
|
||||
{
|
||||
NO_MODIFIERS
|
||||
if (strcmp(lstrip(arguments), "on") == 0) {
|
||||
gb->has_software_breakpoints = true;
|
||||
}
|
||||
else if(strcmp(lstrip(arguments), "off") == 0) {
|
||||
gb->has_software_breakpoints = false;
|
||||
}
|
||||
else {
|
||||
print_usage(gb, command);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Find the index of the closest breakpoint equal or greater to addr */
|
||||
static uint16_t find_breakpoint(GB_gameboy_t *gb, value_t addr)
|
||||
{
|
||||
@ -1780,6 +1797,7 @@ static const debugger_command_t commands[] = {
|
||||
"a more (c)ompact one, or a one-(l)iner", "", "(f|c|l)"},
|
||||
{"lcd", 3, lcd, "Displays information about the current state of the LCD controller"},
|
||||
{"palettes", 3, palettes, "Displays the current CGB palettes"},
|
||||
{"softbreak", 2, softbreak, "Enables or disables software breakpoints", "(on|off)"},
|
||||
{"breakpoint", 1, breakpoint, "Add a new breakpoint at the specified address/expression" HELP_NEWLINE
|
||||
"Can also modify the condition of existing breakpoints." HELP_NEWLINE
|
||||
"If the j modifier is used, the breakpoint will occur just before" HELP_NEWLINE
|
||||
|
@ -601,7 +601,7 @@ struct GB_gameboy_internal_s {
|
||||
/* Breakpoints */
|
||||
uint16_t n_breakpoints;
|
||||
struct GB_breakpoint_s *breakpoints;
|
||||
bool has_jump_to_breakpoints;
|
||||
bool has_jump_to_breakpoints, has_software_breakpoints;
|
||||
void *nontrivial_jump_state;
|
||||
bool non_trivial_jump_breakpoint_occured;
|
||||
|
||||
|
@ -790,10 +790,12 @@ LD_X_Y(l,b) LD_X_Y(l,c) LD_X_Y(l,d) LD_X_Y(l,e) LD_X_Y(l,h) LD_X_DHL
|
||||
LD_DHL_Y(b) LD_DHL_Y(c) LD_DHL_Y(d) LD_DHL_Y(e) LD_DHL_Y(h) LD_DHL_Y(l) LD_DHL_Y(a)
|
||||
LD_X_Y(a,b) LD_X_Y(a,c) LD_X_Y(a,d) LD_X_Y(a,e) LD_X_Y(a,h) LD_X_Y(a,l) LD_X_DHL(a)
|
||||
|
||||
// simply fire the debugger
|
||||
// fire the debugger if software breakpoints are enabled
|
||||
static void ld_b_b(GB_gameboy_t *gb, uint8_t opcode)
|
||||
{
|
||||
if(gb->has_software_breakpoints) {
|
||||
GB_debugger_break(gb);
|
||||
}
|
||||
}
|
||||
|
||||
static void add_a_r(GB_gameboy_t *gb, uint8_t opcode)
|
||||
|
Loading…
Reference in New Issue
Block a user