diff options
| author | 2013-03-11 21:29:51 +0000 | |
|---|---|---|
| committer | 2013-03-11 21:29:51 +0000 | |
| commit | c03729e963eb8d7a2fc49937ed9a594cbebed41c (patch) | |
| tree | e9100399741d881b36c28fcdb9e5e1752f5af646 /src/emu/debug/debugcmd.c | |
| parent | e7e15bca128cdadf20f9d891446008af170a80f4 (diff) | |
Debugger: [Wilbert Pol]
- Added support for registerpoints.
- Added 'exit' as a synonym for 'quit'.
Diffstat (limited to 'src/emu/debug/debugcmd.c')
| -rw-r--r-- | src/emu/debug/debugcmd.c | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/src/emu/debug/debugcmd.c b/src/emu/debug/debugcmd.c index 7e13404ca26..4ceeb684edf 100644 --- a/src/emu/debug/debugcmd.c +++ b/src/emu/debug/debugcmd.c @@ -124,6 +124,10 @@ static void execute_wpset(running_machine &machine, int ref, int params, const c static void execute_wpclear(running_machine &machine, int ref, int params, const char **param); static void execute_wpdisenable(running_machine &machine, int ref, int params, const char **param); static void execute_wplist(running_machine &machine, int ref, int params, const char **param); +static void execute_rpset(running_machine &machine, int ref, int params, const char **param); +static void execute_rpclear(running_machine &machine, int ref, int params, const char **param); +static void execute_rpdisenable(running_machine &machine, int ref, int params, const char **param); +static void execute_rplist(running_machine &machine, int ref, int params, const char **param); static void execute_hotspot(running_machine &machine, int ref, int params, const char **param); static void execute_save(running_machine &machine, int ref, int params, const char **param); static void execute_load(running_machine &machine, int ref, int params, const char **param); @@ -266,6 +270,7 @@ void debug_command_init(running_machine &machine) debug_console_register_command(machine, "logerror", CMDFLAG_NONE, 0, 1, MAX_COMMAND_PARAMS, execute_logerror); debug_console_register_command(machine, "tracelog", CMDFLAG_NONE, 0, 1, MAX_COMMAND_PARAMS, execute_tracelog); debug_console_register_command(machine, "quit", CMDFLAG_NONE, 0, 0, 0, execute_quit); + debug_console_register_command(machine, "exit", CMDFLAG_NONE, 0, 0, 0, execute_quit); debug_console_register_command(machine, "do", CMDFLAG_NONE, 0, 1, 1, execute_do); debug_console_register_command(machine, "step", CMDFLAG_NONE, 0, 0, 1, execute_step); debug_console_register_command(machine, "s", CMDFLAG_NONE, 0, 0, 1, execute_step); @@ -309,6 +314,13 @@ void debug_command_init(running_machine &machine) debug_console_register_command(machine, "wpenable", CMDFLAG_NONE, 1, 0, 1, execute_wpdisenable); debug_console_register_command(machine, "wplist", CMDFLAG_NONE, 0, 0, 0, execute_wplist); + debug_console_register_command(machine, "rpset", CMDFLAG_NONE, 0, 1, 2, execute_rpset); + debug_console_register_command(machine, "rp", CMDFLAG_NONE, 0, 1, 2, execute_rpset); + debug_console_register_command(machine, "rpclear", CMDFLAG_NONE, 0, 0, 1, execute_rpclear); + debug_console_register_command(machine, "rpdisable", CMDFLAG_NONE, 0, 0, 1, execute_rpdisenable); + debug_console_register_command(machine, "rpenable", CMDFLAG_NONE, 1, 0, 1, execute_rpdisenable); + debug_console_register_command(machine, "rplist", CMDFLAG_NONE, 0, 0, 0, execute_rplist); + debug_console_register_command(machine, "hotspot", CMDFLAG_NONE, 0, 0, 3, execute_hotspot); debug_console_register_command(machine, "save", CMDFLAG_NONE, AS_PROGRAM, 3, 4, execute_save); @@ -1488,6 +1500,145 @@ static void execute_wplist(running_machine &machine, int ref, int params, const /*------------------------------------------------- + execute_rpset - execute the registerpoint set + command +-------------------------------------------------*/ + +static void execute_rpset(running_machine &machine, int ref, int params, const char *param[]) +{ + device_t *cpu; + const char *action = NULL; + int bpnum; + + /* CPU is implicit */ + if (!debug_command_parameter_cpu(machine, NULL, &cpu)) + return; + + /* param 1 is the condition */ + parsed_expression condition(&cpu->debug()->symtable()); + if (!debug_command_parameter_expression(machine, param[0], condition)) + return; + + /* param 2 is the action */ + if (!debug_command_parameter_command(machine, action = param[1])) + return; + + /* set the breakpoint */ + bpnum = cpu->debug()->registerpoint_set(condition.original_string(), action); + debug_console_printf(machine, "Registerpoint %X set\n", bpnum); +} + + +/*------------------------------------------------- + execute_rpclear - execute the registerpoint + clear command +-------------------------------------------------*/ + +static void execute_rpclear(running_machine &machine, int ref, int params, const char *param[]) +{ + UINT64 rpindex; + + /* if 0 parameters, clear all */ + if (params == 0) + { + device_iterator iter(machine.root_device()); + for (device_t *device = iter.first(); device != NULL; device = iter.next()) + device->debug()->registerpoint_clear_all(); + debug_console_printf(machine, "Cleared all registerpoints\n"); + } + + /* otherwise, clear the specific one */ + else if (!debug_command_parameter_number(machine, param[0], &rpindex)) + return; + else + { + device_iterator iter(machine.root_device()); + bool found = false; + for (device_t *device = iter.first(); device != NULL; device = iter.next()) + if (device->debug()->registerpoint_clear(rpindex)) + found = true; + if (found) + debug_console_printf(machine, "Registerpoint %X cleared\n", (UINT32)rpindex); + else + debug_console_printf(machine, "Invalid registerpoint number %X\n", (UINT32)rpindex); + } +} + + +/*------------------------------------------------- + execute_rpdisenable - execute the registerpoint + disable/enable commands +-------------------------------------------------*/ + +static void execute_rpdisenable(running_machine &machine, int ref, int params, const char *param[]) +{ + UINT64 rpindex; + + /* if 0 parameters, clear all */ + if (params == 0) + { + device_iterator iter(machine.root_device()); + for (device_t *device = iter.first(); device != NULL; device = iter.next()) + device->debug()->registerpoint_enable_all(ref); + if (ref == 0) + debug_console_printf(machine, "Disabled all registerpoints\n"); + else + debug_console_printf(machine, "Enabled all registeroints\n"); + } + + /* otherwise, clear the specific one */ + else if (!debug_command_parameter_number(machine, param[0], &rpindex)) + return; + else + { + device_iterator iter(machine.root_device()); + bool found = false; + for (device_t *device = iter.first(); device != NULL; device = iter.next()) + if (device->debug()->registerpoint_enable(rpindex, ref)) + found = true; + if (found) + debug_console_printf(machine, "Registerpoint %X %s\n", (UINT32)rpindex, ref ? "enabled" : "disabled"); + else + debug_console_printf(machine, "Invalid registerpoint number %X\n", (UINT32)rpindex); + } +} + + +/*------------------------------------------------- + execute_rplist - execute the registerpoint list + command +-------------------------------------------------*/ + +static void execute_rplist(running_machine &machine, int ref, int params, const char *param[]) +{ + int printed = 0; + astring buffer; + + /* loop over all CPUs */ + device_iterator iter(machine.root_device()); + for (device_t *device = iter.first(); device != NULL; device = iter.next()) + if (device->debug()->registerpoint_first() != NULL) + { + debug_console_printf(machine, "Device '%s' registerpoints:\n", device->tag()); + + /* loop over the breakpoints */ + for (device_debug::registerpoint *rp = device->debug()->registerpoint_first(); rp != NULL; rp = rp->next()) + { + buffer.printf("%c%4X ", rp->enabled() ? ' ' : 'D', rp->index()); + buffer.catprintf("if %s", rp->condition()); + if (rp->action() != NULL) + buffer.catprintf(" do %s", rp->action()); + debug_console_printf(machine, "%s\n", buffer.cstr()); + printed++; + } + } + + if (printed == 0) + debug_console_printf(machine, "No registerpoints currently installed\n"); +} + + +/*------------------------------------------------- execute_hotspot - execute the hotspot command -------------------------------------------------*/ |
