mirror of
https://github.com/holub/mame
synced 2025-05-16 19:00:43 +03:00
Further debugger cleanup. Symbol tables now have a global ref
as well as a per-symbol ref. Debugcpu is now clear of active CPU references and global Machine references.
This commit is contained in:
parent
df6b68241f
commit
5d89160f3b
@ -205,10 +205,10 @@ static void script_entry_free(script_entry *entry);
|
||||
|
||||
static astring *quote_astring_expression(astring *string, int isattribute);
|
||||
static int validate_format(const char *filename, int line, const script_entry *entry);
|
||||
static UINT64 cheat_variable_get(void *ref);
|
||||
static void cheat_variable_set(void *ref, UINT64 value);
|
||||
static UINT64 execute_frombcd(void *ref, UINT32 params, const UINT64 *param);
|
||||
static UINT64 execute_tobcd(void *ref, UINT32 params, const UINT64 *param);
|
||||
static UINT64 cheat_variable_get(void *globalref, void *ref);
|
||||
static void cheat_variable_set(void *globalref, void *ref, UINT64 value);
|
||||
static UINT64 execute_frombcd(void *globalref, void *ref, UINT32 params, const UINT64 *param);
|
||||
static UINT64 execute_tobcd(void *globalref, void *ref, UINT32 params, const UINT64 *param);
|
||||
|
||||
|
||||
|
||||
@ -951,7 +951,7 @@ static cheat_entry *cheat_entry_load(running_machine *machine, const char *filen
|
||||
cheat->description = astring_dupc(description);
|
||||
|
||||
/* create the symbol table */
|
||||
cheat->symbols = symtable_alloc(NULL);
|
||||
cheat->symbols = symtable_alloc(NULL, machine);
|
||||
symtable_add_register(cheat->symbols, "frame", &cheatinfo->framecount, cheat_variable_get, NULL);
|
||||
symtable_add_register(cheat->symbols, "argindex", &cheat->argindex, cheat_variable_get, NULL);
|
||||
for (curtemp = 0; curtemp < tempcount; curtemp++)
|
||||
@ -1653,7 +1653,7 @@ static int validate_format(const char *filename, int line, const script_entry *e
|
||||
cheat variable
|
||||
-------------------------------------------------*/
|
||||
|
||||
static UINT64 cheat_variable_get(void *ref)
|
||||
static UINT64 cheat_variable_get(void *globalref, void *ref)
|
||||
{
|
||||
return *(UINT64 *)ref;
|
||||
}
|
||||
@ -1664,7 +1664,7 @@ static UINT64 cheat_variable_get(void *ref)
|
||||
cheat variable
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void cheat_variable_set(void *ref, UINT64 value)
|
||||
static void cheat_variable_set(void *globalref, void *ref, UINT64 value)
|
||||
{
|
||||
*(UINT64 *)ref = value;
|
||||
}
|
||||
@ -1674,7 +1674,7 @@ static void cheat_variable_set(void *ref, UINT64 value)
|
||||
execute_frombcd - convert a value from BCD
|
||||
-------------------------------------------------*/
|
||||
|
||||
static UINT64 execute_frombcd(void *ref, UINT32 params, const UINT64 *param)
|
||||
static UINT64 execute_frombcd(void *globalref, void *ref, UINT32 params, const UINT64 *param)
|
||||
{
|
||||
UINT64 value = param[0];
|
||||
UINT64 multiplier = 1;
|
||||
@ -1694,7 +1694,7 @@ static UINT64 execute_frombcd(void *ref, UINT32 params, const UINT64 *param)
|
||||
execute_tobcd - convert a value to BCD
|
||||
-------------------------------------------------*/
|
||||
|
||||
static UINT64 execute_tobcd(void *ref, UINT32 params, const UINT64 *param)
|
||||
static UINT64 execute_tobcd(void *globalref, void *ref, UINT32 params, const UINT64 *param)
|
||||
{
|
||||
UINT64 value = param[0];
|
||||
UINT64 result = 0;
|
||||
|
@ -58,12 +58,12 @@ static global_entry global_array[MAX_GLOBALS];
|
||||
|
||||
static void debug_command_exit(running_machine *machine);
|
||||
|
||||
static UINT64 execute_min(void *ref, UINT32 params, const UINT64 *param);
|
||||
static UINT64 execute_max(void *ref, UINT32 params, const UINT64 *param);
|
||||
static UINT64 execute_if(void *ref, UINT32 params, const UINT64 *param);
|
||||
static UINT64 execute_min(void *globalref, void *ref, UINT32 params, const UINT64 *param);
|
||||
static UINT64 execute_max(void *globalref, void *ref, UINT32 params, const UINT64 *param);
|
||||
static UINT64 execute_if(void *globalref, void *ref, UINT32 params, const UINT64 *param);
|
||||
|
||||
static UINT64 global_get(void *ref);
|
||||
static void global_set(void *ref, UINT64 value);
|
||||
static UINT64 global_get(void *globalref, void *ref);
|
||||
static void global_set(void *globalref, void *ref, UINT64 value);
|
||||
|
||||
static void execute_help(running_machine *machine, int ref, int params, const char **param);
|
||||
static void execute_print(running_machine *machine, int ref, int params, const char **param);
|
||||
@ -291,7 +291,7 @@ static void debug_command_exit(running_machine *machine)
|
||||
execute_min - return the minimum of two values
|
||||
-------------------------------------------------*/
|
||||
|
||||
static UINT64 execute_min(void *ref, UINT32 params, const UINT64 *param)
|
||||
static UINT64 execute_min(void *globalref, void *ref, UINT32 params, const UINT64 *param)
|
||||
{
|
||||
return (param[0] < param[1]) ? param[0] : param[1];
|
||||
}
|
||||
@ -301,7 +301,7 @@ static UINT64 execute_min(void *ref, UINT32 params, const UINT64 *param)
|
||||
execute_max - return the maximum of two values
|
||||
-------------------------------------------------*/
|
||||
|
||||
static UINT64 execute_max(void *ref, UINT32 params, const UINT64 *param)
|
||||
static UINT64 execute_max(void *globalref, void *ref, UINT32 params, const UINT64 *param)
|
||||
{
|
||||
return (param[0] > param[1]) ? param[0] : param[1];
|
||||
}
|
||||
@ -311,7 +311,7 @@ static UINT64 execute_max(void *ref, UINT32 params, const UINT64 *param)
|
||||
execute_if - if (a) return b; else return c;
|
||||
-------------------------------------------------*/
|
||||
|
||||
static UINT64 execute_if(void *ref, UINT32 params, const UINT64 *param)
|
||||
static UINT64 execute_if(void *globalref, void *ref, UINT32 params, const UINT64 *param)
|
||||
{
|
||||
return param[0] ? param[1] : param[2];
|
||||
}
|
||||
@ -328,7 +328,7 @@ static UINT64 execute_if(void *ref, UINT32 params, const UINT64 *param)
|
||||
global_get - symbol table getter for globals
|
||||
-------------------------------------------------*/
|
||||
|
||||
static UINT64 global_get(void *ref)
|
||||
static UINT64 global_get(void *globalref, void *ref)
|
||||
{
|
||||
global_entry *global = ref;
|
||||
switch (global->size)
|
||||
@ -346,7 +346,7 @@ static UINT64 global_get(void *ref)
|
||||
global_set - symbol table setter for globals
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void global_set(void *ref, UINT64 value)
|
||||
static void global_set(void *globalref, void *ref, UINT64 value)
|
||||
{
|
||||
global_entry *global = ref;
|
||||
switch (global->size)
|
||||
@ -694,7 +694,7 @@ static void execute_step(running_machine *machine, int ref, int params, const ch
|
||||
if (params > 0 && !debug_command_parameter_number(machine, param[0], &steps))
|
||||
return;
|
||||
|
||||
debug_cpu_single_step(steps);
|
||||
debug_cpu_single_step(machine, steps);
|
||||
}
|
||||
|
||||
|
||||
@ -710,7 +710,7 @@ static void execute_over(running_machine *machine, int ref, int params, const ch
|
||||
if (params > 0 && !debug_command_parameter_number(machine, param[0], &steps))
|
||||
return;
|
||||
|
||||
debug_cpu_single_step_over(steps);
|
||||
debug_cpu_single_step_over(machine, steps);
|
||||
}
|
||||
|
||||
|
||||
@ -720,7 +720,7 @@ static void execute_over(running_machine *machine, int ref, int params, const ch
|
||||
|
||||
static void execute_out(running_machine *machine, int ref, int params, const char *param[])
|
||||
{
|
||||
debug_cpu_single_step_out();
|
||||
debug_cpu_single_step_out(machine);
|
||||
}
|
||||
|
||||
|
||||
@ -736,7 +736,7 @@ static void execute_go(running_machine *machine, int ref, int params, const char
|
||||
if (params > 0 && !debug_command_parameter_number(machine, param[0], &addr))
|
||||
return;
|
||||
|
||||
debug_cpu_go(addr);
|
||||
debug_cpu_go(machine, addr);
|
||||
}
|
||||
|
||||
|
||||
@ -747,7 +747,7 @@ static void execute_go(running_machine *machine, int ref, int params, const char
|
||||
|
||||
static void execute_go_vblank(running_machine *machine, int ref, int params, const char *param[])
|
||||
{
|
||||
debug_cpu_go_vblank();
|
||||
debug_cpu_go_vblank(machine);
|
||||
}
|
||||
|
||||
|
||||
@ -763,7 +763,7 @@ static void execute_go_interrupt(running_machine *machine, int ref, int params,
|
||||
if (params > 0 && !debug_command_parameter_number(machine, param[0], &irqline))
|
||||
return;
|
||||
|
||||
debug_cpu_go_interrupt(irqline);
|
||||
debug_cpu_go_interrupt(machine, irqline);
|
||||
}
|
||||
|
||||
|
||||
@ -779,7 +779,7 @@ static void execute_go_time(running_machine *machine, int ref, int params, const
|
||||
if (params > 0 && !debug_command_parameter_number(machine, param[0], &milliseconds))
|
||||
return;
|
||||
|
||||
debug_cpu_go_milliseconds(milliseconds);
|
||||
debug_cpu_go_milliseconds(machine, milliseconds);
|
||||
}
|
||||
|
||||
|
||||
@ -789,7 +789,7 @@ static void execute_go_time(running_machine *machine, int ref, int params, const
|
||||
|
||||
static void execute_next(running_machine *machine, int ref, int params, const char *param[])
|
||||
{
|
||||
debug_cpu_next_cpu();
|
||||
debug_cpu_next_cpu(machine);
|
||||
}
|
||||
|
||||
|
||||
@ -1728,6 +1728,7 @@ static void execute_find(running_machine *machine, int ref, int params, const ch
|
||||
static void execute_dasm(running_machine *machine, int ref, int params, const char *param[])
|
||||
{
|
||||
const device_config *cpu = debug_cpu_get_visible_cpu(machine);
|
||||
const address_space *space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM);
|
||||
UINT64 offset, length, bytes = 1;
|
||||
const cpu_debug_data *info;
|
||||
int minbytes, maxbytes, byteswidth;
|
||||
@ -1788,12 +1789,12 @@ static void execute_dasm(running_machine *machine, int ref, int params, const ch
|
||||
/* fetch the bytes up to the maximum */
|
||||
for (numbytes = 0; numbytes < maxbytes; numbytes++)
|
||||
{
|
||||
opbuf[numbytes] = debug_read_opcode(pcbyte + numbytes, 1, FALSE);
|
||||
argbuf[numbytes] = debug_read_opcode(pcbyte + numbytes, 1, TRUE);
|
||||
opbuf[numbytes] = debug_read_opcode(space, pcbyte + numbytes, 1, FALSE);
|
||||
argbuf[numbytes] = debug_read_opcode(space, pcbyte + numbytes, 1, TRUE);
|
||||
}
|
||||
|
||||
/* disassemble the result */
|
||||
i += numbytes = cpu_dasm(machine->activecpu, disasm, offset + i, opbuf, argbuf) & DASMFLAG_LENGTHMASK;
|
||||
i += numbytes = cpu_dasm(cpu, disasm, offset + i, opbuf, argbuf) & DASMFLAG_LENGTHMASK;
|
||||
}
|
||||
|
||||
/* print the bytes */
|
||||
@ -1805,23 +1806,23 @@ static void execute_dasm(running_machine *machine, int ref, int params, const ch
|
||||
{
|
||||
case 1:
|
||||
for (j = 0; j < numbytes; j++)
|
||||
outdex += sprintf(&output[outdex], "%02X ", (UINT32)debug_read_opcode(pcbyte + j, 1, FALSE));
|
||||
outdex += sprintf(&output[outdex], "%02X ", (UINT32)debug_read_opcode(space, pcbyte + j, 1, FALSE));
|
||||
break;
|
||||
|
||||
case 2:
|
||||
for (j = 0; j < numbytes; j += 2)
|
||||
outdex += sprintf(&output[outdex], "%04X ", (UINT32)debug_read_opcode(pcbyte + j, 2, FALSE));
|
||||
outdex += sprintf(&output[outdex], "%04X ", (UINT32)debug_read_opcode(space, pcbyte + j, 2, FALSE));
|
||||
break;
|
||||
|
||||
case 4:
|
||||
for (j = 0; j < numbytes; j += 4)
|
||||
outdex += sprintf(&output[outdex], "%08X ", (UINT32)debug_read_opcode(pcbyte + j, 4, FALSE));
|
||||
outdex += sprintf(&output[outdex], "%08X ", (UINT32)debug_read_opcode(space, pcbyte + j, 4, FALSE));
|
||||
break;
|
||||
|
||||
case 8:
|
||||
for (j = 0; j < numbytes; j += 8)
|
||||
{
|
||||
UINT64 val = debug_read_opcode(pcbyte + j, 8, FALSE);
|
||||
UINT64 val = debug_read_opcode(space, pcbyte + j, 8, FALSE);
|
||||
outdex += sprintf(&output[outdex], "%08X%08X ", (UINT32)(val >> 32), (UINT32)val);
|
||||
}
|
||||
break;
|
||||
@ -1940,7 +1941,7 @@ static void execute_traceover(running_machine *machine, int ref, int params, con
|
||||
|
||||
static void execute_traceflush(running_machine *machine, int ref, int params, const char *param[])
|
||||
{
|
||||
debug_cpu_flush_traces();
|
||||
debug_cpu_flush_traces(machine);
|
||||
}
|
||||
|
||||
|
||||
@ -1951,6 +1952,7 @@ static void execute_traceflush(running_machine *machine, int ref, int params, co
|
||||
static void execute_history(running_machine *machine, int ref, int params, const char *param[])
|
||||
{
|
||||
const device_config *cpu = debug_cpu_get_visible_cpu(machine);
|
||||
const address_space *space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM);
|
||||
UINT64 count = DEBUG_HISTORY_SIZE;
|
||||
const cpu_debug_data *info;
|
||||
int i;
|
||||
@ -1982,8 +1984,8 @@ static void execute_history(running_machine *machine, int ref, int params, const
|
||||
pcbyte = ADDR2BYTE_MASKED(pc, info, ADDRESS_SPACE_PROGRAM);
|
||||
for (numbytes = 0; numbytes < maxbytes; numbytes++)
|
||||
{
|
||||
opbuf[numbytes] = debug_read_opcode(pcbyte + numbytes, 1, FALSE);
|
||||
argbuf[numbytes] = debug_read_opcode(pcbyte + numbytes, 1, TRUE);
|
||||
opbuf[numbytes] = debug_read_opcode(space, pcbyte + numbytes, 1, FALSE);
|
||||
argbuf[numbytes] = debug_read_opcode(space, pcbyte + numbytes, 1, TRUE);
|
||||
}
|
||||
|
||||
cpu_dasm(cpu, buffer, pc, opbuf, argbuf);
|
||||
@ -2177,7 +2179,7 @@ static void execute_symlist(running_machine *machine, int ref, int params, const
|
||||
for (symnum = 0; symnum < count; symnum++)
|
||||
{
|
||||
const symbol_entry *entry = symtable_find(symtable, namelist[symnum]);
|
||||
UINT64 value = (*entry->info.reg.getter)(entry->ref);
|
||||
UINT64 value = (*entry->info.reg.getter)(symtable_get_globalref(entry->table), entry->ref);
|
||||
assert(entry != NULL);
|
||||
|
||||
/* only display "register" type symbols */
|
||||
|
@ -311,6 +311,7 @@ UINT32 debug_comment_all_change_count(running_machine *machine)
|
||||
UINT32 debug_comment_get_opcode_crc32(const device_config *device, offs_t address)
|
||||
{
|
||||
const cpu_debug_data *info = cpu_get_debug_data(device);
|
||||
const address_space *space = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
|
||||
int i;
|
||||
UINT32 crc;
|
||||
UINT8 opbuf[64], argbuf[64];
|
||||
@ -325,8 +326,8 @@ UINT32 debug_comment_get_opcode_crc32(const device_config *device, offs_t addres
|
||||
// fetch the bytes up to the maximum
|
||||
for (i = 0; i < maxbytes; i++)
|
||||
{
|
||||
opbuf[i] = debug_read_opcode(address + i, 1, FALSE);
|
||||
argbuf[i] = debug_read_opcode(address + i, 1, TRUE);
|
||||
opbuf[i] = debug_read_opcode(space, address + i, 1, FALSE);
|
||||
argbuf[i] = debug_read_opcode(space, address + i, 1, TRUE);
|
||||
}
|
||||
|
||||
numbytes = cpu_dasm(device, buff, address & addrmask, opbuf, argbuf) & DASMFLAG_LENGTHMASK;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -185,7 +185,6 @@ struct _debug_cpu_watchpoint
|
||||
GLOBAL VARIABLES
|
||||
***************************************************************************/
|
||||
|
||||
extern FILE *debug_source_file;
|
||||
extern const express_callbacks debug_expression_callbacks;
|
||||
|
||||
|
||||
@ -194,14 +193,31 @@ extern const express_callbacks debug_expression_callbacks;
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
/* ----- initialization ----- */
|
||||
/* ----- initialization and cleanup ----- */
|
||||
|
||||
/* initialize the CPU tracking for the debugger */
|
||||
void debug_cpu_init(running_machine *machine);
|
||||
|
||||
/* flushes all traces; this is useful if a trace is going on when we fatalerror */
|
||||
void debug_cpu_flush_traces(running_machine *machine);
|
||||
|
||||
|
||||
|
||||
/* ----- debugging status & information ----- */
|
||||
|
||||
/* return the visible CPU device (the one that commands should apply to) */
|
||||
const device_config *debug_cpu_get_visible_cpu(running_machine *machine);
|
||||
|
||||
/* TRUE if the debugger is currently stopped within an instruction hook callback */
|
||||
int debug_cpu_within_instruction_hook(running_machine *machine);
|
||||
|
||||
/* return TRUE if the current execution state is stopped */
|
||||
int debug_cpu_is_stopped(running_machine *machine);
|
||||
|
||||
|
||||
|
||||
/* ----- symbol table interfaces ----- */
|
||||
|
||||
/* return the global symbol table */
|
||||
symbol_table *debug_cpu_get_global_symtable(running_machine *machine);
|
||||
|
||||
@ -238,54 +254,115 @@ void debug_cpu_memory_write_hook(const address_space *space, offs_t address, UIN
|
||||
|
||||
|
||||
|
||||
/* ----- core debugger functions ----- */
|
||||
/* ----- execution control ----- */
|
||||
|
||||
int debug_cpu_within_instruction_hook(running_machine *machine);
|
||||
void debug_cpu_halt_on_next_instruction(running_machine *machine, int cpunum, const char *fmt, ...) ATTR_PRINTF(3,4);
|
||||
int debug_cpu_is_stopped(running_machine *machine);
|
||||
void debug_cpu_trace_printf(const device_config *device, const char *fmt, ...) ATTR_PRINTF(2,3);
|
||||
void debug_cpu_source_script(running_machine *machine, const char *file);
|
||||
void debug_cpu_flush_traces(void);
|
||||
/* halt in the debugger on the next instruction */
|
||||
void debug_cpu_halt_on_next_instruction(const device_config *device, const char *fmt, ...) ATTR_PRINTF(2,3);
|
||||
|
||||
/* debugging hooks */
|
||||
void debug_cpu_set_instruction_hook(const device_config *device, debug_instruction_hook_func hook);
|
||||
|
||||
/* execution control */
|
||||
void debug_cpu_single_step(int numsteps);
|
||||
void debug_cpu_single_step_over(int numsteps);
|
||||
void debug_cpu_single_step_out(void);
|
||||
void debug_cpu_go(offs_t targetpc);
|
||||
void debug_cpu_go_vblank(void);
|
||||
void debug_cpu_go_interrupt(int irqline);
|
||||
void debug_cpu_go_milliseconds(UINT64 milliseconds);
|
||||
void debug_cpu_next_cpu(void);
|
||||
/* ignore/observe a given CPU */
|
||||
void debug_cpu_ignore_cpu(const device_config *cpu, int ignore);
|
||||
|
||||
/* tracing support */
|
||||
void debug_cpu_trace(const device_config *device, FILE *file, int trace_over, const char *action);
|
||||
/* single step the visible CPU past the requested number of instructions */
|
||||
void debug_cpu_single_step(running_machine *machine, int numsteps);
|
||||
|
||||
/* breakpoints */
|
||||
/* single step the visible over the requested number of instructions */
|
||||
void debug_cpu_single_step_over(running_machine *machine, int numsteps);
|
||||
|
||||
/* single step the visible CPU out of the current function */
|
||||
void debug_cpu_single_step_out(running_machine *machine);
|
||||
|
||||
/* execute the visible CPU until it hits the given address */
|
||||
void debug_cpu_go(running_machine *machine, offs_t targetpc);
|
||||
|
||||
/* execute until the next VBLANK */
|
||||
void debug_cpu_go_vblank(running_machine *machine);
|
||||
|
||||
/* execute until the specified interrupt fires on the visible CPU */
|
||||
void debug_cpu_go_interrupt(running_machine *machine, int irqline);
|
||||
|
||||
/* execute until the specified exception fires on the visible CPU */
|
||||
void debug_cpu_go_exception(running_machine *machine, int exception);
|
||||
|
||||
/* execute until the specified delay elapses */
|
||||
void debug_cpu_go_milliseconds(running_machine *machine, UINT64 milliseconds);
|
||||
|
||||
/* execute until we hit the next CPU */
|
||||
void debug_cpu_next_cpu(running_machine *machine);
|
||||
|
||||
|
||||
|
||||
/* ----- breakpoints ----- */
|
||||
|
||||
/* set a new breakpoint, returning its index */
|
||||
int debug_cpu_breakpoint_set(const device_config *device, offs_t address, parsed_expression *condition, const char *action);
|
||||
|
||||
/* clear a breakpoint by index */
|
||||
int debug_cpu_breakpoint_clear(running_machine *machine, int bpnum);
|
||||
|
||||
/* enable/disable a breakpoint by index */
|
||||
int debug_cpu_breakpoint_enable(running_machine *machine, int bpnum, int enable);
|
||||
|
||||
/* watchpoints */
|
||||
|
||||
|
||||
/* ----- watchpoints ----- */
|
||||
|
||||
/* set a new watchpoint, returning its index */
|
||||
int debug_cpu_watchpoint_set(const address_space *space, int type, offs_t address, offs_t length, parsed_expression *condition, const char *action);
|
||||
|
||||
/* clear a watchpoint by index */
|
||||
int debug_cpu_watchpoint_clear(running_machine *machine, int wpnum);
|
||||
|
||||
/* enable/disable a watchpoint by index */
|
||||
int debug_cpu_watchpoint_enable(running_machine *machine, int wpnum, int enable);
|
||||
|
||||
|
||||
|
||||
/* ----- misc debugger functions ----- */
|
||||
|
||||
/* specifies a debug command script to execute */
|
||||
void debug_cpu_source_script(running_machine *machine, const char *file);
|
||||
|
||||
/* trace execution of a given CPU */
|
||||
void debug_cpu_trace(const device_config *device, FILE *file, int trace_over, const char *action);
|
||||
|
||||
/* output data into the given CPU's tracefile, if tracing */
|
||||
void debug_cpu_trace_printf(const device_config *device, const char *fmt, ...) ATTR_PRINTF(2,3);
|
||||
|
||||
/* set a hook to be called on each instruction for a given CPU */
|
||||
void debug_cpu_set_instruction_hook(const device_config *device, debug_instruction_hook_func hook);
|
||||
|
||||
/* hotspots */
|
||||
int debug_cpu_hotspot_track(const device_config *device, int numspots, int threshhold);
|
||||
|
||||
/* memory accessors */
|
||||
|
||||
|
||||
/* ----- debugger memory accessors ----- */
|
||||
|
||||
/* return a byte from the the specified memory space */
|
||||
UINT8 debug_read_byte(const address_space *space, offs_t address, int apply_translation);
|
||||
|
||||
/* return a word from the the specified memory space */
|
||||
UINT16 debug_read_word(const address_space *space, offs_t address, int apply_translation);
|
||||
|
||||
/* return a dword from the the specified memory space */
|
||||
UINT32 debug_read_dword(const address_space *space, offs_t address, int apply_translation);
|
||||
|
||||
/* return a qword from the the specified memory space */
|
||||
UINT64 debug_read_qword(const address_space *space, offs_t address, int apply_translation);
|
||||
|
||||
/* write a byte to the specified memory space */
|
||||
void debug_write_byte(const address_space *space, offs_t address, UINT8 data, int apply_translation);
|
||||
|
||||
/* write a word to the specified memory space */
|
||||
void debug_write_word(const address_space *space, offs_t address, UINT16 data, int apply_translation);
|
||||
|
||||
/* write a dword to the specified memory space */
|
||||
void debug_write_dword(const address_space *space, offs_t address, UINT32 data, int apply_translation);
|
||||
|
||||
/* write a qword to the specified memory space */
|
||||
void debug_write_qword(const address_space *space, offs_t address, UINT64 data, int apply_translation);
|
||||
UINT64 debug_read_opcode(UINT32 offset, int size, int arg);
|
||||
|
||||
/* read 1,2,4 or 8 bytes at the given offset from opcode space */
|
||||
UINT64 debug_read_opcode(const address_space *space, offs_t offset, int size, int arg);
|
||||
|
||||
#endif
|
||||
|
@ -1327,8 +1327,9 @@ static void disasm_free(debug_view *view)
|
||||
|
||||
static offs_t disasm_back_up(int cpunum, const cpu_debug_data *cpuinfo, offs_t startpc, int numinstrs)
|
||||
{
|
||||
int minlen = BYTE2ADDR(cpu_get_min_opcode_bytes(Machine->activecpu), cpuinfo, ADDRESS_SPACE_PROGRAM);
|
||||
int maxlen = BYTE2ADDR(cpu_get_max_opcode_bytes(Machine->activecpu), cpuinfo, ADDRESS_SPACE_PROGRAM);
|
||||
int minlen = BYTE2ADDR(cpu_get_min_opcode_bytes(cpuinfo->device), cpuinfo, ADDRESS_SPACE_PROGRAM);
|
||||
int maxlen = BYTE2ADDR(cpu_get_max_opcode_bytes(cpuinfo->device), cpuinfo, ADDRESS_SPACE_PROGRAM);
|
||||
const address_space *space = cpu_get_address_space(cpuinfo->device, ADDRESS_SPACE_PROGRAM);
|
||||
UINT32 addrmask = cpuinfo->space[ADDRESS_SPACE_PROGRAM].logaddrmask;
|
||||
offs_t curpc, lastgoodpc = startpc, temppc;
|
||||
UINT8 opbuf[1024], argbuf[1024];
|
||||
@ -1346,8 +1347,8 @@ static offs_t disasm_back_up(int cpunum, const cpu_debug_data *cpuinfo, offs_t s
|
||||
/* prefetch the opcode bytes */
|
||||
for (temppc = curpc; temppc < startpc; temppc++)
|
||||
{
|
||||
opbuf[1000 + temppc - startpc] = debug_read_opcode(temppc, 1, FALSE);
|
||||
argbuf[1000 + temppc - startpc] = debug_read_opcode(temppc, 1, TRUE);
|
||||
opbuf[1000 + temppc - startpc] = debug_read_opcode(space, temppc, 1, FALSE);
|
||||
argbuf[1000 + temppc - startpc] = debug_read_opcode(space, temppc, 1, TRUE);
|
||||
}
|
||||
|
||||
/* loop until we hit it */
|
||||
@ -1364,7 +1365,7 @@ static offs_t disasm_back_up(int cpunum, const cpu_debug_data *cpuinfo, offs_t s
|
||||
/* get the disassembly, but only if mapped */
|
||||
instlen = 1;
|
||||
if (cpuinfo->translate == NULL || (*cpuinfo->translate)(cpuinfo->device, ADDRESS_SPACE_PROGRAM, TRANSLATE_FETCH_DEBUG, &pcbyte))
|
||||
instlen = cpu_dasm(Machine->activecpu, dasmbuffer, testpc & addrmask, &opbuf[1000 + testpc - startpc], &argbuf[1000 + testpc - startpc]) & DASMFLAG_LENGTHMASK;
|
||||
instlen = cpu_dasm(cpuinfo->device, dasmbuffer, testpc & addrmask, &opbuf[1000 + testpc - startpc], &argbuf[1000 + testpc - startpc]) & DASMFLAG_LENGTHMASK;
|
||||
|
||||
/* count this one */
|
||||
instcount++;
|
||||
@ -1390,8 +1391,8 @@ static offs_t disasm_back_up(int cpunum, const cpu_debug_data *cpuinfo, offs_t s
|
||||
/* prefetch the opcode bytes */
|
||||
for (temppc = nextcurpc; temppc < curpc; temppc++)
|
||||
{
|
||||
opbuf[1000 + temppc - startpc] = debug_read_opcode(temppc, 1, FALSE);
|
||||
argbuf[1000 + temppc - startpc] = debug_read_opcode(temppc, 1, TRUE);
|
||||
opbuf[1000 + temppc - startpc] = debug_read_opcode(space, temppc, 1, FALSE);
|
||||
argbuf[1000 + temppc - startpc] = debug_read_opcode(space, temppc, 1, TRUE);
|
||||
}
|
||||
|
||||
/* update curpc once we're done fetching */
|
||||
@ -1409,6 +1410,7 @@ static offs_t disasm_back_up(int cpunum, const cpu_debug_data *cpuinfo, offs_t s
|
||||
|
||||
static void disasm_generate_bytes(offs_t pcbyte, int numbytes, const cpu_debug_data *cpuinfo, int minbytes, char *string, int maxchars, int encrypted)
|
||||
{
|
||||
const address_space *space = cpu_get_address_space(cpuinfo->device, ADDRESS_SPACE_PROGRAM);
|
||||
int byte, offset = 0;
|
||||
UINT64 val;
|
||||
|
||||
@ -1416,32 +1418,32 @@ static void disasm_generate_bytes(offs_t pcbyte, int numbytes, const cpu_debug_d
|
||||
{
|
||||
case 1:
|
||||
if (maxchars >= 2)
|
||||
offset = sprintf(string, "%02X", (UINT32)debug_read_opcode(pcbyte, 1, FALSE));
|
||||
offset = sprintf(string, "%02X", (UINT32)debug_read_opcode(space, pcbyte, 1, FALSE));
|
||||
for (byte = 1; byte < numbytes && offset + 3 < maxchars; byte++)
|
||||
offset += sprintf(&string[offset], " %02X", (UINT32)debug_read_opcode(pcbyte + byte, 1, encrypted));
|
||||
offset += sprintf(&string[offset], " %02X", (UINT32)debug_read_opcode(space, pcbyte + byte, 1, encrypted));
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (maxchars >= 4)
|
||||
offset = sprintf(string, "%04X", (UINT32)debug_read_opcode(pcbyte, 2, FALSE));
|
||||
offset = sprintf(string, "%04X", (UINT32)debug_read_opcode(space, pcbyte, 2, FALSE));
|
||||
for (byte = 2; byte < numbytes && offset + 5 < maxchars; byte += 2)
|
||||
offset += sprintf(&string[offset], " %04X", (UINT32)debug_read_opcode(pcbyte + byte, 2, encrypted));
|
||||
offset += sprintf(&string[offset], " %04X", (UINT32)debug_read_opcode(space, pcbyte + byte, 2, encrypted));
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (maxchars >= 8)
|
||||
offset = sprintf(string, "%08X", (UINT32)debug_read_opcode(pcbyte, 4, FALSE));
|
||||
offset = sprintf(string, "%08X", (UINT32)debug_read_opcode(space, pcbyte, 4, FALSE));
|
||||
for (byte = 4; byte < numbytes && offset + 9 < maxchars; byte += 4)
|
||||
offset += sprintf(&string[offset], " %08X", (UINT32)debug_read_opcode(pcbyte + byte, 4, encrypted));
|
||||
offset += sprintf(&string[offset], " %08X", (UINT32)debug_read_opcode(space, pcbyte + byte, 4, encrypted));
|
||||
break;
|
||||
|
||||
case 8:
|
||||
val = debug_read_opcode(pcbyte, 8, FALSE);
|
||||
val = debug_read_opcode(space, pcbyte, 8, FALSE);
|
||||
if (maxchars >= 16)
|
||||
offset = sprintf(string, "%08X%08X", (UINT32)(val >> 32), (UINT32)val);
|
||||
for (byte = 8; byte < numbytes && offset + 17 < maxchars; byte += 8)
|
||||
{
|
||||
val = debug_read_opcode(pcbyte + byte, 8, encrypted);
|
||||
val = debug_read_opcode(space, pcbyte + byte, 8, encrypted);
|
||||
offset += sprintf(&string[offset], " %08X%08X", (UINT32)(val >> 32), (UINT32)val);
|
||||
}
|
||||
break;
|
||||
@ -1483,13 +1485,13 @@ static int disasm_recompute(debug_view *view, offs_t pc, int startline, int line
|
||||
dasmdata->divider2 = dasmdata->divider1 + 1 + dasmdata->dasm_width + 1;
|
||||
|
||||
/* determine how many bytes we might need to display */
|
||||
minbytes = cpu_get_min_opcode_bytes(Machine->activecpu);
|
||||
maxbytes = cpu_get_max_opcode_bytes(Machine->activecpu);
|
||||
minbytes = cpu_get_min_opcode_bytes(cpuinfo->device);
|
||||
maxbytes = cpu_get_max_opcode_bytes(cpuinfo->device);
|
||||
|
||||
/* set the width of the third column according to display mode */
|
||||
if (dasmdata->right_column == DVP_DASM_RIGHTCOL_RAW || dasmdata->right_column == DVP_DASM_RIGHTCOL_ENCRYPTED)
|
||||
{
|
||||
chunksize = cpu_get_databus_width(Machine->activecpu, ADDRESS_SPACE_PROGRAM) / 8;
|
||||
chunksize = cpu_get_databus_width(cpuinfo->device, ADDRESS_SPACE_PROGRAM) / 8;
|
||||
maxbytes_clamped = maxbytes;
|
||||
if (maxbytes_clamped > DASM_MAX_BYTES)
|
||||
maxbytes_clamped = DASM_MAX_BYTES;
|
||||
@ -1548,12 +1550,12 @@ static int disasm_recompute(debug_view *view, offs_t pc, int startline, int line
|
||||
/* fetch the bytes up to the maximum */
|
||||
for (numbytes = 0; numbytes < maxbytes; numbytes++)
|
||||
{
|
||||
opbuf[numbytes] = debug_read_opcode(pcbyte + numbytes, 1, FALSE);
|
||||
argbuf[numbytes] = debug_read_opcode(pcbyte + numbytes, 1, TRUE);
|
||||
opbuf[numbytes] = debug_read_opcode(space, pcbyte + numbytes, 1, FALSE);
|
||||
argbuf[numbytes] = debug_read_opcode(space, pcbyte + numbytes, 1, TRUE);
|
||||
}
|
||||
|
||||
/* disassemble the result */
|
||||
pc += numbytes = cpu_dasm(Machine->activecpu, buffer, pc & addrmask, opbuf, argbuf) & DASMFLAG_LENGTHMASK;
|
||||
pc += numbytes = cpu_dasm(cpuinfo->device, buffer, pc & addrmask, opbuf, argbuf) & DASMFLAG_LENGTHMASK;
|
||||
}
|
||||
else
|
||||
sprintf(buffer, "<unmapped>");
|
||||
@ -1571,7 +1573,7 @@ static int disasm_recompute(debug_view *view, offs_t pc, int startline, int line
|
||||
offs_t comment_address = BYTE2ADDR(dasmdata->address[instr], cpuinfo, ADDRESS_SPACE_PROGRAM) ;
|
||||
|
||||
/* get and add the comment */
|
||||
if (debug_comment_get_text(Machine->activecpu, comment_address, debug_comment_get_opcode_crc32(Machine->activecpu, comment_address)) != 0x00)
|
||||
if (debug_comment_get_text(cpuinfo->device, comment_address, debug_comment_get_opcode_crc32(cpuinfo->device, comment_address)) != 0x00)
|
||||
{
|
||||
int i ;
|
||||
char bob[DEBUG_COMMENT_MAX_LINE_LENGTH] ;
|
||||
@ -1583,7 +1585,7 @@ static int disasm_recompute(debug_view *view, offs_t pc, int startline, int line
|
||||
destbuf[dasmdata->divider2+i] = pre[i] ;
|
||||
|
||||
// Stick in the comment itself
|
||||
strcpy(bob, debug_comment_get_text(Machine->activecpu, comment_address, debug_comment_get_opcode_crc32(Machine->activecpu, comment_address))) ;
|
||||
strcpy(bob, debug_comment_get_text(cpuinfo->device, comment_address, debug_comment_get_opcode_crc32(cpuinfo->device, comment_address))) ;
|
||||
for (i = 0; i < (dasmdata->allocated_cols - dasmdata->divider2 - strlen(pre) - 1); i++)
|
||||
destbuf[dasmdata->divider2+i+strlen(pre)] = bob[i] ;
|
||||
}
|
||||
@ -1598,7 +1600,7 @@ static int disasm_recompute(debug_view *view, offs_t pc, int startline, int line
|
||||
|
||||
/* reset the opcode base */
|
||||
if (dasmdata->cpunum == original_cpunum)
|
||||
change_pc(cpu_get_physical_pc_byte(Machine->activecpu));
|
||||
change_pc(cpu_get_physical_pc_byte(cpuinfo->device));
|
||||
|
||||
/* update opcode base information */
|
||||
dasmdata->last_direct_decrypted = space->direct.decrypted;
|
||||
|
@ -184,6 +184,7 @@ struct _internal_symbol_entry
|
||||
struct _symbol_table
|
||||
{
|
||||
symbol_table * parent; /* pointer to the parent symbol table */
|
||||
void * globalref; /* global reference parameter */
|
||||
internal_symbol_entry * hash[SYM_TABLE_HASH_SIZE]; /* hash table */
|
||||
};
|
||||
|
||||
@ -336,7 +337,7 @@ INLINE EXPRERR pop_token_rval(parsed_expression *expr, parse_token *token, const
|
||||
return MAKE_EXPRERR_NOT_RVAL(token->offset);
|
||||
token->type = TOK_NUMBER;
|
||||
if (symbol->type == SMT_REGISTER)
|
||||
token->value.i = (*symbol->info.reg.getter)(symbol->ref);
|
||||
token->value.i = (*symbol->info.reg.getter)(symbol->table->globalref, symbol->ref);
|
||||
else
|
||||
token->value.i = symbol->info.gen.value;
|
||||
}
|
||||
@ -372,7 +373,7 @@ INLINE UINT64 get_lval_value(parsed_expression *expr, parse_token *token, const
|
||||
{
|
||||
symbol_entry *symbol = token->value.p;
|
||||
if (symbol != NULL && symbol->type == SMT_REGISTER)
|
||||
return (*symbol->info.reg.getter)(symbol->ref);
|
||||
return (*symbol->info.reg.getter)(symbol->table->globalref, symbol->ref);
|
||||
}
|
||||
else if (token->type == TOK_MEMORY)
|
||||
{
|
||||
@ -397,7 +398,7 @@ INLINE void set_lval_value(parsed_expression *expr, parse_token *token, const sy
|
||||
{
|
||||
symbol_entry *symbol = token->value.p;
|
||||
if (symbol != NULL && symbol->type == SMT_REGISTER && symbol->info.reg.setter)
|
||||
(*symbol->info.reg.setter)(symbol->ref, value);
|
||||
(*symbol->info.reg.setter)(symbol->table->globalref, symbol->ref, value);
|
||||
}
|
||||
else if (token->type == TOK_MEMORY)
|
||||
{
|
||||
@ -1233,7 +1234,7 @@ static EXPRERR execute_function(parsed_expression *expr, parse_token *token)
|
||||
/* execute the function and push the result */
|
||||
t1.type = TOK_NUMBER;
|
||||
t1.offset = token->offset;
|
||||
t1.value.i = (*symbol->info.func.execute)(symbol->ref, paramcount, &funcparams[MAX_FUNCTION_PARAMS - paramcount]);
|
||||
t1.value.i = (*symbol->info.func.execute)(symbol->table->globalref, symbol->ref, paramcount, &funcparams[MAX_FUNCTION_PARAMS - paramcount]);
|
||||
push_token(expr, &t1);
|
||||
|
||||
return EXPRERR_NONE;
|
||||
@ -1910,7 +1911,7 @@ INLINE UINT32 hash_string(const char *string)
|
||||
symtable_alloc - allocate a symbol table
|
||||
-------------------------------------------------*/
|
||||
|
||||
symbol_table *symtable_alloc(symbol_table *parent)
|
||||
symbol_table *symtable_alloc(symbol_table *parent, void *globalref)
|
||||
{
|
||||
symbol_table *table;
|
||||
|
||||
@ -1922,10 +1923,22 @@ symbol_table *symtable_alloc(symbol_table *parent)
|
||||
/* initialize the data */
|
||||
memset(table, 0, sizeof(*table));
|
||||
table->parent = parent;
|
||||
table->globalref = globalref;
|
||||
return table;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
symtable_get_globalref - return the globalref
|
||||
value for a given symtable
|
||||
-------------------------------------------------*/
|
||||
|
||||
void *symtable_get_globalref(symbol_table *table)
|
||||
{
|
||||
return table->globalref;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
symtable_add - add a new symbol to a
|
||||
symbol table
|
||||
@ -1982,6 +1995,7 @@ int symtable_add(symbol_table *table, const char *name, const symbol_entry *entr
|
||||
/* fill in the details */
|
||||
symbol->name = newstring;
|
||||
symbol->entry = *entry;
|
||||
symbol->entry.table = table;
|
||||
|
||||
/* add the entry to the hash table */
|
||||
hash_index = hash_string(newstring) % SYM_TABLE_HASH_SIZE;
|
||||
@ -1996,11 +2010,11 @@ int symtable_add(symbol_table *table, const char *name, const symbol_entry *entr
|
||||
register symbol to a symbol table
|
||||
-------------------------------------------------*/
|
||||
|
||||
int symtable_add_register(symbol_table *table, const char *name, void *ref, symbol_getter_func getter, symbol_setter_func setter)
|
||||
int symtable_add_register(symbol_table *table, const char *name, void *symref, symbol_getter_func getter, symbol_setter_func setter)
|
||||
{
|
||||
symbol_entry symbol;
|
||||
|
||||
symbol.ref = ref;
|
||||
symbol.ref = symref;
|
||||
symbol.type = SMT_REGISTER;
|
||||
symbol.info.reg.getter = getter;
|
||||
symbol.info.reg.setter = setter;
|
||||
@ -2013,11 +2027,11 @@ int symtable_add_register(symbol_table *table, const char *name, void *ref, symb
|
||||
function symbol to a symbol table
|
||||
-------------------------------------------------*/
|
||||
|
||||
int symtable_add_function(symbol_table *table, const char *name, void *ref, UINT16 minparams, UINT16 maxparams, function_execute_func execute)
|
||||
int symtable_add_function(symbol_table *table, const char *name, void *symref, UINT16 minparams, UINT16 maxparams, function_execute_func execute)
|
||||
{
|
||||
symbol_entry symbol;
|
||||
|
||||
symbol.ref = ref;
|
||||
symbol.ref = symref;
|
||||
symbol.type = SMT_FUNCTION;
|
||||
symbol.info.func.minparams = minparams;
|
||||
symbol.info.func.maxparams = maxparams;
|
||||
|
@ -97,11 +97,11 @@ typedef UINT32 EXPRERR;
|
||||
|
||||
|
||||
/* callback functions for getting/setting a symbol value */
|
||||
typedef UINT64 (*symbol_getter_func)(void *ref);
|
||||
typedef void (*symbol_setter_func)(void *ref, UINT64 value);
|
||||
typedef UINT64 (*symbol_getter_func)(void *globalref, void *symref);
|
||||
typedef void (*symbol_setter_func)(void *globalref, void *symref, UINT64 value);
|
||||
|
||||
/* callback function for execution a function */
|
||||
typedef UINT64 (*function_execute_func)(void *ref, UINT32 numparams, const UINT64 *paramlist);
|
||||
typedef UINT64 (*function_execute_func)(void *globalref, void *symref, UINT32 numparams, const UINT64 *paramlist);
|
||||
|
||||
/* callback function for memory reads/writes */
|
||||
typedef UINT64 (*express_read_func)(void *cbparam, const char *name, int space, UINT32 offset, int size);
|
||||
@ -119,11 +119,16 @@ struct _express_callbacks
|
||||
};
|
||||
|
||||
|
||||
/* symbol_table is an opaque structure for holding a collection of symbols */
|
||||
typedef struct _symbol_table symbol_table;
|
||||
|
||||
|
||||
/* symbol_entry describes a symbol in a symbol table */
|
||||
typedef struct _symbol_entry symbol_entry;
|
||||
struct _symbol_entry
|
||||
{
|
||||
void * ref; /* internal reference */
|
||||
symbol_table * table; /* pointer back to the owning table */
|
||||
UINT32 type; /* type of symbol */
|
||||
union
|
||||
{
|
||||
@ -152,10 +157,6 @@ struct _symbol_entry
|
||||
};
|
||||
|
||||
|
||||
/* symbol_table is an opaque structure for holding a collection of symbols */
|
||||
typedef struct _symbol_table symbol_table;
|
||||
|
||||
|
||||
/* parsed_expression is an opaque structure for holding a pre-parsed expression */
|
||||
typedef struct _parsed_expression parsed_expression;
|
||||
|
||||
@ -174,10 +175,11 @@ const char * expression_original_string(parsed_expression *expr);
|
||||
const char * exprerr_to_string(EXPRERR error);
|
||||
|
||||
/* symbol table manipulation */
|
||||
symbol_table * symtable_alloc(symbol_table *parent);
|
||||
symbol_table * symtable_alloc(symbol_table *parent, void *globalref);
|
||||
void * symtable_get_globalref(symbol_table *table);
|
||||
int symtable_add(symbol_table *table, const char *name, const symbol_entry *entry);
|
||||
int symtable_add_register(symbol_table *table, const char *name, void *ref, symbol_getter_func getter, symbol_setter_func setter);
|
||||
int symtable_add_function(symbol_table *table, const char *name, void *ref, UINT16 minparams, UINT16 maxparams, function_execute_func execute);
|
||||
int symtable_add_register(symbol_table *table, const char *name, void *symref, symbol_getter_func getter, symbol_setter_func setter);
|
||||
int symtable_add_function(symbol_table *table, const char *name, void *symref, UINT16 minparams, UINT16 maxparams, function_execute_func execute);
|
||||
int symtable_add_value(symbol_table *table, const char *name, UINT64 value);
|
||||
const symbol_entry * symtable_find(const symbol_table *table, const char *name);
|
||||
const char * symtable_find_indexed(const symbol_table *table, int index, const symbol_entry **entry);
|
||||
|
@ -21,6 +21,14 @@
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
static void debugger_flush_traces(void);
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
CENTRAL INITIALIZATION POINT
|
||||
***************************************************************************/
|
||||
@ -39,7 +47,7 @@ void debugger_init(running_machine *machine)
|
||||
debug_console_init(machine);
|
||||
debug_view_init(machine);
|
||||
debug_comment_init(machine);
|
||||
atexit(debug_cpu_flush_traces);
|
||||
atexit(debugger_flush_traces);
|
||||
add_logerror_callback(machine, debug_errorlog_write_line);
|
||||
}
|
||||
}
|
||||
@ -56,3 +64,14 @@ void debugger_refresh_display(running_machine *machine)
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
debugger_flush_traces - flush any traces in
|
||||
the event of an aborted execution
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void debugger_flush_traces(void)
|
||||
{
|
||||
extern running_machine *Machine;
|
||||
if (Machine != NULL)
|
||||
debug_cpu_flush_traces(Machine);
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ INLINE void debugger_interrupt_hook(const device_config *device, int irqline)
|
||||
INLINE void debugger_break(running_machine *machine)
|
||||
{
|
||||
if ((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0)
|
||||
debug_cpu_halt_on_next_instruction(machine, cpunum_get_active(), "Internal breakpoint\n");
|
||||
debug_cpu_halt_on_next_instruction(debug_cpu_get_visible_cpu(machine), "Internal breakpoint\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -949,7 +949,7 @@ static void execute_fdignore(running_machine *machine, int ref, int params, cons
|
||||
|
||||
/* if no parameter given, implicitly run as well */
|
||||
if (params == 0)
|
||||
debug_cpu_go(~0);
|
||||
debug_cpu_go(machine, ~0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -494,7 +494,7 @@ void debugwin_update_during_game(running_machine *machine)
|
||||
HWND focuswnd = GetFocus();
|
||||
debugwin_info *info;
|
||||
|
||||
debug_cpu_halt_on_next_instruction(machine, -1, "User-initiated break\n");
|
||||
debug_cpu_halt_on_next_instruction(debug_cpu_get_visible_cpu(machine), "User-initiated break\n");
|
||||
|
||||
// if we were focused on some window's edit box, reset it to default
|
||||
for (info = window_list; info; info = info->next)
|
||||
@ -778,7 +778,7 @@ static LRESULT CALLBACK debug_window_proc(HWND wnd, UINT message, WPARAM wparam,
|
||||
if (main_console && main_console->wnd == wnd)
|
||||
{
|
||||
smart_show_all(FALSE);
|
||||
debug_cpu_go(~0);
|
||||
debug_cpu_go(info->machine, ~0);
|
||||
}
|
||||
else
|
||||
DestroyWindow(wnd);
|
||||
@ -2767,7 +2767,7 @@ static void console_process_string(debugwin_info *info, const char *string)
|
||||
|
||||
// an empty string is a single step
|
||||
if (string[0] == 0)
|
||||
debug_cpu_single_step(1);
|
||||
debug_cpu_single_step(info->machine, 1);
|
||||
|
||||
// otherwise, just process the command
|
||||
else
|
||||
@ -2870,31 +2870,31 @@ static int global_handle_command(debugwin_info *info, WPARAM wparam, LPARAM lpar
|
||||
case ID_RUN_AND_HIDE:
|
||||
smart_show_all(FALSE);
|
||||
case ID_RUN:
|
||||
debug_cpu_go(~0);
|
||||
debug_cpu_go(info->machine, ~0);
|
||||
return 1;
|
||||
|
||||
case ID_NEXT_CPU:
|
||||
debug_cpu_next_cpu();
|
||||
debug_cpu_next_cpu(info->machine);
|
||||
return 1;
|
||||
|
||||
case ID_RUN_VBLANK:
|
||||
debug_cpu_go_vblank();
|
||||
debug_cpu_go_vblank(info->machine);
|
||||
return 1;
|
||||
|
||||
case ID_RUN_IRQ:
|
||||
debug_cpu_go_interrupt(-1);
|
||||
debug_cpu_go_interrupt(info->machine, -1);
|
||||
return 1;
|
||||
|
||||
case ID_STEP:
|
||||
debug_cpu_single_step(1);
|
||||
debug_cpu_single_step(info->machine, 1);
|
||||
return 1;
|
||||
|
||||
case ID_STEP_OVER:
|
||||
debug_cpu_single_step_over(1);
|
||||
debug_cpu_single_step_over(info->machine, 1);
|
||||
return 1;
|
||||
|
||||
case ID_STEP_OUT:
|
||||
debug_cpu_single_step_out();
|
||||
debug_cpu_single_step_out(info->machine);
|
||||
return 1;
|
||||
|
||||
case ID_HARD_RESET:
|
||||
@ -2903,7 +2903,7 @@ static int global_handle_command(debugwin_info *info, WPARAM wparam, LPARAM lpar
|
||||
|
||||
case ID_SOFT_RESET:
|
||||
mame_schedule_soft_reset(info->machine);
|
||||
debug_cpu_go(~0);
|
||||
debug_cpu_go(info->machine, ~0);
|
||||
return 1;
|
||||
|
||||
case ID_EXIT:
|
||||
|
@ -455,7 +455,11 @@ static LONG CALLBACK exception_filter(struct _EXCEPTION_POINTERS *info)
|
||||
already_hit = 1;
|
||||
|
||||
// flush any debugging traces that were live
|
||||
debug_cpu_flush_traces();
|
||||
{
|
||||
extern running_machine *Machine;
|
||||
if (Machine != NULL)
|
||||
debug_cpu_flush_traces(Machine);
|
||||
}
|
||||
|
||||
// find our man
|
||||
for (i = 0; exception_table[i].code != 0; i++)
|
||||
|
Loading…
Reference in New Issue
Block a user