diff options
| author | 2010-01-10 00:29:26 +0000 | |
|---|---|---|
| committer | 2010-01-10 00:29:26 +0000 | |
| commit | 4498faacd93cbb7f204d1b47e5d12bd417cf43b3 (patch) | |
| tree | eebf7c70b83ce57ba2707407872a01fe3ef7bb3c /src/emu/debug | |
| parent | 43d93150b5bc214537d5198cd9e7f01f2020eff8 (diff) | |
First round of an attempted cleanup of header files in the system.
- Created new central header "emu.h"; this should be included
by pretty much any driver or device as the first include. This
file in turn includes pretty much everything a driver or device
will need, minus any other devices it references. Note that
emu.h should *never* be included by another header file.
- Updated all files in the core (src/emu) to use emu.h.
- Removed a ton of redundant and poorly-tracked header includes
from within other header files.
- Temporarily changed driver.h to map to emu.h until we update
files outside of the core.
Added class wrapper around tagmap so it can be directly included
and accessed within objects that need it. Updated all users to
embed tagmap objects and changed them to call through the class.
Added nicer functions for finding devices, ports, and regions in
a machine:
machine->device("tag") -- return the named device, or NULL
machine->port("tag") -- return the named port, or NULL
machine->region("tag"[, &length[, &flags]]) -- return the
named region and optionally its length and flags
Made the device tag an astring. This required touching a lot of
code that printed the device to explicitly fetch the C-string
from it. (Thank you gcc for flagging that issue!)
Diffstat (limited to 'src/emu/debug')
| -rw-r--r-- | src/emu/debug/debugcmd.c | 35 | ||||
| -rw-r--r-- | src/emu/debug/debugcmt.c | 3 | ||||
| -rw-r--r-- | src/emu/debug/debugcon.c | 16 | ||||
| -rw-r--r-- | src/emu/debug/debugcon.h | 1 | ||||
| -rw-r--r-- | src/emu/debug/debugcpu.c | 6 | ||||
| -rw-r--r-- | src/emu/debug/debugcpu.h | 1 | ||||
| -rw-r--r-- | src/emu/debug/debugvw.c | 8 | ||||
| -rw-r--r-- | src/emu/debug/express.h | 1 |
8 files changed, 38 insertions, 33 deletions
diff --git a/src/emu/debug/debugcmd.c b/src/emu/debug/debugcmd.c index 6db207d7fb7..073aded7a87 100644 --- a/src/emu/debug/debugcmd.c +++ b/src/emu/debug/debugcmd.c @@ -9,7 +9,8 @@ *********************************************************************/ -#include "driver.h" +#include "emu.h" +#include "emuopts.h" #include "debugcmd.h" #include "debugcmt.h" #include "debugcon.h" @@ -570,7 +571,7 @@ int debug_command_parameter_cpu_space(running_machine *machine, const char *para *result = cpu_get_address_space(cpu, spacenum); if (*result == NULL) { - debug_console_printf(machine, "No %s memory space found for CPU '%s'\n", address_space_names[spacenum], cpu->tag); + debug_console_printf(machine, "No %s memory space found for CPU '%s'\n", address_space_names[spacenum], cpu->tag.cstr()); return FALSE; } return TRUE; @@ -986,7 +987,7 @@ static void execute_focus(running_machine *machine, int ref, int params, const c for (scancpu = machine->firstcpu; scancpu != NULL; scancpu = cpu_next(scancpu)) if (scancpu != cpu) debug_cpu_ignore_cpu(scancpu, 1); - debug_console_printf(machine, "Now focused on CPU '%s'\n", cpu->tag); + debug_console_printf(machine, "Now focused on CPU '%s'\n", cpu->tag.cstr()); } @@ -1014,9 +1015,9 @@ static void execute_ignore(running_machine *machine, int ref, int params, const if ((cpuinfo->flags & DEBUG_FLAG_OBSERVING) == 0) { if (buflen == 0) - buflen += sprintf(&buffer[buflen], "Currently ignoring CPU '%s'", cpu->tag); + buflen += sprintf(&buffer[buflen], "Currently ignoring CPU '%s'", cpu->tag.cstr()); else - buflen += sprintf(&buffer[buflen], ", '%s'", cpu->tag); + buflen += sprintf(&buffer[buflen], ", '%s'", cpu->tag.cstr()); } } @@ -1048,7 +1049,7 @@ static void execute_ignore(running_machine *machine, int ref, int params, const } debug_cpu_ignore_cpu(cpuwhich[paramnum], 1); - debug_console_printf(machine, "Now ignoring CPU '%s'\n", cpuwhich[paramnum]->tag); + debug_console_printf(machine, "Now ignoring CPU '%s'\n", cpuwhich[paramnum]->tag.cstr()); } } } @@ -1078,9 +1079,9 @@ static void execute_observe(running_machine *machine, int ref, int params, const if ((cpuinfo->flags & DEBUG_FLAG_OBSERVING) != 0) { if (buflen == 0) - buflen += sprintf(&buffer[buflen], "Currently observing CPU '%s'", cpu->tag); + buflen += sprintf(&buffer[buflen], "Currently observing CPU '%s'", cpu->tag.cstr()); else - buflen += sprintf(&buffer[buflen], ", '%s'", cpu->tag); + buflen += sprintf(&buffer[buflen], ", '%s'", cpu->tag.cstr()); } } @@ -1102,7 +1103,7 @@ static void execute_observe(running_machine *machine, int ref, int params, const for (paramnum = 0; paramnum < params; paramnum++) { debug_cpu_ignore_cpu(cpuwhich[paramnum], 0); - debug_console_printf(machine, "Now observing CPU '%s'\n", cpuwhich[paramnum]->tag); + debug_console_printf(machine, "Now observing CPU '%s'\n", cpuwhich[paramnum]->tag.cstr()); } } } @@ -1308,7 +1309,7 @@ static void execute_bplist(running_machine *machine, int ref, int params, const { debug_cpu_breakpoint *bp; - debug_console_printf(machine, "CPU '%s' breakpoints:\n", cpu->tag); + debug_console_printf(machine, "CPU '%s' breakpoints:\n", cpu->tag.cstr()); /* loop over the breakpoints */ for (bp = cpuinfo->bplist; bp != NULL; bp = bp->next) @@ -1496,7 +1497,7 @@ static void execute_wplist(running_machine *machine, int ref, int params, const const address_space *space = cpu_get_address_space(cpu, spacenum); debug_cpu_watchpoint *wp; - debug_console_printf(machine, "CPU '%s' %s space watchpoints:\n", cpu->tag, address_space_names[spacenum]); + debug_console_printf(machine, "CPU '%s' %s space watchpoints:\n", cpu->tag.cstr(), address_space_names[spacenum]); /* loop over the watchpoints */ for (wp = cpuinfo->wplist[spacenum]; wp != NULL; wp = wp->next) @@ -1545,7 +1546,7 @@ static void execute_hotspot(running_machine *machine, int ref, int params, const if (cpuinfo->hotspots != NULL) { debug_cpu_hotspot_track(cpuinfo->device, 0, 0); - debug_console_printf(machine, "Cleared hotspot tracking on CPU '%s'\n", cpu->tag); + debug_console_printf(machine, "Cleared hotspot tracking on CPU '%s'\n", cpu->tag.cstr()); cleared = TRUE; } } @@ -1567,7 +1568,7 @@ static void execute_hotspot(running_machine *machine, int ref, int params, const /* attempt to install */ if (debug_cpu_hotspot_track(cpu, count, threshhold)) - debug_console_printf(machine, "Now tracking hotspots on CPU '%s' using %d slots with a threshhold of %d\n", cpu->tag, (int)count, (int)threshhold); + debug_console_printf(machine, "Now tracking hotspots on CPU '%s' using %d slots with a threshhold of %d\n", cpu->tag.cstr(), (int)count, (int)threshhold); else debug_console_printf(machine, "Error setting up the hotspot tracking\n"); } @@ -2099,7 +2100,7 @@ static void execute_cheatlist(running_machine *machine, int ref, int params, con active_cheat++; fprintf(f, " <cheat desc=\"Possibility %d : %s (%s)\">\n", active_cheat, core_i64_hex_format(address, space->logaddrchars), core_i64_hex_format(value, cheat.width * 2)); fprintf(f, " <script state=\"run\">\n"); - fprintf(f, " <action>%s.p%c%c@%s=%s</action>\n", cpu->tag, spaceletter, sizeletter, core_i64_hex_format(address, space->logaddrchars), core_i64_hex_format(cheat_byte_swap(&cheat, cheat.cheatmap[cheatindex].first_value) & sizemask, cheat.width * 2)); + fprintf(f, " <action>%s.p%c%c@%s=%s</action>\n", cpu->tag.cstr(), spaceletter, sizeletter, core_i64_hex_format(address, space->logaddrchars), core_i64_hex_format(cheat_byte_swap(&cheat, cheat.cheatmap[cheatindex].first_value) & sizemask, cheat.width * 2)); fprintf(f, " </script>\n"); fprintf(f, " </cheat>\n\n"); } @@ -2398,9 +2399,9 @@ static void execute_trace_internal(running_machine *machine, int ref, int params /* do it */ debug_cpu_trace(cpu, f, trace_over, action); if (f) - debug_console_printf(machine, "Tracing CPU '%s' to file %s\n", cpu->tag, filename); + debug_console_printf(machine, "Tracing CPU '%s' to file %s\n", cpu->tag.cstr(), filename); else - debug_console_printf(machine, "Stopped tracing on CPU '%s'\n", cpu->tag); + debug_console_printf(machine, "Stopped tracing on CPU '%s'\n", cpu->tag.cstr()); } @@ -2621,7 +2622,7 @@ static void execute_symlist(running_machine *machine, int ref, int params, const if (cpu != NULL) { symtable = debug_cpu_get_symtable(cpu); - debug_console_printf(machine, "CPU '%s' symbols:\n", cpu->tag); + debug_console_printf(machine, "CPU '%s' symbols:\n", cpu->tag.cstr()); } else { diff --git a/src/emu/debug/debugcmt.c b/src/emu/debug/debugcmt.c index b5bffd50462..62486cb0294 100644 --- a/src/emu/debug/debugcmt.c +++ b/src/emu/debug/debugcmt.c @@ -20,7 +20,8 @@ ***************************************************************************/ -#include "driver.h" +#include "emu.h" +#include "emuopts.h" #include "xmlfile.h" #include "debugcmt.h" #include "debugcpu.h" diff --git a/src/emu/debug/debugcon.c b/src/emu/debug/debugcon.c index 262dc9a3da2..00d95708d8e 100644 --- a/src/emu/debug/debugcon.c +++ b/src/emu/debug/debugcon.c @@ -471,13 +471,14 @@ const char *debug_cmderr_to_string(CMDERR error) void CLIB_DECL debug_console_printf(running_machine *machine, const char *format, ...) { + astring buffer; va_list arg; va_start(arg, format); - vsprintf(giant_string_buffer, format, arg); + buffer.vprintf(format, arg); va_end(arg); - text_buffer_print(console_textbuf, giant_string_buffer); + text_buffer_print(console_textbuf, buffer); /* force an update of any console views */ debug_view_update_type(machine, DVT_CONSOLE); @@ -492,8 +493,10 @@ void CLIB_DECL debug_console_printf(running_machine *machine, const char *format void CLIB_DECL debug_console_vprintf(running_machine *machine, const char *format, va_list args) { - vsprintf(giant_string_buffer, format, args); - text_buffer_print(console_textbuf, giant_string_buffer); + astring buffer; + + buffer.vprintf(format, args); + text_buffer_print(console_textbuf, buffer); /* force an update of any console views */ debug_view_update_type(machine, DVT_CONSOLE); @@ -508,13 +511,14 @@ void CLIB_DECL debug_console_vprintf(running_machine *machine, const char *forma void CLIB_DECL debug_console_printf_wrap(running_machine *machine, int wrapcol, const char *format, ...) { + astring buffer; va_list arg; va_start(arg, format); - vsprintf(giant_string_buffer, format, arg); + buffer.vprintf(format, arg); va_end(arg); - text_buffer_print_wrap(console_textbuf, giant_string_buffer, wrapcol); + text_buffer_print_wrap(console_textbuf, buffer, wrapcol); /* force an update of any console views */ debug_view_update_type(machine, DVT_CONSOLE); diff --git a/src/emu/debug/debugcon.h b/src/emu/debug/debugcon.h index 9d271fd3b48..4197e108b70 100644 --- a/src/emu/debug/debugcon.h +++ b/src/emu/debug/debugcon.h @@ -13,7 +13,6 @@ #define __DEBUGCON_H__ #include "textbuf.h" -#include <stdarg.h> /*************************************************************************** diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c index 4038edd8883..519b00401f7 100644 --- a/src/emu/debug/debugcpu.c +++ b/src/emu/debug/debugcpu.c @@ -553,7 +553,7 @@ void debug_cpu_interrupt_hook(const device_config *device, int irqline) if (info != NULL && (info->flags & DEBUG_FLAG_STOP_INTERRUPT) != 0 && (info->stopirq == -1 || info->stopirq == irqline)) { global->execution_state = EXECUTION_STATE_STOPPED; - debug_console_printf(device->machine, "Stopped on interrupt (CPU '%s', IRQ %d)\n", device->tag, irqline); + debug_console_printf(device->machine, "Stopped on interrupt (CPU '%s', IRQ %d)\n", device->tag.cstr(), irqline); compute_debug_flags(device); } } @@ -573,7 +573,7 @@ void debug_cpu_exception_hook(const device_config *device, int exception) if ((info->flags & DEBUG_FLAG_STOP_EXCEPTION) != 0 && (info->stopexception == -1 || info->stopexception == exception)) { global->execution_state = EXECUTION_STATE_STOPPED; - debug_console_printf(device->machine, "Stopped on exception (CPU '%s', exception %d)\n", device->tag, exception); + debug_console_printf(device->machine, "Stopped on exception (CPU '%s', exception %d)\n", device->tag.cstr(), exception); compute_debug_flags(device); } } @@ -640,7 +640,7 @@ void debug_cpu_instruction_hook(const device_config *device, offs_t curpc) /* check the temp running breakpoint and break if we hit it */ else if ((info->flags & DEBUG_FLAG_STOP_PC) != 0 && info->stopaddr == curpc) { - debug_console_printf(device->machine, "Stopped at temporary breakpoint %X on CPU '%s'\n", info->stopaddr, device->tag); + debug_console_printf(device->machine, "Stopped at temporary breakpoint %X on CPU '%s'\n", info->stopaddr, device->tag.cstr()); global->execution_state = EXECUTION_STATE_STOPPED; } diff --git a/src/emu/debug/debugcpu.h b/src/emu/debug/debugcpu.h index a29ba715137..772f7bea19a 100644 --- a/src/emu/debug/debugcpu.h +++ b/src/emu/debug/debugcpu.h @@ -14,7 +14,6 @@ #ifndef __DEBUGCPU_H__ #define __DEBUGCPU_H__ -#include "cpuintrf.h" #include "express.h" diff --git a/src/emu/debug/debugvw.c b/src/emu/debug/debugvw.c index 7b15f78b8e0..2dd822c00ef 100644 --- a/src/emu/debug/debugvw.c +++ b/src/emu/debug/debugvw.c @@ -1036,7 +1036,7 @@ static const registers_subview_item *registers_view_enumerate_subviews(running_m registers_subview_item *subview; /* determine the string and allocate a subview large enough */ - tempstring.printf("CPU '%s' (%s)", cpu->tag, cpu_get_name(cpu)); + tempstring.printf("CPU '%s' (%s)", cpu->tag.cstr(), cpu_get_name(cpu)); subview = (registers_subview_item *)auto_alloc_array_clear(machine, UINT8, sizeof(*subview) + tempstring.len()); /* populate the subview */ @@ -1500,7 +1500,7 @@ static const disasm_subview_item *disasm_view_enumerate_subviews(running_machine disasm_subview_item *subview; /* determine the string and allocate a subview large enough */ - tempstring.printf("CPU '%s' (%s)", cpu->tag, cpu_get_name(cpu)); + tempstring.printf("CPU '%s' (%s)", cpu->tag.cstr(), cpu_get_name(cpu)); subview = (disasm_subview_item *)auto_alloc_array_clear(machine, UINT8, sizeof(*subview) + tempstring.len()); /* populate the subview */ @@ -2382,9 +2382,9 @@ static const memory_subview_item *memory_view_enumerate_subviews(running_machine /* determine the string and allocate a subview large enough */ if (device->type == CPU) - tempstring.printf("CPU '%s' (%s) %s memory", device->tag, device_get_name(device), space->name); + tempstring.printf("CPU '%s' (%s) %s memory", device->tag.cstr(), device_get_name(device), space->name); else - tempstring.printf("%s '%s' space #%d memory", device_get_name(device), device->tag, spacenum); + tempstring.printf("%s '%s' space #%d memory", device_get_name(device), device->tag.cstr(), spacenum); subview = (memory_subview_item *)auto_alloc_array_clear(machine, UINT8, sizeof(*subview) + tempstring.len()); /* populate the subview */ diff --git a/src/emu/debug/express.h b/src/emu/debug/express.h index 3cd9c1db930..ba758b97181 100644 --- a/src/emu/debug/express.h +++ b/src/emu/debug/express.h @@ -12,6 +12,7 @@ #include "osdcore.h" + /*************************************************************************** CONSTANTS ***************************************************************************/ |
