summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/debug/debugcmd.c
diff options
context:
space:
mode:
author Andrew Gardner <andrew-gardner@users.noreply.github.com>2013-04-20 16:36:14 +0000
committer Andrew Gardner <andrew-gardner@users.noreply.github.com>2013-04-20 16:36:14 +0000
commitdd8d9b00440e42e9603091cac33a228cdd9b49f5 (patch)
tree5471d7d558a7e2bc7007e8428371cec3cbd6c890 /src/emu/debug/debugcmd.c
parent09a76b33cdcad17cfad260adacf5a158d381cb9d (diff)
QT Debugger: Adds trackpc command, allowing for a visual display of where the
program counter has visited in the dasm windows. Run "help trackpc" in the debugger to see the options. [Andrew Gardner] Out of whatsnew: This isn't enabled by default because of how sloooow it is to disassemble each opcode when you want to compute its crc32. That can be sped up with lookup tables and the like. There's a good chance I should pull the 'clear tracks' argument into its own command, but it functions as-is. This can be added to the windows debugger with a simple change to the osd display code.
Diffstat (limited to 'src/emu/debug/debugcmd.c')
-rw-r--r--src/emu/debug/debugcmd.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/emu/debug/debugcmd.c b/src/emu/debug/debugcmd.c
index e0d8845de93..d25d2c8d00c 100644
--- a/src/emu/debug/debugcmd.c
+++ b/src/emu/debug/debugcmd.c
@@ -142,6 +142,7 @@ static void execute_trace(running_machine &machine, int ref, int params, const c
static void execute_traceover(running_machine &machine, int ref, int params, const char **param);
static void execute_traceflush(running_machine &machine, int ref, int params, const char **param);
static void execute_history(running_machine &machine, int ref, int params, const char **param);
+static void execute_trackpc(running_machine &machine, int ref, int params, const char **param);
static void execute_snap(running_machine &machine, int ref, int params, const char **param);
static void execute_source(running_machine &machine, int ref, int params, const char **param);
static void execute_map(running_machine &machine, int ref, int params, const char **param);
@@ -366,6 +367,7 @@ void debug_command_init(running_machine &machine)
debug_console_register_command(machine, "traceflush",CMDFLAG_NONE, 0, 0, 0, execute_traceflush);
debug_console_register_command(machine, "history", CMDFLAG_NONE, 0, 0, 2, execute_history);
+ debug_console_register_command(machine, "trackpc", CMDFLAG_NONE, 0, 0, 3, execute_trackpc);
debug_console_register_command(machine, "snap", CMDFLAG_NONE, 0, 0, 1, execute_snap);
@@ -2651,6 +2653,48 @@ static void execute_history(running_machine &machine, int ref, int params, const
/*-------------------------------------------------
+ execute_trackpc - execute the trackpc command
+-------------------------------------------------*/
+
+static void execute_trackpc(running_machine &machine, int ref, int params, const char *param[])
+{
+ // Gather the on/off switch (if present)
+ UINT64 turnOn = true;
+ if (!debug_command_parameter_number(machine, param[0], &turnOn))
+ return;
+
+ // Gather the cpu id (if present)
+ device_t *cpu = NULL;
+ if (!debug_command_parameter_cpu(machine, (params > 1) ? param[1] : NULL, &cpu))
+ return;
+
+ // Should we clear the existing data?
+ UINT64 clear = false;
+ if (!debug_command_parameter_number(machine, param[2], &clear))
+ return;
+
+ cpu->debug()->set_track_pc((bool)turnOn);
+ if (turnOn)
+ {
+ // Insert current pc
+ if (debug_cpu_get_visible_cpu(machine) == cpu)
+ {
+ const offs_t pc = cpu->debug()->pc();
+ cpu->debug()->set_track_pc_visited(pc);
+ }
+ debug_console_printf(machine, "PC tracking enabled\n");
+ }
+ else
+ {
+ debug_console_printf(machine, "PC tracking disabled\n");
+ }
+
+ if (clear)
+ cpu->debug()->track_pc_data_clear();
+}
+
+
+/*-------------------------------------------------
execute_snap - execute the snapshot command
-------------------------------------------------*/