summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/debug/debugcpu.c
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2008-12-19 06:46:17 +0000
committer Aaron Giles <aaron@aarongiles.com>2008-12-19 06:46:17 +0000
commit42c9aeff3943f2e6779d3d125fc014cd96d16d71 (patch)
tree8d681b294d01bf526dd808ed95337cab1b98d101 /src/emu/debug/debugcpu.c
parent3fdd1d460aa7b752956237d5e9c8a9ebecf409b9 (diff)
Cleaned up device and sound interfaces to match the CPU
interfaces when handling strings. Namely, the generic get_info functions allocate a temporary string and the device in question copies its string to the target, instead of assigning a const char *. Updated all device and sound cores to operate this way. Added the concept of a cpu_state_table, which is supplied by the CPU cores and which describes all the register state accessible to the debugger and other subsystems. The format of the table is such that most data can be simply fetched from memory without the further involvement of the CPU core, including the display of common formats. Extensibility points are available for custom display and for importing/exporting the data to intermediate variables for more complicated scenarios. Updated the ADSP21xx, TMS340x0, and i86 cores to use this. Removed the old debugger register list, which was never used. Replaced it with using ordering from the cpu_state_table. Renamed REG_PC -> REG_GENPC, REG_SP -> REG_GENSP, and REG_PREVIOUSPC -> REG_GENPCBASE. Updated a few spots that were using these directly. Moved these definitions into the end of the register area rather than leaving them outside which put them in a weird range.
Diffstat (limited to 'src/emu/debug/debugcpu.c')
-rw-r--r--src/emu/debug/debugcpu.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c
index 95ecfc666cc..bcc993bb4e4 100644
--- a/src/emu/debug/debugcpu.c
+++ b/src/emu/debug/debugcpu.c
@@ -79,12 +79,6 @@ struct _debugcpu_private
/***************************************************************************
- LOCAL VARIABLES
-***************************************************************************/
-
-
-
-/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
@@ -214,7 +208,6 @@ void debug_cpu_init(running_machine *machine)
info->symtable = symtable_alloc(global->symtable, (void *)cpu);
/* add a global symbol for the current instruction pointer */
- symtable_add_register(info->symtable, "curpc", NULL, get_current_pc, 0);
symtable_add_register(info->symtable, "cycles", NULL, get_cycles, NULL);
if (classheader->space[ADDRESS_SPACE_PROGRAM] != NULL)
symtable_add_register(info->symtable, "logunmap", (void *)classheader->space[ADDRESS_SPACE_PROGRAM], get_logunmap, set_logunmap);
@@ -249,6 +242,10 @@ void debug_cpu_init(running_machine *machine)
/* add the symbol to the table */
symtable_add_register(info->symtable, symname, (void *)(FPTR)regnum, get_cpu_reg, set_cpu_reg);
}
+
+ /* if no curpc, add one */
+ if (symtable_find(info->symtable, "curpc") == NULL)
+ symtable_add_register(info->symtable, "curpc", NULL, get_current_pc, 0);
}
/* first CPU is visible by default */
@@ -319,7 +316,7 @@ int debug_cpu_within_instruction_hook(running_machine *machine)
int debug_cpu_is_stopped(running_machine *machine)
{
debugcpu_private *global = machine->debugcpu_data;
- return global->execution_state == EXECUTION_STATE_STOPPED;
+ return (global != NULL) ? (global->execution_state == EXECUTION_STATE_STOPPED) : FALSE;
}