summaryrefslogtreecommitdiffstats
path: root/src/emu/debug/debugcmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/debug/debugcmd.cpp')
-rw-r--r--src/emu/debug/debugcmd.cpp1466
1 files changed, 647 insertions, 819 deletions
diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp
index 0ee23f94638..ad1359baa28 100644
--- a/src/emu/debug/debugcmd.cpp
+++ b/src/emu/debug/debugcmd.cpp
@@ -26,144 +26,10 @@
CONSTANTS
***************************************************************************/
-#define MAX_GLOBALS 1000
-
-
-
-/***************************************************************************
- TYPE DEFINITIONS
-***************************************************************************/
-
-struct global_entry
-{
- void * base;
- UINT32 size;
-};
-
-
-struct cheat_map
-{
- UINT64 offset;
- UINT64 first_value;
- UINT64 previous_value;
- UINT8 state:1;
- UINT8 undo:7;
-};
-
-
-struct cheat_system
-{
- char cpu[2];
- UINT8 width;
- std::vector<cheat_map> cheatmap;
- UINT8 undo;
- UINT8 signed_cheat;
- UINT8 swapped_cheat;
-};
-
-
-struct cheat_region_map
-{
- UINT64 offset;
- UINT64 endoffset;
- const char *share;
- UINT8 disabled;
-};
-
-
-
-/***************************************************************************
- GLOBAL VARIABLES
-***************************************************************************/
-
-static global_entry global_array[MAX_GLOBALS];
-static cheat_system cheat;
-
-
-
-/***************************************************************************
- FUNCTION PROTOTYPES
-***************************************************************************/
-
-static void debug_command_exit(running_machine &machine);
-
-static UINT64 execute_min(symbol_table &table, void *ref, int params, const UINT64 *param);
-static UINT64 execute_max(symbol_table &table, void *ref, int params, const UINT64 *param);
-static UINT64 execute_if(symbol_table &table, void *ref, int params, const UINT64 *param);
-
-static UINT64 global_get(symbol_table &table, void *ref);
-static void global_set(symbol_table &table, 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);
-static void execute_printf(running_machine &machine, int ref, int params, const char **param);
-static void execute_logerror(running_machine &machine, int ref, int params, const char **param);
-static void execute_tracelog(running_machine &machine, int ref, int params, const char **param);
-static void execute_quit(running_machine &machine, int ref, int params, const char **param);
-static void execute_do(running_machine &machine, int ref, int params, const char **param);
-static void execute_step(running_machine &machine, int ref, int params, const char **param);
-static void execute_over(running_machine &machine, int ref, int params, const char **param);
-static void execute_out(running_machine &machine, int ref, int params, const char **param);
-static void execute_go(running_machine &machine, int ref, int params, const char **param);
-static void execute_go_vblank(running_machine &machine, int ref, int params, const char **param);
-static void execute_go_interrupt(running_machine &machine, int ref, int params, const char **param);
-static void execute_go_time(running_machine &machine, int ref, int params, const char *param[]);
-static void execute_focus(running_machine &machine, int ref, int params, const char **param);
-static void execute_ignore(running_machine &machine, int ref, int params, const char **param);
-static void execute_observe(running_machine &machine, int ref, int params, const char **param);
-static void execute_next(running_machine &machine, int ref, int params, const char **param);
-static void execute_comment_add(running_machine &machine, int ref, int params, const char **param);
-static void execute_comment_del(running_machine &machine, int ref, int params, const char **param);
-static void execute_comment_save(running_machine &machine, int ref, int params, const char **param);
-static void execute_comment_list(running_machine &machine, int ref, int params, const char **param);
-static void execute_comment_commit(running_machine &machine, int ref, int params, const char **param);
-static void execute_bpset(running_machine &machine, int ref, int params, const char **param);
-static void execute_bpclear(running_machine &machine, int ref, int params, const char **param);
-static void execute_bpdisenable(running_machine &machine, int ref, int params, const char **param);
-static void execute_bplist(running_machine &machine, int ref, int params, const char **param);
-static void execute_wpset(running_machine &machine, int ref, int params, const char **param);
-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_statesave(running_machine &machine, int ref, int params, const char **param);
-static void execute_stateload(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);
-static void execute_dump(running_machine &machine, int ref, int params, const char **param);
-static void execute_cheatinit(running_machine &machine, int ref, int params, const char **param);
-static void execute_cheatnext(running_machine &machine, int ref, int params, const char **param);
-static void execute_cheatlist(running_machine &machine, int ref, int params, const char **param);
-static void execute_cheatundo(running_machine &machine, int ref, int params, const char **param);
-static void execute_dasm(running_machine &machine, int ref, int params, const char **param);
-static void execute_find(running_machine &machine, int ref, int params, const char **param);
-static void execute_trace(running_machine &machine, int ref, int params, const char **param);
-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_trackmem(running_machine &machine, int ref, int params, const char **param);
-static void execute_pcatmem(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);
-static void execute_memdump(running_machine &machine, int ref, int params, const char **param);
-static void execute_symlist(running_machine &machine, int ref, int params, const char **param);
-static void execute_softreset(running_machine &machine, int ref, int params, const char **param);
-static void execute_hardreset(running_machine &machine, int ref, int params, const char **param);
-static void execute_images(running_machine &machine, int ref, int params, const char **param);
-static void execute_mount(running_machine &machine, int ref, int params, const char **param);
-static void execute_unmount(running_machine &machine, int ref, int params, const char **param);
-static void execute_input(running_machine &machine, int ref, int params, const char **param);
-static void execute_dumpkbd(running_machine &machine, int ref, int params, const char **param);
-
+const size_t debugger_commands::MAX_GLOBALS = 1000;
/***************************************************************************
- INLINE FUNCTIONS
+ FUNCTIONS
***************************************************************************/
/*-------------------------------------------------
@@ -171,9 +37,9 @@ static void execute_dumpkbd(running_machine &machine, int ref, int params, const
given address is valid for cheating
-------------------------------------------------*/
-static inline int cheat_address_is_valid(address_space &space, offs_t address)
+bool debugger_commands::cheat_address_is_valid(address_space &space, offs_t address)
{
- return debug_cpu_translate(space, TRANSLATE_READ, &address) && (space.get_write_ptr(address) != nullptr);
+ return m_cpu.translate(space, TRANSLATE_READ, &address) && (space.get_write_ptr(address) != nullptr);
}
@@ -182,7 +48,7 @@ static inline int cheat_address_is_valid(address_space &space, offs_t address)
the current cheat width, if signed
-------------------------------------------------*/
-static inline UINT64 cheat_sign_extend(const cheat_system *cheatsys, UINT64 value)
+UINT64 debugger_commands::cheat_sign_extend(const cheat_system *cheatsys, UINT64 value)
{
if (cheatsys->signed_cheat)
{
@@ -195,11 +61,12 @@ static inline UINT64 cheat_sign_extend(const cheat_system *cheatsys, UINT64 valu
}
return value;
}
+
/*-------------------------------------------------
cheat_byte_swap - swap a value
-------------------------------------------------*/
-static inline UINT64 cheat_byte_swap(const cheat_system *cheatsys, UINT64 value)
+UINT64 debugger_commands::cheat_byte_swap(const cheat_system *cheatsys, UINT64 value)
{
if (cheatsys->swapped_cheat)
{
@@ -220,41 +87,34 @@ static inline UINT64 cheat_byte_swap(const cheat_system *cheatsys, UINT64 value)
and swapping if necessary
-------------------------------------------------*/
-static inline UINT64 cheat_read_extended(const cheat_system *cheatsys, address_space &space, offs_t address)
+UINT64 debugger_commands::cheat_read_extended(const cheat_system *cheatsys, address_space &space, offs_t address)
{
- return cheat_sign_extend(cheatsys, cheat_byte_swap(cheatsys, debug_read_memory(space, address, cheatsys->width, TRUE)));
+ return cheat_sign_extend(cheatsys, cheat_byte_swap(cheatsys, m_cpu.read_memory(space, address, cheatsys->width, TRUE)));
}
-
-
-/***************************************************************************
- INITIALIZATION
-***************************************************************************/
-
-/*-------------------------------------------------
- debug_command_init - initializes the command
- system
--------------------------------------------------*/
-
-void debug_command_init(running_machine &machine)
+debugger_commands::debugger_commands(running_machine& machine, debugger_cpu& cpu, debugger_console& console)
+ : m_machine(machine)
+ , m_cpu(cpu)
+ , m_console(console)
{
- symbol_table *symtable = debug_cpu_get_global_symtable(machine);
- const char *name;
- int itemnum;
+ m_global_array = auto_alloc_array_clear(m_machine, global_entry, MAX_GLOBALS);
+
+ symbol_table *symtable = m_cpu.get_global_symtable();
/* add a few simple global functions */
- symtable->add("min", nullptr, 2, 2, execute_min);
- symtable->add("max", nullptr, 2, 2, execute_max);
- symtable->add("if", nullptr, 3, 3, execute_if);
+ using namespace std::placeholders;
+ symtable->add("min", nullptr, 2, 2, std::bind(&debugger_commands::execute_min, this, _1, _2, _3, _4));
+ symtable->add("max", nullptr, 2, 2, std::bind(&debugger_commands::execute_max, this, _1, _2, _3, _4));
+ symtable->add("if", nullptr, 3, 3, std::bind(&debugger_commands::execute_if, this, _1, _2, _3, _4));
/* add all single-entry save state globals */
- for (itemnum = 0; itemnum < MAX_GLOBALS; itemnum++)
+ for (int itemnum = 0; itemnum < MAX_GLOBALS; itemnum++)
{
UINT32 valsize, valcount;
void *base;
/* stop when we run out of items */
- name = machine.save().indexed_item(itemnum, base, valsize, valcount);
+ const char* name = m_machine.save().indexed_item(itemnum, base, valsize, valcount);
if (name == nullptr)
break;
@@ -263,181 +123,164 @@ void debug_command_init(running_machine &machine)
{
char symname[100];
sprintf(symname, ".%s", strrchr(name, '/') + 1);
- global_array[itemnum].base = base;
- global_array[itemnum].size = valsize;
- symtable->add(symname, &global_array, global_get, global_set);
+ m_global_array[itemnum].base = base;
+ m_global_array[itemnum].size = valsize;
+ symtable->add(symname, &m_global_array, std::bind(&debugger_commands::global_get, this, _1, _2), std::bind(&debugger_commands::global_set, this, _1, _2, _3));
}
}
/* add all the commands */
- debug_console_register_command(machine, "help", CMDFLAG_NONE, 0, 0, 1, execute_help);
- debug_console_register_command(machine, "print", CMDFLAG_NONE, 0, 1, MAX_COMMAND_PARAMS, execute_print);
- debug_console_register_command(machine, "printf", CMDFLAG_NONE, 0, 1, MAX_COMMAND_PARAMS, execute_printf);
- 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);
- debug_console_register_command(machine, "over", CMDFLAG_NONE, 0, 0, 1, execute_over);
- debug_console_register_command(machine, "o", CMDFLAG_NONE, 0, 0, 1, execute_over);
- debug_console_register_command(machine, "out" , CMDFLAG_NONE, 0, 0, 0, execute_out);
- debug_console_register_command(machine, "go", CMDFLAG_NONE, 0, 0, 1, execute_go);
- debug_console_register_command(machine, "g", CMDFLAG_NONE, 0, 0, 1, execute_go);
- debug_console_register_command(machine, "gvblank", CMDFLAG_NONE, 0, 0, 0, execute_go_vblank);
- debug_console_register_command(machine, "gv", CMDFLAG_NONE, 0, 0, 0, execute_go_vblank);
- debug_console_register_command(machine, "gint", CMDFLAG_NONE, 0, 0, 1, execute_go_interrupt);
- debug_console_register_command(machine, "gi", CMDFLAG_NONE, 0, 0, 1, execute_go_interrupt);
- debug_console_register_command(machine, "gtime", CMDFLAG_NONE, 0, 0, 1, execute_go_time);
- debug_console_register_command(machine, "gt", CMDFLAG_NONE, 0, 0, 1, execute_go_time);
- debug_console_register_command(machine, "next", CMDFLAG_NONE, 0, 0, 0, execute_next);
- debug_console_register_command(machine, "n", CMDFLAG_NONE, 0, 0, 0, execute_next);
- debug_console_register_command(machine, "focus", CMDFLAG_NONE, 0, 1, 1, execute_focus);
- debug_console_register_command(machine, "ignore", CMDFLAG_NONE, 0, 0, MAX_COMMAND_PARAMS, execute_ignore);
- debug_console_register_command(machine, "observe", CMDFLAG_NONE, 0, 0, MAX_COMMAND_PARAMS, execute_observe);
-
- debug_console_register_command(machine, "comadd", CMDFLAG_NONE, 0, 1, 2, execute_comment_add);
- debug_console_register_command(machine, "//", CMDFLAG_NONE, 0, 1, 2, execute_comment_add);
- debug_console_register_command(machine, "comdelete", CMDFLAG_NONE, 0, 1, 1, execute_comment_del);
- debug_console_register_command(machine, "comsave", CMDFLAG_NONE, 0, 0, 0, execute_comment_save);
- debug_console_register_command(machine, "comlist", CMDFLAG_NONE, 0, 0, 0, execute_comment_list);
- debug_console_register_command(machine, "commit", CMDFLAG_NONE, 0, 1, 2, execute_comment_commit);
- debug_console_register_command(machine, "/*", CMDFLAG_NONE, 0, 1, 2, execute_comment_commit);
-
- debug_console_register_command(machine, "bpset", CMDFLAG_NONE, 0, 1, 3, execute_bpset);
- debug_console_register_command(machine, "bp", CMDFLAG_NONE, 0, 1, 3, execute_bpset);
- debug_console_register_command(machine, "bpclear", CMDFLAG_NONE, 0, 0, 1, execute_bpclear);
- debug_console_register_command(machine, "bpdisable", CMDFLAG_NONE, 0, 0, 1, execute_bpdisenable);
- debug_console_register_command(machine, "bpenable", CMDFLAG_NONE, 1, 0, 1, execute_bpdisenable);
- debug_console_register_command(machine, "bplist", CMDFLAG_NONE, 0, 0, 0, execute_bplist);
-
- debug_console_register_command(machine, "wpset", CMDFLAG_NONE, AS_PROGRAM, 3, 5, execute_wpset);
- debug_console_register_command(machine, "wp", CMDFLAG_NONE, AS_PROGRAM, 3, 5, execute_wpset);
- debug_console_register_command(machine, "wpdset", CMDFLAG_NONE, AS_DATA, 3, 5, execute_wpset);
- debug_console_register_command(machine, "wpd", CMDFLAG_NONE, AS_DATA, 3, 5, execute_wpset);
- debug_console_register_command(machine, "wpiset", CMDFLAG_NONE, AS_IO, 3, 5, execute_wpset);
- debug_console_register_command(machine, "wpi", CMDFLAG_NONE, AS_IO, 3, 5, execute_wpset);
- debug_console_register_command(machine, "wpclear", CMDFLAG_NONE, 0, 0, 1, execute_wpclear);
- debug_console_register_command(machine, "wpdisable", CMDFLAG_NONE, 0, 0, 1, execute_wpdisenable);
- 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, "statesave", CMDFLAG_NONE, 0, 1, 1, execute_statesave);
- debug_console_register_command(machine, "ss", CMDFLAG_NONE, 0, 1, 1, execute_statesave);
- debug_console_register_command(machine, "stateload", CMDFLAG_NONE, 0, 1, 1, execute_stateload);
- debug_console_register_command(machine, "sl", CMDFLAG_NONE, 0, 1, 1, execute_stateload);
-
- debug_console_register_command(machine, "save", CMDFLAG_NONE, AS_PROGRAM, 3, 4, execute_save);
- debug_console_register_command(machine, "saved", CMDFLAG_NONE, AS_DATA, 3, 4, execute_save);
- debug_console_register_command(machine, "savei", CMDFLAG_NONE, AS_IO, 3, 4, execute_save);
-
- debug_console_register_command(machine, "load", CMDFLAG_NONE, AS_PROGRAM, 3, 4, execute_load);
- debug_console_register_command(machine, "loadd", CMDFLAG_NONE, AS_DATA, 3, 4, execute_load);
- debug_console_register_command(machine, "loadi", CMDFLAG_NONE, AS_IO, 3, 4, execute_load);
-
- debug_console_register_command(machine, "dump", CMDFLAG_NONE, AS_PROGRAM, 3, 6, execute_dump);
- debug_console_register_command(machine, "dumpd", CMDFLAG_NONE, AS_DATA, 3, 6, execute_dump);
- debug_console_register_command(machine, "dumpi", CMDFLAG_NONE, AS_IO, 3, 6, execute_dump);
-
- debug_console_register_command(machine, "cheatinit", CMDFLAG_NONE, 0, 0, 4, execute_cheatinit);
- debug_console_register_command(machine, "ci", CMDFLAG_NONE, 0, 0, 4, execute_cheatinit);
-
- debug_console_register_command(machine, "cheatrange",CMDFLAG_NONE, 1, 2, 2, execute_cheatinit);
- debug_console_register_command(machine, "cr", CMDFLAG_NONE, 1, 2, 2, execute_cheatinit);
-
- debug_console_register_command(machine, "cheatnext", CMDFLAG_NONE, 0, 1, 2, execute_cheatnext);
- debug_console_register_command(machine, "cn", CMDFLAG_NONE, 0, 1, 2, execute_cheatnext);
- debug_console_register_command(machine, "cheatnextf",CMDFLAG_NONE, 1, 1, 2, execute_cheatnext);
- debug_console_register_command(machine, "cnf", CMDFLAG_NONE, 1, 1, 2, execute_cheatnext);
-
- debug_console_register_command(machine, "cheatlist", CMDFLAG_NONE, 0, 0, 1, execute_cheatlist);
- debug_console_register_command(machine, "cl", CMDFLAG_NONE, 0, 0, 1, execute_cheatlist);
-
- debug_console_register_command(machine, "cheatundo", CMDFLAG_NONE, 0, 0, 0, execute_cheatundo);
- debug_console_register_command(machine, "cu", CMDFLAG_NONE, 0, 0, 0, execute_cheatundo);
-
- debug_console_register_command(machine, "f", CMDFLAG_KEEP_QUOTES, AS_PROGRAM, 3, MAX_COMMAND_PARAMS, execute_find);
- debug_console_register_command(machine, "find", CMDFLAG_KEEP_QUOTES, AS_PROGRAM, 3, MAX_COMMAND_PARAMS, execute_find);
- debug_console_register_command(machine, "fd", CMDFLAG_KEEP_QUOTES, AS_DATA, 3, MAX_COMMAND_PARAMS, execute_find);
- debug_console_register_command(machine, "findd", CMDFLAG_KEEP_QUOTES, AS_DATA, 3, MAX_COMMAND_PARAMS, execute_find);
- debug_console_register_command(machine, "fi", CMDFLAG_KEEP_QUOTES, AS_IO, 3, MAX_COMMAND_PARAMS, execute_find);
- debug_console_register_command(machine, "findi", CMDFLAG_KEEP_QUOTES, AS_IO, 3, MAX_COMMAND_PARAMS, execute_find);
-
- debug_console_register_command(machine, "dasm", CMDFLAG_NONE, 0, 3, 5, execute_dasm);
-
- debug_console_register_command(machine, "trace", CMDFLAG_NONE, 0, 1, 3, execute_trace);
- debug_console_register_command(machine, "traceover", CMDFLAG_NONE, 0, 1, 3, execute_traceover);
- 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, "trackmem", CMDFLAG_NONE, 0, 0, 3, execute_trackmem);
- debug_console_register_command(machine, "pcatmemp", CMDFLAG_NONE, AS_PROGRAM, 1, 2, execute_pcatmem);
- debug_console_register_command(machine, "pcatmemd", CMDFLAG_NONE, AS_DATA, 1, 2, execute_pcatmem);
- debug_console_register_command(machine, "pcatmemi", CMDFLAG_NONE, AS_IO, 1, 2, execute_pcatmem);
-
- debug_console_register_command(machine, "snap", CMDFLAG_NONE, 0, 0, 1, execute_snap);
-
- debug_console_register_command(machine, "source", CMDFLAG_NONE, 0, 1, 1, execute_source);
-
- debug_console_register_command(machine, "map", CMDFLAG_NONE, AS_PROGRAM, 1, 1, execute_map);
- debug_console_register_command(machine, "mapd", CMDFLAG_NONE, AS_DATA, 1, 1, execute_map);
- debug_console_register_command(machine, "mapi", CMDFLAG_NONE, AS_IO, 1, 1, execute_map);
- debug_console_register_command(machine, "memdump", CMDFLAG_NONE, 0, 0, 1, execute_memdump);
-
- debug_console_register_command(machine, "symlist", CMDFLAG_NONE, 0, 0, 1, execute_symlist);
-
- debug_console_register_command(machine, "softreset", CMDFLAG_NONE, 0, 0, 1, execute_softreset);
- debug_console_register_command(machine, "hardreset", CMDFLAG_NONE, 0, 0, 1, execute_hardreset);
-
- debug_console_register_command(machine, "images", CMDFLAG_NONE, 0, 0, 0, execute_images);
- debug_console_register_command(machine, "mount", CMDFLAG_NONE, 0, 2, 2, execute_mount);
- debug_console_register_command(machine, "unmount", CMDFLAG_NONE, 0, 1, 1, execute_unmount);
-
- debug_console_register_command(machine, "input", CMDFLAG_NONE, 0, 1, 1, execute_input);
- debug_console_register_command(machine, "dumpkbd", CMDFLAG_NONE, 0, 0, 1, execute_dumpkbd);
+ m_console.register_command("help", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_help, this, _1, _2, _3));
+ m_console.register_command("print", CMDFLAG_NONE, 0, 1, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_print, this, _1, _2, _3));
+ m_console.register_command("printf", CMDFLAG_NONE, 0, 1, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_printf, this, _1, _2, _3));
+ m_console.register_command("logerror", CMDFLAG_NONE, 0, 1, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_logerror, this, _1, _2, _3));
+ m_console.register_command("tracelog", CMDFLAG_NONE, 0, 1, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_tracelog, this, _1, _2, _3));
+ m_console.register_command("quit", CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_commands::execute_quit, this, _1, _2, _3));
+ m_console.register_command("exit", CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_commands::execute_quit, this, _1, _2, _3));
+ m_console.register_command("do", CMDFLAG_NONE, 0, 1, 1, std::bind(&debugger_commands::execute_do, this, _1, _2, _3));
+ m_console.register_command("step", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_step, this, _1, _2, _3));
+ m_console.register_command("s", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_step, this, _1, _2, _3));
+ m_console.register_command("over", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_over, this, _1, _2, _3));
+ m_console.register_command("o", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_over, this, _1, _2, _3));
+ m_console.register_command("out" , CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_commands::execute_out, this, _1, _2, _3));
+ m_console.register_command("go", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_go, this, _1, _2, _3));
+ m_console.register_command("g", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_go, this, _1, _2, _3));
+ m_console.register_command("gvblank", CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_commands::execute_go_vblank, this, _1, _2, _3));
+ m_console.register_command("gv", CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_commands::execute_go_vblank, this, _1, _2, _3));
+ m_console.register_command("gint", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_go_interrupt, this, _1, _2, _3));
+ m_console.register_command("gi", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_go_interrupt, this, _1, _2, _3));
+ m_console.register_command("gtime", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_go_time, this, _1, _2, _3));
+ m_console.register_command("gt", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_go_time, this, _1, _2, _3));
+ m_console.register_command("next", CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_commands::execute_next, this, _1, _2, _3));
+ m_console.register_command("n", CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_commands::execute_next, this, _1, _2, _3));
+ m_console.register_command("focus", CMDFLAG_NONE, 0, 1, 1, std::bind(&debugger_commands::execute_focus, this, _1, _2, _3));
+ m_console.register_command("ignore", CMDFLAG_NONE, 0, 0, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_ignore, this, _1, _2, _3));
+ m_console.register_command("observe", CMDFLAG_NONE, 0, 0, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_observe, this, _1, _2, _3));
+
+ m_console.register_command("comadd", CMDFLAG_NONE, 0, 1, 2, std::bind(&debugger_commands::execute_comment_add, this, _1, _2, _3));
+ m_console.register_command("//", CMDFLAG_NONE, 0, 1, 2, std::bind(&debugger_commands::execute_comment_add, this, _1, _2, _3));
+ m_console.register_command("comdelete", CMDFLAG_NONE, 0, 1, 1, std::bind(&debugger_commands::execute_comment_del, this, _1, _2, _3));
+ m_console.register_command("comsave", CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_commands::execute_comment_save, this, _1, _2, _3));
+ m_console.register_command("comlist", CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_commands::execute_comment_list, this, _1, _2, _3));
+ m_console.register_command("commit", CMDFLAG_NONE, 0, 1, 2, std::bind(&debugger_commands::execute_comment_commit, this, _1, _2, _3));
+ m_console.register_command("/*", CMDFLAG_NONE, 0, 1, 2, std::bind(&debugger_commands::execute_comment_commit, this, _1, _2, _3));
+
+ m_console.register_command("bpset", CMDFLAG_NONE, 0, 1, 3, std::bind(&debugger_commands::execute_bpset, this, _1, _2, _3));
+ m_console.register_command("bp", CMDFLAG_NONE, 0, 1, 3, std::bind(&debugger_commands::execute_bpset, this, _1, _2, _3));
+ m_console.register_command("bpclear", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_bpclear, this, _1, _2, _3));
+ m_console.register_command("bpdisable", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_bpdisenable, this, _1, _2, _3));
+ m_console.register_command("bpenable", CMDFLAG_NONE, 1, 0, 1, std::bind(&debugger_commands::execute_bpdisenable, this, _1, _2, _3));
+ m_console.register_command("bplist", CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_commands::execute_bplist, this, _1, _2, _3));
+
+ m_console.register_command("wpset", CMDFLAG_NONE, AS_PROGRAM, 3, 5, std::bind(&debugger_commands::execute_wpset, this, _1, _2, _3));
+ m_console.register_command("wp", CMDFLAG_NONE, AS_PROGRAM, 3, 5, std::bind(&debugger_commands::execute_wpset, this, _1, _2, _3));
+ m_console.register_command("wpdset", CMDFLAG_NONE, AS_DATA, 3, 5, std::bind(&debugger_commands::execute_wpset, this, _1, _2, _3));
+ m_console.register_command("wpd", CMDFLAG_NONE, AS_DATA, 3, 5, std::bind(&debugger_commands::execute_wpset, this, _1, _2, _3));
+ m_console.register_command("wpiset", CMDFLAG_NONE, AS_IO, 3, 5, std::bind(&debugger_commands::execute_wpset, this, _1, _2, _3));
+ m_console.register_command("wpi", CMDFLAG_NONE, AS_IO, 3, 5, std::bind(&debugger_commands::execute_wpset, this, _1, _2, _3));
+ m_console.register_command("wpclear", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_wpclear, this, _1, _2, _3));
+ m_console.register_command("wpdisable", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_wpdisenable, this, _1, _2, _3));
+ m_console.register_command("wpenable", CMDFLAG_NONE, 1, 0, 1, std::bind(&debugger_commands::execute_wpdisenable, this, _1, _2, _3));
+ m_console.register_command("wplist", CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_commands::execute_wplist, this, _1, _2, _3));
+
+ m_console.register_command("rpset", CMDFLAG_NONE, 0, 1, 2, std::bind(&debugger_commands::execute_rpset, this, _1, _2, _3));
+ m_console.register_command("rp", CMDFLAG_NONE, 0, 1, 2, std::bind(&debugger_commands::execute_rpset, this, _1, _2, _3));
+ m_console.register_command("rpclear", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_rpclear, this, _1, _2, _3));
+ m_console.register_command("rpdisable", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_rpdisenable, this, _1, _2, _3));
+ m_console.register_command("rpenable", CMDFLAG_NONE, 1, 0, 1, std::bind(&debugger_commands::execute_rpdisenable, this, _1, _2, _3));
+ m_console.register_command("rplist", CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_commands::execute_rplist, this, _1, _2, _3));
+
+ m_console.register_command("hotspot", CMDFLAG_NONE, 0, 0, 3, std::bind(&debugger_commands::execute_hotspot, this, _1, _2, _3));
+
+ m_console.register_command("statesave", CMDFLAG_NONE, 0, 1, 1, std::bind(&debugger_commands::execute_statesave, this, _1, _2, _3));
+ m_console.register_command("ss", CMDFLAG_NONE, 0, 1, 1, std::bind(&debugger_commands::execute_statesave, this, _1, _2, _3));
+ m_console.register_command("stateload", CMDFLAG_NONE, 0, 1, 1, std::bind(&debugger_commands::execute_stateload, this, _1, _2, _3));
+ m_console.register_command("sl", CMDFLAG_NONE, 0, 1, 1, std::bind(&debugger_commands::execute_stateload, this, _1, _2, _3));
+
+ m_console.register_command("save", CMDFLAG_NONE, AS_PROGRAM, 3, 4, std::bind(&debugger_commands::execute_save, this, _1, _2, _3));
+ m_console.register_command("saved", CMDFLAG_NONE, AS_DATA, 3, 4, std::bind(&debugger_commands::execute_save, this, _1, _2, _3));
+ m_console.register_command("savei", CMDFLAG_NONE, AS_IO, 3, 4, std::bind(&debugger_commands::execute_save, this, _1, _2, _3));
+
+ m_console.register_command("load", CMDFLAG_NONE, AS_PROGRAM, 3, 4, std::bind(&debugger_commands::execute_load, this, _1, _2, _3));
+ m_console.register_command("loadd", CMDFLAG_NONE, AS_DATA, 3, 4, std::bind(&debugger_commands::execute_load, this, _1, _2, _3));
+ m_console.register_command("loadi", CMDFLAG_NONE, AS_IO, 3, 4, std::bind(&debugger_commands::execute_load, this, _1, _2, _3));
+
+ m_console.register_command("dump", CMDFLAG_NONE, AS_PROGRAM, 3, 6, std::bind(&debugger_commands::execute_dump, this, _1, _2, _3));
+ m_console.register_command("dumpd", CMDFLAG_NONE, AS_DATA, 3, 6, std::bind(&debugger_commands::execute_dump, this, _1, _2, _3));
+ m_console.register_command("dumpi", CMDFLAG_NONE, AS_IO, 3, 6, std::bind(&debugger_commands::execute_dump, this, _1, _2, _3));
+
+ m_console.register_command("cheatinit", CMDFLAG_NONE, 0, 0, 4, std::bind(&debugger_commands::execute_cheatinit, this, _1, _2, _3));
+ m_console.register_command("ci", CMDFLAG_NONE, 0, 0, 4, std::bind(&debugger_commands::execute_cheatinit, this, _1, _2, _3));
+
+ m_console.register_command("cheatrange",CMDFLAG_NONE, 1, 2, 2, std::bind(&debugger_commands::execute_cheatinit, this, _1, _2, _3));
+ m_console.register_command("cr", CMDFLAG_NONE, 1, 2, 2, std::bind(&debugger_commands::execute_cheatinit, this, _1, _2, _3));
+
+ m_console.register_command("cheatnext", CMDFLAG_NONE, 0, 1, 2, std::bind(&debugger_commands::execute_cheatnext, this, _1, _2, _3));
+ m_console.register_command("cn", CMDFLAG_NONE, 0, 1, 2, std::bind(&debugger_commands::execute_cheatnext, this, _1, _2, _3));
+ m_console.register_command("cheatnextf",CMDFLAG_NONE, 1, 1, 2, std::bind(&debugger_commands::execute_cheatnext, this, _1, _2, _3));
+ m_console.register_command("cnf", CMDFLAG_NONE, 1, 1, 2, std::bind(&debugger_commands::execute_cheatnext, this, _1, _2, _3));
+
+ m_console.register_command("cheatlist", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_cheatlist, this, _1, _2, _3));
+ m_console.register_command("cl", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_cheatlist, this, _1, _2, _3));
+
+ m_console.register_command("cheatundo", CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_commands::execute_cheatundo, this, _1, _2, _3));
+ m_console.register_command("cu", CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_commands::execute_cheatundo, this, _1, _2, _3));
+
+ m_console.register_command("f", CMDFLAG_KEEP_QUOTES, AS_PROGRAM, 3, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_find, this, _1, _2, _3));
+ m_console.register_command("find", CMDFLAG_KEEP_QUOTES, AS_PROGRAM, 3, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_find, this, _1, _2, _3));
+ m_console.register_command("fd", CMDFLAG_KEEP_QUOTES, AS_DATA, 3, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_find, this, _1, _2, _3));
+ m_console.register_command("findd", CMDFLAG_KEEP_QUOTES, AS_DATA, 3, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_find, this, _1, _2, _3));
+ m_console.register_command("fi", CMDFLAG_KEEP_QUOTES, AS_IO, 3, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_find, this, _1, _2, _3));
+ m_console.register_command("findi", CMDFLAG_KEEP_QUOTES, AS_IO, 3, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_find, this, _1, _2, _3));
+
+ m_console.register_command("dasm", CMDFLAG_NONE, 0, 3, 5, std::bind(&debugger_commands::execute_dasm, this, _1, _2, _3));
+
+ m_console.register_command("trace", CMDFLAG_NONE, 0, 1, 3, std::bind(&debugger_commands::execute_trace, this, _1, _2, _3));
+ m_console.register_command("traceover", CMDFLAG_NONE, 0, 1, 3, std::bind(&debugger_commands::execute_traceover, this, _1, _2, _3));
+ m_console.register_command("traceflush",CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_commands::execute_traceflush, this, _1, _2, _3));
+
+ m_console.register_command("history", CMDFLAG_NONE, 0, 0, 2, std::bind(&debugger_commands::execute_history, this, _1, _2, _3));
+ m_console.register_command("trackpc", CMDFLAG_NONE, 0, 0, 3, std::bind(&debugger_commands::execute_trackpc, this, _1, _2, _3));
+
+ m_console.register_command("trackmem", CMDFLAG_NONE, 0, 0, 3, std::bind(&debugger_commands::execute_trackmem, this, _1, _2, _3));
+ m_console.register_command("pcatmemp", CMDFLAG_NONE, AS_PROGRAM, 1, 2, std::bind(&debugger_commands::execute_pcatmem, this, _1, _2, _3));
+ m_console.register_command("pcatmemd", CMDFLAG_NONE, AS_DATA, 1, 2, std::bind(&debugger_commands::execute_pcatmem, this, _1, _2, _3));
+ m_console.register_command("pcatmemi", CMDFLAG_NONE, AS_IO, 1, 2, std::bind(&debugger_commands::execute_pcatmem, this, _1, _2, _3));
+
+ m_console.register_command("snap", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_snap, this, _1, _2, _3));
+
+ m_console.register_command("source", CMDFLAG_NONE, 0, 1, 1, std::bind(&debugger_commands::execute_source, this, _1, _2, _3));
+
+ m_console.register_command("map", CMDFLAG_NONE, AS_PROGRAM, 1, 1, std::bind(&debugger_commands::execute_map, this, _1, _2, _3));
+ m_console.register_command("mapd", CMDFLAG_NONE, AS_DATA, 1, 1, std::bind(&debugger_commands::execute_map, this, _1, _2, _3));
+ m_console.register_command("mapi", CMDFLAG_NONE, AS_IO, 1, 1, std::bind(&debugger_commands::execute_map, this, _1, _2, _3));
+ m_console.register_command("memdump", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_memdump, this, _1, _2, _3));
+
+ m_console.register_command("symlist", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_symlist, this, _1, _2, _3));
+
+ m_console.register_command("softreset", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_softreset, this, _1, _2, _3));
+ m_console.register_command("hardreset", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_hardreset, this, _1, _2, _3));
+
+ m_console.register_command("images", CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_commands::execute_images, this, _1, _2, _3));
+ m_console.register_command("mount", CMDFLAG_NONE, 0, 2, 2, std::bind(&debugger_commands::execute_mount, this, _1, _2, _3));
+ m_console.register_command("unmount", CMDFLAG_NONE, 0, 1, 1, std::bind(&debugger_commands::execute_unmount, this, _1, _2, _3));
- machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(debug_command_exit), &machine));
+ m_console.register_command("input", CMDFLAG_NONE, 0, 1, 1, std::bind(&debugger_commands::execute_input, this, _1, _2, _3));
+ m_console.register_command("dumpkbd", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_dumpkbd, this, _1, _2, _3));
/* set up the initial debugscript if specified */
- name = machine.options().debug_script();
+ const char* name = m_machine.options().debug_script();
if (name[0] != 0)
- debug_cpu_source_script(machine, name);
-
- cheat.cpu[0] = cheat.cpu[1] = 0;
-}
-
-
-/*-------------------------------------------------
- debug_command_exit - exit-time cleanup
--------------------------------------------------*/
+ m_cpu.source_script(name);
-static void debug_command_exit(running_machine &machine)
-{
+ m_cheat.cpu[0] = m_cheat.cpu[1] = 0;
}
-
-
-/***************************************************************************
- GLOBAL FUNCTIONS
-***************************************************************************/
-
/*-------------------------------------------------
execute_min - return the minimum of two values
-------------------------------------------------*/
-static UINT64 execute_min(symbol_table &table, void *ref, int params, const UINT64 *param)
+UINT64 debugger_commands::execute_min(symbol_table &table, void *ref, int params, const UINT64 *param)
{
return (param[0] < param[1]) ? param[0] : param[1];
}
@@ -447,7 +290,7 @@ static UINT64 execute_min(symbol_table &table, void *ref, int params, const UINT
execute_max - return the maximum of two values
-------------------------------------------------*/
-static UINT64 execute_max(symbol_table &table, void *ref, int params, const UINT64 *param)
+UINT64 debugger_commands::execute_max(symbol_table &table, void *ref, int params, const UINT64 *param)
{
return (param[0] > param[1]) ? param[0] : param[1];
}
@@ -457,7 +300,7 @@ static UINT64 execute_max(symbol_table &table, void *ref, int params, const UINT
execute_if - if (a) return b; else return c;
-------------------------------------------------*/
-static UINT64 execute_if(symbol_table &table, void *ref, int params, const UINT64 *param)
+UINT64 debugger_commands::execute_if(symbol_table &table, void *ref, int params, const UINT64 *param)
{
return param[0] ? param[1] : param[2];
}
@@ -472,7 +315,7 @@ static UINT64 execute_if(symbol_table &table, void *ref, int params, const UINT6
global_get - symbol table getter for globals
-------------------------------------------------*/
-static UINT64 global_get(symbol_table &table, void *ref)
+UINT64 debugger_commands::global_get(symbol_table &table, void *ref)
{
global_entry *global = (global_entry *)ref;
switch (global->size)
@@ -490,7 +333,7 @@ static UINT64 global_get(symbol_table &table, void *ref)
global_set - symbol table setter for globals
-------------------------------------------------*/
-static void global_set(symbol_table &table, void *ref, UINT64 value)
+void debugger_commands::global_set(symbol_table &table, void *ref, UINT64 value)
{
global_entry *global = (global_entry *)ref;
switch (global->size)
@@ -509,106 +352,104 @@ static void global_set(symbol_table &table, void *ref, UINT64 value)
***************************************************************************/
/*-------------------------------------------------
- debug_command_parameter_number - validates a
+ validate_number_parameter - validates a
number parameter
-------------------------------------------------*/
-int debug_command_parameter_number(running_machine &machine, const char *param, UINT64 *result)
+bool debugger_commands::validate_number_parameter(const char *param, UINT64 *result)
{
/* nullptr parameter does nothing and returns no error */
if (param == nullptr)
- return TRUE;
+ return true;
/* evaluate the expression; success if no error */
try
{
- parsed_expression expression(debug_cpu_get_visible_symtable(machine), param, result);
- return TRUE;
+ parsed_expression expression(m_cpu.get_visible_symtable(), param, result);
+ return true;
}
catch (expression_error &error)
{
/* print an error pointing to the character that caused it */
- debug_console_printf(machine, "Error in expression: %s\n", param);
- debug_console_printf(machine, " %*s^", error.offset(), "");
- debug_console_printf(machine, "%s\n", error.code_string());
- return FALSE;
+ m_console.printf("Error in expression: %s\n", param);
+ m_console.printf(" %*s^", error.offset(), "");
+ m_console.printf("%s\n", error.code_string());
+ return false;
}
}
/*-------------------------------------------------
- debug_command_parameter_cpu - validates a
+ validate_cpu_parameter - validates a
parameter as a cpu
-------------------------------------------------*/
-int debug_command_parameter_cpu(running_machine &machine, const char *param, device_t **result)
+bool debugger_commands::validate_cpu_parameter(const char *param, device_t **result)
{
- UINT64 cpunum;
-
/* if no parameter, use the visible CPU */
if (param == nullptr)
{
- *result = debug_cpu_get_visible_cpu(machine);
+ *result = m_cpu.get_visible_cpu();
if (*result == nullptr)
{
- debug_console_printf(machine, "No valid CPU is currently selected\n");
- return FALSE;
+ m_console.printf("No valid CPU is currently selected\n");
+ return false;
}
- return TRUE;
+ return true;
}
/* first look for a tag match */
- *result = machine.device(param);
+ *result = m_machine.device(param);
if (*result != nullptr)
- return TRUE;
+ return true;
/* then evaluate as an expression; on an error assume it was a tag */
+ UINT64 cpunum;
try
{
- parsed_expression expression(debug_cpu_get_visible_symtable(machine), param, &cpunum);
+ parsed_expression expression(m_cpu.get_visible_symtable(), param, &cpunum);
}
catch (expression_error &)
{
- debug_console_printf(machine, "Unable to find CPU '%s'\n", param);
- return FALSE;
+ m_console.printf("Unable to find CPU '%s'\n", param);
+ return false;
}
/* if we got a valid one, return */
- device_execute_interface *exec = execute_interface_iterator(machine.root_device()).byindex(cpunum);
+ device_execute_interface *exec = execute_interface_iterator(m_machine.root_device()).byindex(cpunum);
if (exec != nullptr)
{
*result = &exec->device();
- return TRUE;
+ return true;
}
/* if out of range, complain */
- debug_console_printf(machine, "Invalid CPU index %d\n", (int)cpunum);
- return FALSE;
+ m_console.printf("Invalid CPU index %d\n", (int)cpunum);
+ return false;
}
/*-------------------------------------------------
- debug_command_parameter_cpu_space - validates
+ validate_cpu_space_parameter - validates
a parameter as a cpu and retrieves the given
address space
-------------------------------------------------*/
-int debug_command_parameter_cpu_space(running_machine &machine, const char *param, int spacenum, address_space *&result)
+bool debugger_commands::validate_cpu_space_parameter(const char *param, int spacenum, address_space *&result)
{
- device_t *cpu;
-
/* first do the standard CPU thing */
- if (!debug_command_parameter_cpu(machine, param, &cpu))
- return FALSE;
+ device_t *cpu;
+ if (!validate_cpu_parameter(param, &cpu))
+ return false;
/* fetch the space pointer */
if (!cpu->memory().has_space(spacenum))
{
- debug_console_printf(machine, "No matching memory space found for CPU '%s'\n", cpu->tag());
- return FALSE;
+ m_console.printf("No matching memory space found for CPU '%s'\n", cpu->tag());
+ return false;
}
result = &cpu->memory().space(spacenum);
- return TRUE;
+ return true;
}
@@ -617,25 +458,25 @@ int debug_command_parameter_cpu_space(running_machine &machine, const char *para
an expression parameter
-------------------------------------------------*/
-static int debug_command_parameter_expression(running_machine &machine, const char *param, parsed_expression &result)
+bool debugger_commands::debug_command_parameter_expression(const char *param, parsed_expression &result)
{
/* nullptr parameter does nothing and returns no error */
if (param == nullptr)
- return TRUE;
+ return true;
/* parse the expression; success if no error */
try
{
result.parse(param);
- return TRUE;
+ return true;
}
catch (expression_error &err)
{
/* output an error */
- debug_console_printf(machine, "Error in expression: %s\n", param);
- debug_console_printf(machine, " %*s^", err.offset(), "");
- debug_console_printf(machine, "%s\n", err.code_string());
- return FALSE;
+ m_console.printf("Error in expression: %s\n", param);
+ m_console.printf(" %*s^", err.offset(), "");
+ m_console.printf("%s\n", err.code_string());
+ return false;
}
}
@@ -645,42 +486,34 @@ static int debug_command_parameter_expression(running_machine &machine, const ch
command parameter
-------------------------------------------------*/
-static int debug_command_parameter_command(running_machine &machine, const char *param)
+bool debugger_commands::debug_command_parameter_command(const char *param)
{
- CMDERR err;
-
/* nullptr parameter does nothing and returns no error */
if (param == nullptr)
- return TRUE;
+ return true;
/* validate the comment; success if no error */
- err = debug_console_validate_command(machine, param);
+ CMDERR err = m_console.validate_command(param);
if (err == CMDERR_NONE)
- return TRUE;
+ return true;
/* output an error */
- debug_console_printf(machine, "Error in command: %s\n", param);
- debug_console_printf(machine, " %*s^", CMDERR_ERROR_OFFSET(err), "");
- debug_console_printf(machine, "%s\n", debug_cmderr_to_string(err));
+ m_console.printf("Error in command: %s\n", param);
+ m_console.printf(" %*s^", CMDERR_ERROR_OFFSET(err), "");
+ m_console.printf("%s\n", debugger_console::cmderr_to_string(err));
return 0;
}
-
-
-/***************************************************************************
- COMMAND HELPERS
-***************************************************************************/
-
/*-------------------------------------------------
execute_help - execute the help command
-------------------------------------------------*/
-static void execute_help(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_help(int ref, int params, const char *param[])
{
if (params == 0)
- debug_console_printf_wrap(machine, 80, "%s\n", debug_get_help(""));
+ m_console.printf_wrap(80, "%s\n", debug_get_help(""));
else
- debug_console_printf_wrap(machine, 80, "%s\n", debug_get_help(param[0]));
+ m_console.printf_wrap(80, "%s\n", debug_get_help(param[0]));
}
@@ -688,20 +521,18 @@ static void execute_help(running_machine &machine, int ref, int params, const ch
execute_print - execute the print command
-------------------------------------------------*/
-static void execute_print(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_print(int ref, int params, const char *param[])
{
- UINT64 values[MAX_COMMAND_PARAMS];
- int i;
-
/* validate the other parameters */
- for (i = 0; i < params; i++)
- if (!debug_command_parameter_number(machine, param[i], &values[i]))
+ UINT64 values[MAX_COMMAND_PARAMS];
+ for (int i = 0; i < params; i++)
+ if (!validate_number_parameter(param[i], &values[i]))
return;
/* then print each one */
- for (i = 0; i < params; i++)
- debug_console_printf(machine, "%X", values[i]);
- debug_console_printf(machine, "\n");
+ for (int i = 0; i < params; i++)
+ m_console.printf("%X", values[i]);
+ m_console.printf("\n");
}
@@ -709,7 +540,7 @@ static void execute_print(running_machine &machine, int ref, int params, const c
mini_printf - safe printf to a buffer
-------------------------------------------------*/
-static int mini_printf(running_machine &machine, char *buffer, const char *format, int params, UINT64 *param)
+int debugger_commands::mini_printf(char *buffer, const char *format, int params, UINT64 *param)
{
const char *f = format;
char *p = buffer;
@@ -762,7 +593,7 @@ static int mini_printf(running_machine &machine, char *buffer, const char *forma
case 'x':
if (params == 0)
{
- debug_console_printf(machine, "Not enough parameters for format!\n");
+ m_console.printf("Not enough parameters for format!\n");
return 0;
}
if ((UINT32)(*param >> 32) != 0)
@@ -778,7 +609,7 @@ static int mini_printf(running_machine &machine, char *buffer, const char *forma
case 'd':
if (params == 0)
{
- debug_console_printf(machine, "Not enough parameters for format!\n");
+ m_console.printf("Not enough parameters for format!\n");
return 0;
}
p += sprintf(p, zerofill ? "%0*d" : "%*d", width, (UINT32)*param);
@@ -803,20 +634,18 @@ static int mini_printf(running_machine &machine, char *buffer, const char *forma
execute_printf - execute the printf command
-------------------------------------------------*/
-static void execute_printf(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_printf(int ref, int params, const char *param[])
{
- UINT64 values[MAX_COMMAND_PARAMS];
- char buffer[1024];
- int i;
-
/* validate the other parameters */
- for (i = 1; i < params; i++)
- if (!debug_command_parameter_number(machine, param[i], &values[i]))
+ UINT64 values[MAX_COMMAND_PARAMS];
+ for (int i = 1; i < params; i++)
+ if (!validate_number_parameter(param[i], &values[i]))
return;
/* then do a printf */
- if (mini_printf(machine, buffer, param[0], params - 1, &values[1]))
- debug_console_printf(machine, "%s\n", buffer);
+ char buffer[1024];
+ if (mini_printf(buffer, param[0], params - 1, &values[1]))
+ m_console.printf("%s\n", buffer);
}
@@ -824,20 +653,18 @@ static void execute_printf(running_machine &machine, int ref, int params, const
execute_logerror - execute the logerror command
-------------------------------------------------*/
-static void execute_logerror(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_logerror(int ref, int params, const char *param[])
{
- UINT64 values[MAX_COMMAND_PARAMS];
- char buffer[1024];
- int i;
-
/* validate the other parameters */
- for (i = 1; i < params; i++)
- if (!debug_command_parameter_number(machine, param[i], &values[i]))
+ UINT64 values[MAX_COMMAND_PARAMS];
+ for (int i = 1; i < params; i++)
+ if (!validate_number_parameter(param[i], &values[i]))
return;
/* then do a printf */
- if (mini_printf(machine, buffer, param[0], params - 1, &values[1]))
- machine.logerror("%s", buffer);
+ char buffer[1024];
+ if (mini_printf(buffer, param[0], params - 1, &values[1]))
+ m_machine.logerror("%s", buffer);
}
@@ -845,20 +672,18 @@ static void execute_logerror(running_machine &machine, int ref, int params, cons
execute_tracelog - execute the tracelog command
-------------------------------------------------*/
-static void execute_tracelog(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_tracelog(int ref, int params, const char *param[])
{
- UINT64 values[MAX_COMMAND_PARAMS];
- char buffer[1024];
- int i;
-
/* validate the other parameters */
- for (i = 1; i < params; i++)
- if (!debug_command_parameter_number(machine, param[i], &values[i]))
+ UINT64 values[MAX_COMMAND_PARAMS];
+ for (int i = 1; i < params; i++)
+ if (!validate_number_parameter(param[i], &values[i]))
return;
/* then do a printf */
- if (mini_printf(machine, buffer, param[0], params - 1, &values[1]))
- debug_cpu_get_visible_cpu(machine)->debug()->trace_printf("%s", buffer);
+ char buffer[1024];
+ if (mini_printf(buffer, param[0], params - 1, &values[1]))
+ m_cpu.get_visible_cpu()->debug()->trace_printf("%s", buffer);
}
@@ -866,10 +691,10 @@ static void execute_tracelog(running_machine &machine, int ref, int params, cons
execute_quit - execute the quit command
-------------------------------------------------*/
-static void execute_quit(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_quit(int ref, int params, const char *param[])
{
osd_printf_error("Exited via the debugger\n");
- machine.schedule_exit();
+ m_machine.schedule_exit();
}
@@ -877,10 +702,10 @@ static void execute_quit(running_machine &machine, int ref, int params, const ch
execute_do - execute the do command
-------------------------------------------------*/
-static void execute_do(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_do(int ref, int params, const char *param[])
{
UINT64 dummy;
- debug_command_parameter_number(machine, param[0], &dummy);
+ validate_number_parameter(param[0], &dummy);
}
@@ -888,15 +713,14 @@ static void execute_do(running_machine &machine, int ref, int params, const char
execute_step - execute the step command
-------------------------------------------------*/
-static void execute_step(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_step(int ref, int params, const char *param[])
{
+ /* if we have a parameter, use it */
UINT64 steps = 1;
-
- /* if we have a parameter, use it instead */
- if (!debug_command_parameter_number(machine, param[0], &steps))
+ if (!validate_number_parameter(param[0], &steps))
return;
- debug_cpu_get_visible_cpu(machine)->debug()->single_step(steps);
+ m_cpu.get_visible_cpu()->debug()->single_step(steps);
}
@@ -904,15 +728,14 @@ static void execute_step(running_machine &machine, int ref, int params, const ch
execute_over - execute the over command
-------------------------------------------------*/
-static void execute_over(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_over(int ref, int params, const char *param[])
{
+ /* if we have a parameter, use it */
UINT64 steps = 1;
-
- /* if we have a parameter, use it instead */
- if (!debug_command_parameter_number(machine, param[0], &steps))
+ if (!validate_number_parameter(param[0], &steps))
return;
- debug_cpu_get_visible_cpu(machine)->debug()->single_step_over(steps);
+ m_cpu.get_visible_cpu()->debug()->single_step_over(steps);
}
@@ -920,9 +743,9 @@ static void execute_over(running_machine &machine, int ref, int params, const ch
execute_out - execute the out command
-------------------------------------------------*/
-static void execute_out(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_out(int ref, int params, const char *param[])
{
- debug_cpu_get_visible_cpu(machine)->debug()->single_step_out();
+ m_cpu.get_visible_cpu()->debug()->single_step_out();
}
@@ -930,15 +753,15 @@ static void execute_out(running_machine &machine, int ref, int params, const cha
execute_go - execute the go command
-------------------------------------------------*/
-static void execute_go(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_go(int ref, int params, const char *param[])
{
UINT64 addr = ~0;
/* if we have a parameter, use it instead */
- if (!debug_command_parameter_number(machine, param[0], &addr))
+ if (!validate_number_parameter(param[0], &addr))
return;
- debug_cpu_get_visible_cpu(machine)->debug()->go(addr);
+ m_cpu.get_visible_cpu()->debug()->go(addr);
}
@@ -947,9 +770,9 @@ static void execute_go(running_machine &machine, int ref, int params, const char
command
-------------------------------------------------*/
-static void execute_go_vblank(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_go_vblank(int ref, int params, const char *param[])
{
- debug_cpu_get_visible_cpu(machine)->debug()->go_vblank();
+ m_cpu.get_visible_cpu()->debug()->go_vblank();
}
@@ -957,15 +780,15 @@ static void execute_go_vblank(running_machine &machine, int ref, int params, con
execute_go_interrupt - execute the goint command
-------------------------------------------------*/
-static void execute_go_interrupt(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_go_interrupt(int ref, int params, const char *param[])
{
UINT64 irqline = -1;
/* if we have a parameter, use it instead */
- if (!debug_command_parameter_number(machine, param[0], &irqline))
+ if (!validate_number_parameter(param[0], &irqline))
return;
- debug_cpu_get_visible_cpu(machine)->debug()->go_interrupt(irqline);
+ m_cpu.get_visible_cpu()->debug()->go_interrupt(irqline);
}
@@ -973,15 +796,15 @@ static void execute_go_interrupt(running_machine &machine, int ref, int params,
execute_go_time - execute the gtime command
-------------------------------------------------*/
-static void execute_go_time(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_go_time(int ref, int params, const char *param[])
{
UINT64 milliseconds = -1;
/* if we have a parameter, use it instead */
- if (!debug_command_parameter_number(machine, param[0], &milliseconds))
+ if (!validate_number_parameter(param[0], &milliseconds))
return;
- debug_cpu_get_visible_cpu(machine)->debug()->go_milliseconds(milliseconds);
+ m_cpu.get_visible_cpu()->debug()->go_milliseconds(milliseconds);
}
@@ -989,9 +812,9 @@ static void execute_go_time(running_machine &machine, int ref, int params, const
execute_next - execute the next command
-------------------------------------------------*/
-static void execute_next(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_next(int ref, int params, const char *param[])
{
- debug_cpu_get_visible_cpu(machine)->debug()->go_next_device();
+ m_cpu.get_visible_cpu()->debug()->go_next_device();
}
@@ -999,21 +822,21 @@ static void execute_next(running_machine &machine, int ref, int params, const ch
execute_focus - execute the focus command
-------------------------------------------------*/
-static void execute_focus(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_focus(int ref, int params, const char *param[])
{
/* validate params */
device_t *cpu;
- if (!debug_command_parameter_cpu(machine, param[0], &cpu))
+ if (!validate_cpu_parameter(param[0], &cpu))
return;
/* first clear the ignore flag on the focused CPU */
cpu->debug()->ignore(false);
/* then loop over CPUs and set the ignore flags on all other CPUs */
- for (device_execute_interface &exec : execute_interface_iterator(machine.root_device()))
+ for (device_execute_interface &exec : execute_interface_iterator(m_machine.root_device()))
if (&exec.device() != cpu)
exec.device().debug()->ignore(true);
- debug_console_printf(machine, "Now focused on CPU '%s'\n", cpu->tag());
+ m_console.printf("Now focused on CPU '%s'\n", cpu->tag());
}
@@ -1021,7 +844,7 @@ static void execute_focus(running_machine &machine, int ref, int params, const c
execute_ignore - execute the ignore command
-------------------------------------------------*/
-static void execute_ignore(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_ignore(int ref, int params, const char *param[])
{
/* if there are no parameters, dump the ignore list */
if (params == 0)
@@ -1029,7 +852,7 @@ static void execute_ignore(running_machine &machine, int ref, int params, const
std::string buffer;
/* loop over all executable devices */
- for (device_execute_interface &exec : execute_interface_iterator(machine.root_device()))
+ for (device_execute_interface &exec : execute_interface_iterator(m_machine.root_device()))
/* build up a comma-separated list */
if (!exec.device().debug()->observing())
@@ -1043,7 +866,7 @@ static void execute_ignore(running_machine &machine, int ref, int params, const
/* special message for none */
if (buffer.empty())
buffer = string_format("Not currently ignoring any devices");
- debug_console_printf(machine, "%s\n", buffer.c_str());
+ m_console.printf("%s\n", buffer.c_str());
}
/* otherwise clear the ignore flag on all requested CPUs */
@@ -1053,7 +876,7 @@ static void execute_ignore(running_machine &machine, int ref, int params, const
/* validate parameters */
for (int paramnum = 0; paramnum < params; paramnum++)
- if (!debug_command_parameter_cpu(machine, param[paramnum], &devicelist[paramnum]))
+ if (!validate_cpu_parameter(param[paramnum], &devicelist[paramnum]))
return;
/* set the ignore flags */
@@ -1061,7 +884,7 @@ static void execute_ignore(running_machine &machine, int ref, int params, const
{
/* make sure this isn't the last live CPU */
bool gotone = false;
- for (device_execute_interface &exec : execute_interface_iterator(machine.root_device()))
+ for (device_execute_interface &exec : execute_interface_iterator(m_machine.root_device()))
if (&exec.device() != devicelist[paramnum] && exec.device().debug()->observing())
{
gotone = true;
@@ -1069,12 +892,12 @@ static void execute_ignore(running_machine &machine, int ref, int params, const
}
if (!gotone)
{
- debug_console_printf(machine, "Can't ignore all devices!\n");
+ m_console.printf("Can't ignore all devices!\n");
return;
}
devicelist[paramnum]->debug()->ignore(true);
- debug_console_printf(machine, "Now ignoring device '%s'\n", devicelist[paramnum]->tag());
+ m_console.printf("Now ignoring device '%s'\n", devicelist[paramnum]->tag());
}
}
}
@@ -1084,7 +907,7 @@ static void execute_ignore(running_machine &machine, int ref, int params, const
execute_observe - execute the observe command
-------------------------------------------------*/
-static void execute_observe(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_observe(int ref, int params, const char *param[])
{
/* if there are no parameters, dump the ignore list */
if (params == 0)
@@ -1092,7 +915,7 @@ static void execute_observe(running_machine &machine, int ref, int params, const
std::string buffer;
/* loop over all executable devices */
- for (device_execute_interface &exec : execute_interface_iterator(machine.root_device()))
+ for (device_execute_interface &exec : execute_interface_iterator(m_machine.root_device()))
/* build up a comma-separated list */
if (exec.device().debug()->observing())
@@ -1106,7 +929,7 @@ static void execute_observe(running_machine &machine, int ref, int params, const
/* special message for none */
if (buffer.empty())
buffer = string_format("Not currently observing any devices");
- debug_console_printf(machine, "%s\n", buffer.c_str());
+ m_console.printf("%s\n", buffer.c_str());
}
/* otherwise set the ignore flag on all requested CPUs */
@@ -1116,14 +939,14 @@ static void execute_observe(running_machine &machine, int ref, int params, const
/* validate parameters */
for (int paramnum = 0; paramnum < params; paramnum++)
- if (!debug_command_parameter_cpu(machine, param[paramnum], &devicelist[paramnum]))
+ if (!validate_cpu_parameter(param[paramnum], &devicelist[paramnum]))
return;
/* clear the ignore flags */
for (int paramnum = 0; paramnum < params; paramnum++)
{
devicelist[paramnum]->debug()->ignore(false);
- debug_console_printf(machine, "Now observing device '%s'\n", devicelist[paramnum]->tag());
+ m_console.printf("Now observing device '%s'\n", devicelist[paramnum]->tag());
}
}
}
@@ -1133,23 +956,23 @@ static void execute_observe(running_machine &machine, int ref, int params, const
execute_comment - add a comment to a line
-------------------------------------------------*/
-static void execute_comment_add(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_comment_add(int ref, int params, const char *param[])
{
device_t *cpu;
UINT64 address;
/* param 1 is the address for the comment */
- if (!debug_command_parameter_number(machine, param[0], &address))
+ if (!validate_number_parameter(param[0], &address))
return;
/* CPU parameter is implicit */
- if (!debug_command_parameter_cpu(machine, nullptr, &cpu))
+ if (!validate_cpu_parameter(nullptr, &cpu))
return;
/* make sure param 2 exists */
if (strlen(param[1]) == 0)
{
- debug_console_printf(machine, "Error : comment text empty\n");
+ m_console.printf("Error : comment text empty\n");
return;
}
@@ -1163,17 +986,17 @@ static void execute_comment_add(running_machine &machine, int ref, int params, c
execute_comment_del - remove a comment from an addr
--------------------------------------------------------*/
-static void execute_comment_del(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_comment_del(int ref, int params, const char *param[])
{
device_t *cpu;
UINT64 address;
/* param 1 can either be a command or the address for the comment */
- if (!debug_command_parameter_number(machine, param[0], &address))
+ if (!validate_number_parameter(param[0], &address))
return;
/* CPU parameter is implicit */
- if (!debug_command_parameter_cpu(machine, nullptr, &cpu))
+ if (!validate_cpu_parameter(nullptr, &cpu))
return;
/* If it's a number, it must be an address */
@@ -1189,10 +1012,10 @@ static void execute_comment_del(running_machine &machine, int ref, int params, c
*
*/
-static void execute_comment_list(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_comment_list(int ref, int params, const char *param[])
{
- if (debug_comment_load(machine,false) == false)
- debug_console_printf(machine, "Error while parsing XML file\n");
+ if (!m_machine.debugger().cpu().comment_load(false))
+ m_console.printf("Error while parsing XML file\n");
}
/**
@@ -1201,22 +1024,22 @@ static void execute_comment_list(running_machine &machine, int ref, int params,
*
*/
-static void execute_comment_commit(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_comment_commit(int ref, int params, const char *param[])
{
- execute_comment_add(machine,ref,params,param);
- execute_comment_save(machine,ref,params,param);
+ execute_comment_add(ref, params, param);
+ execute_comment_save(ref, params, param);
}
/*-------------------------------------------------
execute_comment - add a comment to a line
-------------------------------------------------*/
-static void execute_comment_save(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_comment_save(int ref, int params, const char *param[])
{
- if (debug_comment_save(machine))
- debug_console_printf(machine, "Comment successfully saved\n");
+ if (m_cpu.comment_save())
+ m_console.printf("Comment successfully saved\n");
else
- debug_console_printf(machine, "Comment not saved\n");
+ m_console.printf("Comment not saved\n");
}
// TODO: add color hex editing capabilities for comments, see below for more info
@@ -1238,7 +1061,7 @@ static void execute_comment_save(running_machine &machine, int ref, int params,
command
-------------------------------------------------*/
-static void execute_bpset(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_bpset(int ref, int params, const char *param[])
{
device_t *cpu;
const char *action = nullptr;
@@ -1246,25 +1069,25 @@ static void execute_bpset(running_machine &machine, int ref, int params, const c
int bpnum;
/* CPU is implicit */
- if (!debug_command_parameter_cpu(machine, nullptr, &cpu))
+ if (!validate_cpu_parameter(nullptr, &cpu))
return;
/* param 1 is the address */
- if (!debug_command_parameter_number(machine, param[0], &address))
+ if (!validate_number_parameter(param[0], &address))
return;
/* param 2 is the condition */
parsed_expression condition(&cpu->debug()->symtable());
- if (!debug_command_parameter_expression(machine, param[1], condition))
+ if (!debug_command_parameter_expression(param[1], condition))
return;
/* param 3 is the action */
- if (!debug_command_parameter_command(machine, action = param[2]))
+ if (!debug_command_parameter_command(action = param[2]))
return;
/* set the breakpoint */
bpnum = cpu->debug()->breakpoint_set(address, (condition.is_empty()) ? nullptr : condition.original_string(), action);
- debug_console_printf(machine, "Breakpoint %X set\n", bpnum);
+ m_console.printf("Breakpoint %X set\n", bpnum);
}
@@ -1273,31 +1096,31 @@ static void execute_bpset(running_machine &machine, int ref, int params, const c
clear command
-------------------------------------------------*/
-static void execute_bpclear(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_bpclear(int ref, int params, const char *param[])
{
UINT64 bpindex;
/* if 0 parameters, clear all */
if (params == 0)
{
- for (device_t &device : device_iterator(machine.root_device()))
+ for (device_t &device : device_iterator(m_machine.root_device()))
device.debug()->breakpoint_clear_all();
- debug_console_printf(machine, "Cleared all breakpoints\n");
+ m_console.printf("Cleared all breakpoints\n");
}
/* otherwise, clear the specific one */
- else if (!debug_command_parameter_number(machine, param[0], &bpindex))
+ else if (!validate_number_parameter(param[0], &bpindex))
return;
else
{
bool found = false;
- for (device_t &device : device_iterator(machine.root_device()))
+ for (device_t &device : device_iterator(m_machine.root_device()))
if (device.debug()->breakpoint_clear(bpindex))
found = true;
if (found)
- debug_console_printf(machine, "Breakpoint %X cleared\n", (UINT32)bpindex);
+ m_console.printf("Breakpoint %X cleared\n", (UINT32)bpindex);
else
- debug_console_printf(machine, "Invalid breakpoint number %X\n", (UINT32)bpindex);
+ m_console.printf("Invalid breakpoint number %X\n", (UINT32)bpindex);
}
}
@@ -1307,34 +1130,34 @@ static void execute_bpclear(running_machine &machine, int ref, int params, const
disable/enable commands
-------------------------------------------------*/
-static void execute_bpdisenable(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_bpdisenable(int ref, int params, const char *param[])
{
UINT64 bpindex;
/* if 0 parameters, clear all */
if (params == 0)
{
- for (device_t &device : device_iterator(machine.root_device()))
+ for (device_t &device : device_iterator(m_machine.root_device()))
device.debug()->breakpoint_enable_all(ref);
if (ref == 0)
- debug_console_printf(machine, "Disabled all breakpoints\n");
+ m_console.printf("Disabled all breakpoints\n");
else
- debug_console_printf(machine, "Enabled all breakpoints\n");
+ m_console.printf("Enabled all breakpoints\n");
}
/* otherwise, clear the specific one */
- else if (!debug_command_parameter_number(machine, param[0], &bpindex))
+ else if (!validate_number_parameter(param[0], &bpindex))
return;
else
{
bool found = false;
- for (device_t &device : device_iterator(machine.root_device()))
+ for (device_t &device : device_iterator(m_machine.root_device()))
if (device.debug()->breakpoint_enable(bpindex, ref))
found = true;
if (found)
- debug_console_printf(machine, "Breakpoint %X %s\n", (UINT32)bpindex, ref ? "enabled" : "disabled");
+ m_console.printf("Breakpoint %X %s\n", (UINT32)bpindex, ref ? "enabled" : "disabled");
else
- debug_console_printf(machine, "Invalid breakpoint number %X\n", (UINT32)bpindex);
+ m_console.printf("Invalid breakpoint number %X\n", (UINT32)bpindex);
}
}
@@ -1344,16 +1167,16 @@ static void execute_bpdisenable(running_machine &machine, int ref, int params, c
command
-------------------------------------------------*/
-static void execute_bplist(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_bplist(int ref, int params, const char *param[])
{
int printed = 0;
std::string buffer;
/* loop over all CPUs */
- for (device_t &device : device_iterator(machine.root_device()))
+ for (device_t &device : device_iterator(m_machine.root_device()))
if (device.debug()->breakpoint_first() != nullptr)
{
- debug_console_printf(machine, "Device '%s' breakpoints:\n", device.tag());
+ m_console.printf("Device '%s' breakpoints:\n", device.tag());
/* loop over the breakpoints */
for (device_debug::breakpoint *bp = device.debug()->breakpoint_first(); bp != nullptr; bp = bp->next())
@@ -1363,13 +1186,13 @@ static void execute_bplist(running_machine &machine, int ref, int params, const
buffer.append(string_format(" if %s", bp->condition()));
if (std::string(bp->action()).compare("") != 0)
buffer.append(string_format(" do %s", bp->action()));
- debug_console_printf(machine, "%s\n", buffer.c_str());
+ m_console.printf("%s\n", buffer.c_str());
printed++;
}
}
if (printed == 0)
- debug_console_printf(machine, "No breakpoints currently installed\n");
+ m_console.printf("No breakpoints currently installed\n");
}
@@ -1378,7 +1201,7 @@ static void execute_bplist(running_machine &machine, int ref, int params, const
command
-------------------------------------------------*/
-static void execute_wpset(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_wpset(int ref, int params, const char *param[])
{
address_space *space;
const char *action = nullptr;
@@ -1387,15 +1210,15 @@ static void execute_wpset(running_machine &machine, int ref, int params, const c
int wpnum;
/* CPU is implicit */
- if (!debug_command_parameter_cpu_space(machine, nullptr, ref, space))
+ if (!validate_cpu_space_parameter(nullptr, ref, space))
return;
/* param 1 is the address */
- if (!debug_command_parameter_number(machine, param[0], &address))
+ if (!validate_number_parameter(param[0], &address))
return;
/* param 2 is the length */
- if (!debug_command_parameter_number(machine, param[1], &length))
+ if (!validate_number_parameter(param[1], &length))
return;
/* param 3 is the type */
@@ -1407,22 +1230,22 @@ static void execute_wpset(running_machine &machine, int ref, int params, const c
type = WATCHPOINT_READWRITE;
else
{
- debug_console_printf(machine, "Invalid watchpoint type: expected r, w, or rw\n");
+ m_console.printf("Invalid watchpoint type: expected r, w, or rw\n");
return;
}
/* param 4 is the condition */
parsed_expression condition(&space->device().debug()->symtable());
- if (!debug_command_parameter_expression(machine, param[3], condition))
+ if (!debug_command_parameter_expression(param[3], condition))
return;
/* param 5 is the action */
- if (!debug_command_parameter_command(machine, action = param[4]))
+ if (!debug_command_parameter_command(action = param[4]))
return;
/* set the watchpoint */
wpnum = space->device().debug()->watchpoint_set(*space, type, address, length, (condition.is_empty()) ? nullptr : condition.original_string(), action);
- debug_console_printf(machine, "Watchpoint %X set\n", wpnum);
+ m_console.printf("Watchpoint %X set\n", wpnum);
}
@@ -1431,31 +1254,31 @@ static void execute_wpset(running_machine &machine, int ref, int params, const c
clear command
-------------------------------------------------*/
-static void execute_wpclear(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_wpclear(int ref, int params, const char *param[])
{
UINT64 wpindex;
/* if 0 parameters, clear all */
if (params == 0)
{
- for (device_t &device : device_iterator(machine.root_device()))
+ for (device_t &device : device_iterator(m_machine.root_device()))
device.debug()->watchpoint_clear_all();
- debug_console_printf(machine, "Cleared all watchpoints\n");
+ m_console.printf("Cleared all watchpoints\n");
}
/* otherwise, clear the specific one */
- else if (!debug_command_parameter_number(machine, param[0], &wpindex))
+ else if (!validate_number_parameter(param[0], &wpindex))
return;
else
{
bool found = false;
- for (device_t &device : device_iterator(machine.root_device()))
+ for (device_t &device : device_iterator(m_machine.root_device()))
if (device.debug()->watchpoint_clear(wpindex))
found = true;
if (found)
- debug_console_printf(machine, "Watchpoint %X cleared\n", (UINT32)wpindex);
+ m_console.printf("Watchpoint %X cleared\n", (UINT32)wpindex);
else
- debug_console_printf(machine, "Invalid watchpoint number %X\n", (UINT32)wpindex);
+ m_console.printf("Invalid watchpoint number %X\n", (UINT32)wpindex);
}
}
@@ -1465,34 +1288,34 @@ static void execute_wpclear(running_machine &machine, int ref, int params, const
disable/enable commands
-------------------------------------------------*/
-static void execute_wpdisenable(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_wpdisenable(int ref, int params, const char *param[])
{
UINT64 wpindex;
/* if 0 parameters, clear all */
if (params == 0)
{
- for (device_t &device : device_iterator(machine.root_device()))
+ for (device_t &device : device_iterator(m_machine.root_device()))
device.debug()->watchpoint_enable_all(ref);
if (ref == 0)
- debug_console_printf(machine, "Disabled all watchpoints\n");
+ m_console.printf("Disabled all watchpoints\n");
else
- debug_console_printf(machine, "Enabled all watchpoints\n");
+ m_console.printf("Enabled all watchpoints\n");
}
/* otherwise, clear the specific one */
- else if (!debug_command_parameter_number(machine, param[0], &wpindex))
+ else if (!validate_number_parameter(param[0], &wpindex))
return;
else
{
bool found = false;
- for (device_t &device : device_iterator(machine.root_device()))
+ for (device_t &device : device_iterator(m_machine.root_device()))
if (device.debug()->watchpoint_enable(wpindex, ref))
found = true;
if (found)
- debug_console_printf(machine, "Watchpoint %X %s\n", (UINT32)wpindex, ref ? "enabled" : "disabled");
+ m_console.printf("Watchpoint %X %s\n", (UINT32)wpindex, ref ? "enabled" : "disabled");
else
- debug_console_printf(machine, "Invalid watchpoint number %X\n", (UINT32)wpindex);
+ m_console.printf("Invalid watchpoint number %X\n", (UINT32)wpindex);
}
}
@@ -1502,19 +1325,19 @@ static void execute_wpdisenable(running_machine &machine, int ref, int params, c
command
-------------------------------------------------*/
-static void execute_wplist(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_wplist(int ref, int params, const char *param[])
{
int printed = 0;
std::string buffer;
/* loop over all CPUs */
- for (device_t &device : device_iterator(machine.root_device()))
+ for (device_t &device : device_iterator(m_machine.root_device()))
for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; ++spacenum)
if (device.debug()->watchpoint_first(spacenum) != nullptr)
{
static const char *const types[] = { "unkn ", "read ", "write", "r/w " };
- debug_console_printf(machine, "Device '%s' %s space watchpoints:\n", device.tag(),
+ m_console.printf("Device '%s' %s space watchpoints:\n", device.tag(),
device.debug()->watchpoint_first(spacenum)->space().name());
/* loop over the watchpoints */
@@ -1528,13 +1351,13 @@ static void execute_wplist(running_machine &machine, int ref, int params, const
buffer.append(string_format(" if %s", wp->condition()));
if (std::string(wp->action()).compare("") != 0)
buffer.append(string_format(" do %s", wp->action()));
- debug_console_printf(machine, "%s\n", buffer.c_str());
+ m_console.printf("%s\n", buffer.c_str());
printed++;
}
}
if (printed == 0)
- debug_console_printf(machine, "No watchpoints currently installed\n");
+ m_console.printf("No watchpoints currently installed\n");
}
@@ -1543,28 +1366,28 @@ static void execute_wplist(running_machine &machine, int ref, int params, const
command
-------------------------------------------------*/
-static void execute_rpset(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_rpset(int ref, int params, const char *param[])
{
device_t *cpu;
const char *action = nullptr;
int bpnum;
/* CPU is implicit */
- if (!debug_command_parameter_cpu(machine, nullptr, &cpu))
+ if (!validate_cpu_parameter(nullptr, &cpu))
return;
/* param 1 is the condition */
parsed_expression condition(&cpu->debug()->symtable());
- if (!debug_command_parameter_expression(machine, param[0], condition))
+ if (!debug_command_parameter_expression(param[0], condition))
return;
/* param 2 is the action */
- if (!debug_command_parameter_command(machine, action = param[1]))
+ if (!debug_command_parameter_command(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);
+ m_console.printf("Registerpoint %X set\n", bpnum);
}
@@ -1573,31 +1396,31 @@ static void execute_rpset(running_machine &machine, int ref, int params, const c
clear command
-------------------------------------------------*/
-static void execute_rpclear(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_rpclear(int ref, int params, const char *param[])
{
UINT64 rpindex;
/* if 0 parameters, clear all */
if (params == 0)
{
- for (device_t &device : device_iterator(machine.root_device()))
+ for (device_t &device : device_iterator(m_machine.root_device()))
device.debug()->registerpoint_clear_all();
- debug_console_printf(machine, "Cleared all registerpoints\n");
+ m_console.printf("Cleared all registerpoints\n");
}
/* otherwise, clear the specific one */
- else if (!debug_command_parameter_number(machine, param[0], &rpindex))
+ else if (!validate_number_parameter(param[0], &rpindex))
return;
else
{
bool found = false;
- for (device_t &device : device_iterator(machine.root_device()))
+ for (device_t &device : device_iterator(m_machine.root_device()))
if (device.debug()->registerpoint_clear(rpindex))
found = true;
if (found)
- debug_console_printf(machine, "Registerpoint %X cleared\n", (UINT32)rpindex);
+ m_console.printf("Registerpoint %X cleared\n", (UINT32)rpindex);
else
- debug_console_printf(machine, "Invalid registerpoint number %X\n", (UINT32)rpindex);
+ m_console.printf("Invalid registerpoint number %X\n", (UINT32)rpindex);
}
}
@@ -1607,34 +1430,34 @@ static void execute_rpclear(running_machine &machine, int ref, int params, const
disable/enable commands
-------------------------------------------------*/
-static void execute_rpdisenable(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_rpdisenable(int ref, int params, const char *param[])
{
UINT64 rpindex;
/* if 0 parameters, clear all */
if (params == 0)
{
- for (device_t &device : device_iterator(machine.root_device()))
+ for (device_t &device : device_iterator(m_machine.root_device()))
device.debug()->registerpoint_enable_all(ref);
if (ref == 0)
- debug_console_printf(machine, "Disabled all registerpoints\n");
+ m_console.printf("Disabled all registerpoints\n");
else
- debug_console_printf(machine, "Enabled all registeroints\n");
+ m_console.printf("Enabled all registeroints\n");
}
/* otherwise, clear the specific one */
- else if (!debug_command_parameter_number(machine, param[0], &rpindex))
+ else if (!validate_number_parameter(param[0], &rpindex))
return;
else
{
bool found = false;
- for (device_t &device : device_iterator(machine.root_device()))
+ for (device_t &device : device_iterator(m_machine.root_device()))
if (device.debug()->registerpoint_enable(rpindex, ref))
found = true;
if (found)
- debug_console_printf(machine, "Registerpoint %X %s\n", (UINT32)rpindex, ref ? "enabled" : "disabled");
+ m_console.printf("Registerpoint %X %s\n", (UINT32)rpindex, ref ? "enabled" : "disabled");
else
- debug_console_printf(machine, "Invalid registerpoint number %X\n", (UINT32)rpindex);
+ m_console.printf("Invalid registerpoint number %X\n", (UINT32)rpindex);
}
}
@@ -1644,16 +1467,16 @@ static void execute_rpdisenable(running_machine &machine, int ref, int params, c
command
-------------------------------------------------*/
-static void execute_rplist(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_rplist(int ref, int params, const char *param[])
{
int printed = 0;
std::string buffer;
/* loop over all CPUs */
- for (device_t &device : device_iterator(machine.root_device()))
+ for (device_t &device : device_iterator(m_machine.root_device()))
if (device.debug()->registerpoint_first() != nullptr)
{
- debug_console_printf(machine, "Device '%s' registerpoints:\n", device.tag());
+ m_console.printf("Device '%s' registerpoints:\n", device.tag());
/* loop over the breakpoints */
for (device_debug::registerpoint *rp = device.debug()->registerpoint_first(); rp != nullptr; rp = rp->next())
@@ -1661,13 +1484,13 @@ static void execute_rplist(running_machine &machine, int ref, int params, const
buffer = string_format("%c%4X if %s", rp->enabled() ? ' ' : 'D', rp->index(), rp->condition());
if (rp->action() != nullptr)
buffer.append(string_format(" do %s", rp->action()));
- debug_console_printf(machine, "%s\n", buffer.c_str());
+ m_console.printf("%s\n", buffer.c_str());
printed++;
}
}
if (printed == 0)
- debug_console_printf(machine, "No registerpoints currently installed\n");
+ m_console.printf("No registerpoints currently installed\n");
}
@@ -1676,7 +1499,7 @@ static void execute_rplist(running_machine &machine, int ref, int params, const
command
-------------------------------------------------*/
-static void execute_hotspot(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_hotspot(int ref, int params, const char *param[])
{
/* if no params, and there are live hotspots, clear them */
if (params == 0)
@@ -1684,11 +1507,11 @@ static void execute_hotspot(running_machine &machine, int ref, int params, const
bool cleared = false;
/* loop over CPUs and find live spots */
- for (device_t &device : device_iterator(machine.root_device()))
+ for (device_t &device : device_iterator(m_machine.root_device()))
if (device.debug()->hotspot_tracking_enabled())
{
device.debug()->hotspot_track(0, 0);
- debug_console_printf(machine, "Cleared hotspot tracking on CPU '%s'\n", device.tag());
+ m_console.printf("Cleared hotspot tracking on CPU '%s'\n", device.tag());
cleared = true;
}
@@ -1699,18 +1522,18 @@ static void execute_hotspot(running_machine &machine, int ref, int params, const
/* extract parameters */
device_t *device = nullptr;
- if (!debug_command_parameter_cpu(machine, (params > 0) ? param[0] : nullptr, &device))
+ if (!validate_cpu_parameter((params > 0) ? param[0] : nullptr, &device))
return;
UINT64 count = 64;
- if (!debug_command_parameter_number(machine, param[1], &count))
+ if (!validate_number_parameter(param[1], &count))
return;
UINT64 threshhold = 250;
- if (!debug_command_parameter_number(machine, param[2], &threshhold))
+ if (!validate_number_parameter(param[2], &threshhold))
return;
/* attempt to install */
device->debug()->hotspot_track(count, threshhold);
- debug_console_printf(machine, "Now tracking hotspots on CPU '%s' using %d slots with a threshold of %d\n", device->tag(), (int)count, (int)threshhold);
+ m_console.printf("Now tracking hotspots on CPU '%s' using %d slots with a threshold of %d\n", device->tag(), (int)count, (int)threshhold);
}
@@ -1718,11 +1541,11 @@ static void execute_hotspot(running_machine &machine, int ref, int params, const
execute_statesave - execute the statesave command
-------------------------------------------------*/
-static void execute_statesave(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_statesave(int ref, int params, const char *param[])
{
std::string filename(param[0]);
- machine.immediate_save(filename.c_str());
- debug_console_printf(machine, "State save attempted. Please refer to window message popup for results.\n");
+ m_machine.immediate_save(filename.c_str());
+ m_console.printf("State save attempted. Please refer to window message popup for results.\n");
}
@@ -1730,18 +1553,18 @@ static void execute_statesave(running_machine &machine, int ref, int params, con
execute_stateload - execute the stateload command
-------------------------------------------------*/
-static void execute_stateload(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_stateload(int ref, int params, const char *param[])
{
std::string filename(param[0]);
- machine.immediate_load(filename.c_str());
+ m_machine.immediate_load(filename.c_str());
// Clear all PC & memory tracks
- for (device_t &device : device_iterator(machine.root_device()))
+ for (device_t &device : device_iterator(m_machine.root_device()))
{
device.debug()->track_pc_data_clear();
device.debug()->track_mem_data_clear();
}
- debug_console_printf(machine, "State load attempted. Please refer to window message popup for results.\n");
+ m_console.printf("State load attempted. Please refer to window message popup for results.\n");
}
@@ -1749,7 +1572,7 @@ static void execute_stateload(running_machine &machine, int ref, int params, con
execute_save - execute the save command
-------------------------------------------------*/
-static void execute_save(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_save(int ref, int params, const char *param[])
{
UINT64 offset, endoffset, length;
address_space *space;
@@ -1757,11 +1580,11 @@ static void execute_save(running_machine &machine, int ref, int params, const ch
UINT64 i;
/* validate parameters */
- if (!debug_command_parameter_number(machine, param[1], &offset))
+ if (!validate_number_parameter(param[1], &offset))
return;
- if (!debug_command_parameter_number(machine, param[2], &length))
+ if (!validate_number_parameter(param[2], &length))
return;
- if (!debug_command_parameter_cpu_space(machine, (params > 3) ? param[3] : nullptr, ref, space))
+ if (!validate_cpu_space_parameter((params > 3) ? param[3] : nullptr, ref, space))
return;
/* determine the addresses to write */
@@ -1772,20 +1595,20 @@ static void execute_save(running_machine &machine, int ref, int params, const ch
f = fopen(param[0], "wb");
if (!f)
{
- debug_console_printf(machine, "Error opening file '%s'\n", param[0]);
+ m_console.printf("Error opening file '%s'\n", param[0]);
return;
}
/* now write the data out */
for (i = offset; i <= endoffset; i++)
{
- UINT8 byte = debug_read_byte(*space, i, TRUE);
+ UINT8 byte = m_cpu.read_byte(*space, i, TRUE);
fwrite(&byte, 1, 1, f);
}
/* close the file */
fclose(f);
- debug_console_printf(machine, "Data saved successfully\n");
+ m_console.printf("Data saved successfully\n");
}
@@ -1793,7 +1616,7 @@ static void execute_save(running_machine &machine, int ref, int params, const ch
execute_load - execute the load command
-------------------------------------------------*/
-static void execute_load(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_load(int ref, int params, const char *param[])
{
UINT64 offset, endoffset, length;
address_space *space;
@@ -1801,11 +1624,11 @@ static void execute_load(running_machine &machine, int ref, int params, const ch
UINT64 i;
/* validate parameters */
- if (!debug_command_parameter_number(machine, param[1], &offset))
+ if (!validate_number_parameter(param[1], &offset))
return;
- if (!debug_command_parameter_number(machine, param[2], &length))
+ if (!validate_number_parameter(param[2], &length))
return;
- if (!debug_command_parameter_cpu_space(machine, (params > 3) ? param[3] : nullptr, ref, space))
+ if (!validate_cpu_space_parameter((params > 3) ? param[3] : nullptr, ref, space))
return;
/* determine the addresses to read */
@@ -1816,7 +1639,7 @@ static void execute_load(running_machine &machine, int ref, int params, const ch
f = fopen(param[0], "rb");
if (!f)
{
- debug_console_printf(machine, "Error opening file '%s'\n", param[0]);
+ m_console.printf("Error opening file '%s'\n", param[0]);
return;
}
@@ -1828,14 +1651,14 @@ static void execute_load(running_machine &machine, int ref, int params, const ch
/* check if end of file has been reached and stop loading if it has */
if (feof(f))
break;
- debug_write_byte(*space, i, byte, TRUE);
+ m_cpu.write_byte(*space, i, byte, true);
}
/* close the file */
fclose(f);
if ( i == offset)
- debug_console_printf(machine, "Length specified too large, load failed\n");
+ m_console.printf("Length specified too large, load failed\n");
else
- debug_console_printf(machine, "Data loaded successfully to memory : 0x%X to 0x%X\n", offset, i-1);
+ m_console.printf("Data loaded successfully to memory : 0x%X to 0x%X\n", offset, i-1);
}
@@ -1843,23 +1666,27 @@ static void execute_load(running_machine &machine, int ref, int params, const ch
execute_dump - execute the dump command
-------------------------------------------------*/
-static void execute_dump(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_dump(int ref, int params, const char *param[])
{
- UINT64 offset, endoffset, length, width = 0, ascii = 1;
- address_space *space;
- FILE *f;
- UINT64 i, j;
-
/* validate parameters */
- if (!debug_command_parameter_number(machine, param[1], &offset))
+ UINT64 offset;
+ if (!validate_number_parameter(param[1], &offset))
return;
- if (!debug_command_parameter_number(machine, param[2], &length))
+
+ UINT64 length;
+ if (!validate_number_parameter(param[2], &length))
return;
- if (!debug_command_parameter_number(machine, param[3], &width))
+
+ UINT64 width = 0;
+ if (!validate_number_parameter(param[3], &width))
return;
- if (!debug_command_parameter_number(machine, param[4], &ascii))
+
+ UINT64 ascii = 1;
+ if (!validate_number_parameter(param[4], &ascii))
return;
- if (!debug_command_parameter_cpu_space(machine, (params > 5) ? param[5] : nullptr, ref, space))
+
+ address_space *space;
+ if (!validate_cpu_space_parameter((params > 5) ? param[5] : nullptr, ref, space))
return;
/* further validation */
@@ -1869,24 +1696,24 @@ static void execute_dump(running_machine &machine, int ref, int params, const ch
width = space->address_to_byte(1);
if (width != 1 && width != 2 && width != 4 && width != 8)
{
- debug_console_printf(machine, "Invalid width! (must be 1,2,4 or 8)\n");
+ m_console.printf("Invalid width! (must be 1,2,4 or 8)\n");
return;
}
- endoffset = space->address_to_byte(offset + length - 1) & space->bytemask();
+ UINT64 endoffset = space->address_to_byte(offset + length - 1) & space->bytemask();
offset = space->address_to_byte(offset) & space->bytemask();
/* open the file */
- f = fopen(param[0], "w");
+ FILE* f = fopen(param[0], "w");
if (!f)
{
- debug_console_printf(machine, "Error opening file '%s'\n", param[0]);
+ m_console.printf("Error opening file '%s'\n", param[0]);
return;
}
/* now write the data out */
util::ovectorstream output;
output.reserve(200);
- for (i = offset; i <= endoffset; i += 16)
+ for (UINT64 i = offset; i <= endoffset; i += 16)
{
output.clear();
output.rdbuf()->clear();
@@ -1895,18 +1722,20 @@ static void execute_dump(running_machine &machine, int ref, int params, const ch
util::stream_format(output, "%0*X: ", space->logaddrchars(), (UINT32)space->byte_to_address(i));
/* print the bytes */
- for (j = 0; j < 16; j += width)
+ for (UINT64 j = 0; j < 16; j += width)
{
if (i + j <= endoffset)
{
offs_t curaddr = i + j;
- if (debug_cpu_translate(*space, TRANSLATE_READ_DEBUG, &curaddr))
+ if (m_cpu.translate(*space, TRANSLATE_READ_DEBUG, &curaddr))
{
- UINT64 value = debug_read_memory(*space, i + j, width, TRUE);
+ UINT64 value = m_cpu.read_memory(*space, i + j, width, TRUE);
util::stream_format(output, " %0*X", width * 2, value);
}
else
+ {
util::stream_format(output, " %.*s", width * 2, "****************");
+ }
}
else
util::stream_format(output, " %*s", width * 2, "");
@@ -1916,16 +1745,18 @@ static void execute_dump(running_machine &machine, int ref, int params, const ch
if (ascii)
{
util::stream_format(output, " ");
- for (j = 0; j < 16 && (i + j) <= endoffset; j++)
+ for (UINT64 j = 0; j < 16 && (i + j) <= endoffset; j++)
{
offs_t curaddr = i + j;
- if (debug_cpu_translate(*space, TRANSLATE_READ_DEBUG, &curaddr))
+ if (m_cpu.translate(*space, TRANSLATE_READ_DEBUG, &curaddr))
{
- UINT8 byte = debug_read_byte(*space, i + j, TRUE);
+ UINT8 byte = m_cpu.read_byte(*space, i + j, TRUE);
util::stream_format(output, "%c", (byte >= 32 && byte < 127) ? byte : '.');
}
else
+ {
util::stream_format(output, " ");
+ }
}
}
@@ -1936,7 +1767,7 @@ static void execute_dump(running_machine &machine, int ref, int params, const ch
/* close the file */
fclose(f);
- debug_console_printf(machine, "Data dumped successfully\n");
+ m_console.printf("Data dumped successfully\n");
}
@@ -1944,7 +1775,7 @@ static void execute_dump(running_machine &machine, int ref, int params, const ch
execute_cheatinit - initialize the cheat system
-------------------------------------------------*/
-static void execute_cheatinit(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_cheatinit(int ref, int params, const char *param[])
{
UINT64 offset, length = 0, real_length = 0;
address_space *space;
@@ -1957,46 +1788,46 @@ static void execute_cheatinit(running_machine &machine, int ref, int params, con
memset(cheat_region, 0, sizeof(cheat_region));
/* validate parameters */
- if (!debug_command_parameter_cpu_space(machine, (params > 3) ? param[3] : nullptr, AS_PROGRAM, space))
+ if (!validate_cpu_space_parameter((params > 3) ? param[3] : nullptr, AS_PROGRAM, space))
return;
if (ref == 0)
{
- cheat.width = 1;
- cheat.signed_cheat = FALSE;
- cheat.swapped_cheat = FALSE;
+ m_cheat.width = 1;
+ m_cheat.signed_cheat = FALSE;
+ m_cheat.swapped_cheat = FALSE;
if (params > 0)
{
char *srtpnt = (char*)param[0];
if (*srtpnt == 's')
- cheat.signed_cheat = TRUE;
+ m_cheat.signed_cheat = TRUE;
else if (*srtpnt == 'u')
- cheat.signed_cheat = FALSE;
+ m_cheat.signed_cheat = FALSE;
else
{
- debug_console_printf(machine, "Invalid sign: expected s or u\n");
+ m_console.printf("Invalid sign: expected s or u\n");
return;
}
if (*(++srtpnt) == 'b')
- cheat.width = 1;
+ m_cheat.width = 1;
else if (*srtpnt == 'w')
- cheat.width = 2;
+ m_cheat.width = 2;
else if (*srtpnt == 'd')
- cheat.width = 4;
+ m_cheat.width = 4;
else if (*srtpnt == 'q')
- cheat.width = 8;
+ m_cheat.width = 8;
else
{
- debug_console_printf(machine, "Invalid width: expected b, w, d or q\n");
+ m_console.printf("Invalid width: expected b, w, d or q\n");
return;
}
if (*(++srtpnt) == 's')
- cheat.swapped_cheat = TRUE;
+ m_cheat.swapped_cheat = TRUE;
else
- cheat.swapped_cheat = FALSE;
+ m_cheat.swapped_cheat = FALSE;
}
}
@@ -2023,9 +1854,9 @@ static void execute_cheatinit(running_machine &machine, int ref, int params, con
else
{
/* validate parameters */
- if (!debug_command_parameter_number(machine, param[(ref == 0) ? 1 : 0], &offset))
+ if (!validate_number_parameter(param[(ref == 0) ? 1 : 0], &offset))
return;
- if (!debug_command_parameter_number(machine, param[(ref == 0) ? 2 : 1], &length))
+ if (!validate_number_parameter(param[(ref == 0) ? 2 : 1], &length))
return;
/* force region to the specified range */
@@ -2039,57 +1870,57 @@ static void execute_cheatinit(running_machine &machine, int ref, int params, con
/* determine the writable extent of each region in total */
for (i = 0; i < region_count; i++)
if (!cheat_region[i].disabled)
- for (curaddr = cheat_region[i].offset; curaddr <= cheat_region[i].endoffset; curaddr += cheat.width)
+ for (curaddr = cheat_region[i].offset; curaddr <= cheat_region[i].endoffset; curaddr += m_cheat.width)
if (cheat_address_is_valid(*space, curaddr))
real_length++;
if (real_length == 0)
{
- debug_console_printf(machine, "No writable bytes found in this area\n");
+ m_console.printf("No writable bytes found in this area\n");
return;
}
if (ref == 0)
{
/* initialize new cheat system */
- cheat.cheatmap.resize(real_length);
- cheat.undo = 0;
- cheat.cpu[0] = (params > 3) ? *param[3] : '0';
+ m_cheat.cheatmap.resize(real_length);
+ m_cheat.undo = 0;
+ m_cheat.cpu[0] = (params > 3) ? *param[3] : '0';
}
else
{
/* add range to cheat system */
- if (cheat.cpu[0] == 0)
+ if (m_cheat.cpu[0] == 0)
{
- debug_console_printf(machine, "Use cheatinit before cheatrange\n");
+ m_console.printf("Use cheatinit before cheatrange\n");
return;
}
- if (!debug_command_parameter_cpu_space(machine, cheat.cpu, AS_PROGRAM, space))
+ if (!validate_cpu_space_parameter(m_cheat.cpu, AS_PROGRAM, space))
return;
- active_cheat = cheat.cheatmap.size();
- cheat.cheatmap.resize(cheat.cheatmap.size() + real_length);
+ active_cheat = m_cheat.cheatmap.size();
+ m_cheat.cheatmap.resize(m_cheat.cheatmap.size() + real_length);
}
/* initialize cheatmap in the selected space */
for (i = 0; i < region_count; i++)
if (!cheat_region[i].disabled)
- for (curaddr = cheat_region[i].offset; curaddr <= cheat_region[i].endoffset; curaddr += cheat.width)
+ for (curaddr = cheat_region[i].offset; curaddr <= cheat_region[i].endoffset; curaddr += m_cheat.width)
if (cheat_address_is_valid(*space, curaddr))
{
- cheat.cheatmap[active_cheat].previous_value = cheat_read_extended(&cheat, *space, curaddr);
- cheat.cheatmap[active_cheat].first_value = cheat.cheatmap[active_cheat].previous_value;
- cheat.cheatmap[active_cheat].offset = curaddr;
- cheat.cheatmap[active_cheat].state = 1;
- cheat.cheatmap[active_cheat].undo = 0;
+ m_cheat.cheatmap[active_cheat].previous_value = cheat_read_extended(&m_cheat, *space, curaddr);
+ m_cheat.cheatmap[active_cheat].first_value = m_cheat.cheatmap[active_cheat].previous_value;
+ m_cheat.cheatmap[active_cheat].offset = curaddr;
+ m_cheat.cheatmap[active_cheat].state = 1;
+ m_cheat.cheatmap[active_cheat].undo = 0;
active_cheat++;
}
/* give a detailed init message to avoid searches being mistakingly carried out on the wrong CPU */
device_t *cpu = nullptr;
- debug_command_parameter_cpu(machine, cheat.cpu, &cpu);
- debug_console_printf(machine, "%u cheat initialized for CPU index %s ( aka %s )\n", active_cheat, cheat.cpu, cpu->tag());
+ validate_cpu_parameter(m_cheat.cpu, &cpu);
+ m_console.printf("%u cheat initialized for CPU index %s ( aka %s )\n", active_cheat, m_cheat.cpu, cpu->tag());
}
@@ -2097,7 +1928,7 @@ static void execute_cheatinit(running_machine &machine, int ref, int params, con
execute_cheatnext - execute the search
-------------------------------------------------*/
-static void execute_cheatnext(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_cheatnext(int ref, int params, const char *param[])
{
address_space *space;
UINT64 cheatindex;
@@ -2123,18 +1954,18 @@ static void execute_cheatnext(running_machine &machine, int ref, int params, con
CHEAT_CHANGEDBY
};
- if (cheat.cpu[0] == 0)
+ if (m_cheat.cpu[0] == 0)
{
- debug_console_printf(machine, "Use cheatinit before cheatnext\n");
+ m_console.printf("Use cheatinit before cheatnext\n");
return;
}
- if (!debug_command_parameter_cpu_space(machine, cheat.cpu, AS_PROGRAM, space))
+ if (!validate_cpu_space_parameter(m_cheat.cpu, AS_PROGRAM, space))
return;
- if (params > 1 && !debug_command_parameter_number(machine, param[1], &comp_value))
+ if (params > 1 && !validate_number_parameter(param[1], &comp_value))
return;
- comp_value = cheat_sign_extend(&cheat, comp_value);
+ comp_value = cheat_sign_extend(&m_cheat, comp_value);
/* decode contidion */
if (!strcmp(param[0], "all"))
@@ -2159,18 +1990,18 @@ static void execute_cheatnext(running_machine &machine, int ref, int params, con
condition = CHEAT_CHANGEDBY;
else
{
- debug_console_printf(machine, "Invalid condition type\n");
+ m_console.printf("Invalid condition type\n");
return;
}
- cheat.undo++;
+ m_cheat.undo++;
/* execute the search */
- for (cheatindex = 0; cheatindex < cheat.cheatmap.size(); cheatindex += 1)
- if (cheat.cheatmap[cheatindex].state == 1)
+ for (cheatindex = 0; cheatindex < m_cheat.cheatmap.size(); cheatindex += 1)
+ if (m_cheat.cheatmap[cheatindex].state == 1)
{
- UINT64 cheat_value = cheat_read_extended(&cheat, *space, cheat.cheatmap[cheatindex].offset);
- UINT64 comp_byte = (ref == 0) ? cheat.cheatmap[cheatindex].previous_value : cheat.cheatmap[cheatindex].first_value;
+ UINT64 cheat_value = cheat_read_extended(&m_cheat, *space, m_cheat.cheatmap[cheatindex].offset);
+ UINT64 comp_byte = (ref == 0) ? m_cheat.cheatmap[cheatindex].previous_value : m_cheat.cheatmap[cheatindex].first_value;
UINT8 disable_byte = FALSE;
switch (condition)
@@ -2195,28 +2026,28 @@ static void execute_cheatnext(running_machine &machine, int ref, int params, con
break;
case CHEAT_DECREASE:
- if (cheat.signed_cheat)
+ if (m_cheat.signed_cheat)
disable_byte = ((INT64)cheat_value >= (INT64)comp_byte);
else
disable_byte = ((UINT64)cheat_value >= (UINT64)comp_byte);
break;
case CHEAT_INCREASE:
- if (cheat.signed_cheat)
+ if (m_cheat.signed_cheat)
disable_byte = ((INT64)cheat_value <= (INT64)comp_byte);
else
disable_byte = ((UINT64)cheat_value <= (UINT64)comp_byte);
break;
case CHEAT_DECREASE_OR_EQUAL:
- if (cheat.signed_cheat)
+ if (m_cheat.signed_cheat)
disable_byte = ((INT64)cheat_value > (INT64)comp_byte);
else
disable_byte = ((UINT64)cheat_value > (UINT64)comp_byte);
break;
case CHEAT_INCREASE_OR_EQUAL:
- if (cheat.signed_cheat)
+ if (m_cheat.signed_cheat)
disable_byte = ((INT64)cheat_value < (INT64)comp_byte);
else
disable_byte = ((UINT64)cheat_value < (UINT64)comp_byte);
@@ -2231,14 +2062,14 @@ static void execute_cheatnext(running_machine &machine, int ref, int params, con
break;
case CHEAT_SMALLEROF:
- if (cheat.signed_cheat)
+ if (m_cheat.signed_cheat)
disable_byte = ((INT64)cheat_value >= (INT64)comp_value);
else
disable_byte = ((UINT64)cheat_value >= (UINT64)comp_value);
break;
case CHEAT_GREATEROF:
- if (cheat.signed_cheat)
+ if (m_cheat.signed_cheat)
disable_byte = ((INT64)cheat_value <= (INT64)comp_value);
else
disable_byte = ((UINT64)cheat_value <= (UINT64)comp_value);
@@ -2253,20 +2084,20 @@ static void execute_cheatnext(running_machine &machine, int ref, int params, con
if (disable_byte)
{
- cheat.cheatmap[cheatindex].state = 0;
- cheat.cheatmap[cheatindex].undo = cheat.undo;
+ m_cheat.cheatmap[cheatindex].state = 0;
+ m_cheat.cheatmap[cheatindex].undo = m_cheat.undo;
}
else
active_cheat++;
/* update previous value */
- cheat.cheatmap[cheatindex].previous_value = cheat_value;
+ m_cheat.cheatmap[cheatindex].previous_value = cheat_value;
}
if (active_cheat <= 5)
- execute_cheatlist(machine, 0, 0, nullptr);
+ execute_cheatlist(0, 0, nullptr);
- debug_console_printf(machine, "%u cheats found\n", active_cheat);
+ m_console.printf("%u cheats found\n", active_cheat);
}
@@ -2274,7 +2105,7 @@ static void execute_cheatnext(running_machine &machine, int ref, int params, con
execute_cheatlist - show a list of active cheat
-------------------------------------------------*/
-static void execute_cheatlist(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_cheatlist(int ref, int params, const char *param[])
{
char spaceletter, sizeletter;
address_space *space;
@@ -2284,10 +2115,10 @@ static void execute_cheatlist(running_machine &machine, int ref, int params, con
UINT64 sizemask;
FILE *f = nullptr;
- if (!debug_command_parameter_cpu_space(machine, cheat.cpu, AS_PROGRAM, space))
+ if (!validate_cpu_space_parameter(m_cheat.cpu, AS_PROGRAM, space))
return;
- if (!debug_command_parameter_cpu(machine, cheat.cpu, &cpu))
+ if (!validate_cpu_parameter(m_cheat.cpu, &cpu))
return;
if (params > 0)
@@ -2301,7 +2132,7 @@ static void execute_cheatlist(running_machine &machine, int ref, int params, con
case AS_IO: spaceletter = 'i'; break;
}
- switch (cheat.width)
+ switch (m_cheat.width)
{
default:
case 1: sizeletter = 'b'; sizemask = 0xff; break;
@@ -2312,12 +2143,12 @@ static void execute_cheatlist(running_machine &machine, int ref, int params, con
/* write the cheat list */
util::ovectorstream output;
- for (cheatindex = 0; cheatindex < cheat.cheatmap.size(); cheatindex += 1)
+ for (cheatindex = 0; cheatindex < m_cheat.cheatmap.size(); cheatindex += 1)
{
- if (cheat.cheatmap[cheatindex].state == 1)
+ if (m_cheat.cheatmap[cheatindex].state == 1)
{
- UINT64 value = cheat_byte_swap(&cheat, cheat_read_extended(&cheat, *space, cheat.cheatmap[cheatindex].offset)) & sizemask;
- offs_t address = space->byte_to_address(cheat.cheatmap[cheatindex].offset);
+ UINT64 value = cheat_byte_swap(&m_cheat, cheat_read_extended(&m_cheat, *space, m_cheat.cheatmap[cheatindex].offset)) & sizemask;
+ offs_t address = space->byte_to_address(m_cheat.cheatmap[cheatindex].offset);
if (params > 0)
{
@@ -2331,18 +2162,18 @@ static void execute_cheatlist(running_machine &machine, int ref, int params, con
" <action>%s.p%c%c@%0*X=%0*X</action>\n"
" </script>\n"
" </cheat>\n\n",
- active_cheat, space->logaddrchars(), address, cheat.width * 2, value,
- cpu->tag(), spaceletter, sizeletter, space->logaddrchars(), address, cheat.width * 2, cheat_byte_swap(&cheat, cheat.cheatmap[cheatindex].first_value) & sizemask);
+ active_cheat, space->logaddrchars(), address, m_cheat.width * 2, value,
+ cpu->tag(), spaceletter, sizeletter, space->logaddrchars(), address, m_cheat.width * 2, cheat_byte_swap(&m_cheat, m_cheat.cheatmap[cheatindex].first_value) & sizemask);
auto const &text(output.vec());
fprintf(f, "%.*s", int(unsigned(text.size())), &text[0]);
}
else
{
- debug_console_printf(
- machine, "Address=%0*X Start=%0*X Current=%0*X\n",
+ m_console.printf(
+ "Address=%0*X Start=%0*X Current=%0*X\n",
space->logaddrchars(), address,
- cheat.width * 2, cheat_byte_swap(&cheat, cheat.cheatmap[cheatindex].first_value) & sizemask,
- cheat.width * 2, value);
+ m_cheat.width * 2, cheat_byte_swap(&m_cheat, m_cheat.cheatmap[cheatindex].first_value) & sizemask,
+ m_cheat.width * 2, value);
}
}
}
@@ -2355,28 +2186,28 @@ static void execute_cheatlist(running_machine &machine, int ref, int params, con
execute_cheatundo - undo the last search
-------------------------------------------------*/
-static void execute_cheatundo(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_cheatundo(int ref, int params, const char *param[])
{
UINT64 cheatindex;
UINT32 undo_count = 0;
- if (cheat.undo > 0)
+ if (m_cheat.undo > 0)
{
- for (cheatindex = 0; cheatindex < cheat.cheatmap.size(); cheatindex += 1)
+ for (cheatindex = 0; cheatindex < m_cheat.cheatmap.size(); cheatindex += 1)
{
- if (cheat.cheatmap[cheatindex].undo == cheat.undo)
+ if (m_cheat.cheatmap[cheatindex].undo == m_cheat.undo)
{
- cheat.cheatmap[cheatindex].state = 1;
- cheat.cheatmap[cheatindex].undo = 0;
+ m_cheat.cheatmap[cheatindex].state = 1;
+ m_cheat.cheatmap[cheatindex].undo = 0;
undo_count++;
}
}
- cheat.undo--;
- debug_console_printf(machine, "%u cheat reactivated\n", undo_count);
+ m_cheat.undo--;
+ m_console.printf("%u cheat reactivated\n", undo_count);
}
else
- debug_console_printf(machine, "Maximum undo reached\n");
+ m_console.printf("Maximum undo reached\n");
}
@@ -2384,7 +2215,7 @@ static void execute_cheatundo(running_machine &machine, int ref, int params, con
execute_find - execute the find command
-------------------------------------------------*/
-static void execute_find(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_find(int ref, int params, const char *param[])
{
UINT64 offset, endoffset, length;
address_space *space;
@@ -2396,11 +2227,11 @@ static void execute_find(running_machine &machine, int ref, int params, const ch
int j;
/* validate parameters */
- if (!debug_command_parameter_number(machine, param[0], &offset))
+ if (!validate_number_parameter(param[0], &offset))
return;
- if (!debug_command_parameter_number(machine, param[1], &length))
+ if (!validate_number_parameter(param[1], &length))
return;
- if (!debug_command_parameter_cpu_space(machine, nullptr, ref, space))
+ if (!validate_cpu_space_parameter(nullptr, ref, space))
return;
/* further validation */
@@ -2441,7 +2272,7 @@ static void execute_find(running_machine &machine, int ref, int params, const ch
data_size[data_count++] |= 0x10;
/* otherwise, validate as a number */
- else if (!debug_command_parameter_number(machine, pdata, &data_to_find[data_count++]))
+ else if (!validate_number_parameter(pdata, &data_to_find[data_count++]))
return;
}
}
@@ -2457,10 +2288,10 @@ static void execute_find(running_machine &machine, int ref, int params, const ch
{
switch (data_size[j])
{
- case 1: match = ((UINT8)debug_read_byte(*space, i + suboffset, TRUE) == (UINT8)data_to_find[j]); break;
- case 2: match = ((UINT16)debug_read_word(*space, i + suboffset, TRUE) == (UINT16)data_to_find[j]); break;
- case 4: match = ((UINT32)debug_read_dword(*space, i + suboffset, TRUE) == (UINT32)data_to_find[j]); break;
- case 8: match = ((UINT64)debug_read_qword(*space, i + suboffset, TRUE) == (UINT64)data_to_find[j]); break;
+ case 1: match = ((UINT8)m_cpu.read_byte(*space, i + suboffset, TRUE) == (UINT8)data_to_find[j]); break;
+ case 2: match = ((UINT16)m_cpu.read_word(*space, i + suboffset, TRUE) == (UINT16)data_to_find[j]); break;
+ case 4: match = ((UINT32)m_cpu.read_dword(*space, i + suboffset, TRUE) == (UINT32)data_to_find[j]); break;
+ case 8: match = ((UINT64)m_cpu.read_qword(*space, i + suboffset, TRUE) == (UINT64)data_to_find[j]); break;
default: /* all other cases are wildcards */ break;
}
suboffset += data_size[j] & 0x0f;
@@ -2470,13 +2301,13 @@ static void execute_find(running_machine &machine, int ref, int params, const ch
if (match)
{
found++;
- debug_console_printf(machine, "Found at %0*X\n", space->addrchars(), (UINT32)space->byte_to_address(i));
+ m_console.printf("Found at %0*X\n", space->addrchars(), (UINT32)space->byte_to_address(i));
}
}
/* print something if not found */
if (found == 0)
- debug_console_printf(machine, "Not found\n");
+ m_console.printf("Not found\n");
}
@@ -2484,7 +2315,7 @@ static void execute_find(running_machine &machine, int ref, int params, const ch
execute_dasm - execute the dasm command
-------------------------------------------------*/
-static void execute_dasm(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_dasm(int ref, int params, const char *param[])
{
UINT64 offset, length, bytes = 1;
int minbytes, maxbytes, byteswidth;
@@ -2493,15 +2324,15 @@ static void execute_dasm(running_machine &machine, int ref, int params, const ch
int j;
/* validate parameters */
- if (!debug_command_parameter_number(machine, param[1], &offset))
+ if (!validate_number_parameter(param[1], &offset))
return;
- if (!debug_command_parameter_number(machine, param[2], &length))
+ if (!validate_number_parameter(param[2], &length))
return;
- if (!debug_command_parameter_number(machine, param[3], &bytes))
+ if (!validate_number_parameter(param[3], &bytes))
return;
- if (!debug_command_parameter_cpu_space(machine, (params > 4) ? param[4] : nullptr, AS_PROGRAM, space))
+ if (!validate_cpu_space_parameter((params > 4) ? param[4] : nullptr, AS_PROGRAM, space))
return;
- if (!debug_command_parameter_cpu_space(machine, (params > 4) ? param[4] : nullptr, AS_DECRYPTED_OPCODES, decrypted_space))
+ if (!validate_cpu_space_parameter((params > 4) ? param[4] : nullptr, AS_DECRYPTED_OPCODES, decrypted_space))
decrypted_space = space;
/* determine the width of the bytes */
@@ -2519,7 +2350,7 @@ static void execute_dasm(running_machine &machine, int ref, int params, const ch
f = fopen(param[0], "w");
if (!f)
{
- debug_console_printf(machine, "Error opening file '%s'\n", param[0]);
+ m_console.printf("Error opening file '%s'\n", param[0]);
return;
}
@@ -2541,15 +2372,15 @@ static void execute_dasm(running_machine &machine, int ref, int params, const ch
/* make sure we can translate the address */
tempaddr = pcbyte;
- if (debug_cpu_translate(*space, TRANSLATE_FETCH_DEBUG, &tempaddr))
+ if (m_cpu.translate(*space, TRANSLATE_FETCH_DEBUG, &tempaddr))
{
UINT8 opbuf[64], argbuf[64];
/* fetch the bytes up to the maximum */
for (numbytes = 0; numbytes < maxbytes; numbytes++)
{
- opbuf[numbytes] = debug_read_opcode(*decrypted_space, pcbyte + numbytes, 1);
- argbuf[numbytes] = debug_read_opcode(*space, pcbyte + numbytes, 1);
+ opbuf[numbytes] = m_cpu.read_opcode(*decrypted_space, pcbyte + numbytes, 1);
+ argbuf[numbytes] = m_cpu.read_opcode(*space, pcbyte + numbytes, 1);
}
/* disassemble the result */
@@ -2562,7 +2393,7 @@ static void execute_dasm(running_machine &machine, int ref, int params, const ch
auto const startdex = output.tellp();
numbytes = space->address_to_byte(numbytes);
for (j = 0; j < numbytes; j += minbytes)
- stream_format(output, "%0*X ", minbytes * 2, debug_read_opcode(*decrypted_space, pcbyte + j, minbytes));
+ stream_format(output, "%0*X ", minbytes * 2, m_cpu.read_opcode(*decrypted_space, pcbyte + j, minbytes));
if ((output.tellp() - startdex) < byteswidth)
stream_format(output, "%*s", byteswidth - (output.tellp() - startdex), "");
stream_format(output, " ");
@@ -2594,7 +2425,7 @@ static void execute_dasm(running_machine &machine, int ref, int params, const ch
/* close the file */
fclose(f);
- debug_console_printf(machine, "Data dumped successfully\n");
+ m_console.printf("Data dumped successfully\n");
}
@@ -2603,7 +2434,7 @@ static void execute_dasm(running_machine &machine, int ref, int params, const ch
trace over and trace info
-------------------------------------------------*/
-static void execute_trace_internal(running_machine &machine, int ref, int params, const char *param[], int trace_over)
+void debugger_commands::execute_trace_internal(int ref, int params, const char *param[], bool trace_over)
{
const char *action = nullptr;
device_t *cpu;
@@ -2612,12 +2443,12 @@ static void execute_trace_internal(running_machine &machine, int ref, int params
std::string filename = param[0];
/* replace macros */
- strreplace(filename, "{game}", machine.basename());
+ strreplace(filename, "{game}", m_machine.basename());
/* validate parameters */
- if (!debug_command_parameter_cpu(machine, (params > 1) ? param[1] : nullptr, &cpu))
+ if (!validate_cpu_parameter((params > 1) ? param[1] : nullptr, &cpu))
return;
- if (!debug_command_parameter_command(machine, action = param[2]))
+ if (!debug_command_parameter_command(action = param[2]))
return;
/* open the file */
@@ -2635,7 +2466,7 @@ static void execute_trace_internal(running_machine &machine, int ref, int params
f = fopen(filename.c_str(), mode);
if (!f)
{
- debug_console_printf(machine, "Error opening file '%s'\n", param[0]);
+ m_console.printf("Error opening file '%s'\n", param[0]);
return;
}
}
@@ -2643,9 +2474,9 @@ static void execute_trace_internal(running_machine &machine, int ref, int params
/* do it */
cpu->debug()->trace(f, trace_over, action);
if (f)
- debug_console_printf(machine, "Tracing CPU '%s' to file %s\n", cpu->tag(), filename.c_str());
+ m_console.printf("Tracing CPU '%s' to file %s\n", cpu->tag(), filename.c_str());
else
- debug_console_printf(machine, "Stopped tracing on CPU '%s'\n", cpu->tag());
+ m_console.printf("Stopped tracing on CPU '%s'\n", cpu->tag());
}
@@ -2653,9 +2484,9 @@ static void execute_trace_internal(running_machine &machine, int ref, int params
execute_trace - execute the trace command
-------------------------------------------------*/
-static void execute_trace(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_trace(int ref, int params, const char *param[])
{
- execute_trace_internal(machine, ref, params, param, 0);
+ execute_trace_internal(ref, params, param, false);
}
@@ -2663,9 +2494,9 @@ static void execute_trace(running_machine &machine, int ref, int params, const c
execute_traceover - execute the trace over command
-------------------------------------------------*/
-static void execute_traceover(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_traceover(int ref, int params, const char *param[])
{
- execute_trace_internal(machine, ref, params, param, 1);
+ execute_trace_internal(ref, params, param, true);
}
@@ -2673,9 +2504,9 @@ static void execute_traceover(running_machine &machine, int ref, int params, con
execute_traceflush - execute the trace flush command
-------------------------------------------------*/
-static void execute_traceflush(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_traceflush(int ref, int params, const char *param[])
{
- debug_cpu_flush_traces(machine);
+ m_cpu.flush_traces();
}
@@ -2683,17 +2514,17 @@ static void execute_traceflush(running_machine &machine, int ref, int params, co
execute_history - execute the history command
-------------------------------------------------*/
-static void execute_history(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_history(int ref, int params, const char *param[])
{
/* validate parameters */
address_space *space, *decrypted_space;
- if (!debug_command_parameter_cpu_space(machine, (params > 0) ? param[0] : nullptr, AS_PROGRAM, space))
+ if (!validate_cpu_space_parameter((params > 0) ? param[0] : nullptr, AS_PROGRAM, space))
return;
- if (!debug_command_parameter_cpu_space(machine, (params > 0) ? param[0] : nullptr, AS_DECRYPTED_OPCODES, decrypted_space))
+ if (!validate_cpu_space_parameter((params > 0) ? param[0] : nullptr, AS_DECRYPTED_OPCODES, decrypted_space))
decrypted_space = space;
UINT64 count = device_debug::HISTORY_SIZE;
- if (!debug_command_parameter_number(machine, param[1], &count))
+ if (!validate_number_parameter(param[1], &count))
return;
/* further validation */
@@ -2713,14 +2544,14 @@ static void execute_history(running_machine &machine, int ref, int params, const
UINT8 opbuf[64], argbuf[64];
for (int numbytes = 0; numbytes < maxbytes; numbytes++)
{
- opbuf[numbytes] = debug_read_opcode(*decrypted_space, pcbyte + numbytes, 1);
- argbuf[numbytes] = debug_read_opcode(*space, pcbyte + numbytes, 1);
+ opbuf[numbytes] = m_cpu.read_opcode(*decrypted_space, pcbyte + numbytes, 1);
+ argbuf[numbytes] = m_cpu.read_opcode(*space, pcbyte + numbytes, 1);
}
char buffer[200];
debug->disassemble(buffer, pc, opbuf, argbuf);
- debug_console_printf(machine, "%0*X: %s\n", space->logaddrchars(), pc, buffer);
+ m_console.printf("%0*X: %s\n", space->logaddrchars(), pc, buffer);
}
}
@@ -2729,37 +2560,37 @@ 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[])
+void debugger_commands::execute_trackpc(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))
+ if (!validate_number_parameter(param[0], &turnOn))
return;
// Gather the cpu id (if present)
device_t *cpu = nullptr;
- if (!debug_command_parameter_cpu(machine, (params > 1) ? param[1] : nullptr, &cpu))
+ if (!validate_cpu_parameter((params > 1) ? param[1] : nullptr, &cpu))
return;
// Should we clear the existing data?
UINT64 clear = false;
- if (!debug_command_parameter_number(machine, param[2], &clear))
+ if (!validate_number_parameter(param[2], &clear))
return;
cpu->debug()->set_track_pc((bool)turnOn);
if (turnOn)
{
// Insert current pc
- if (debug_cpu_get_visible_cpu(machine) == cpu)
+ if (m_cpu.get_visible_cpu() == cpu)
{
const offs_t pc = cpu->debug()->pc();
cpu->debug()->set_track_pc_visited(pc);
}
- debug_console_printf(machine, "PC tracking enabled\n");
+ m_console.printf("PC tracking enabled\n");
}
else
{
- debug_console_printf(machine, "PC tracking disabled\n");
+ m_console.printf("PC tracking disabled\n");
}
if (clear)
@@ -2771,26 +2602,26 @@ static void execute_trackpc(running_machine &machine, int ref, int params, const
execute_trackmem - execute the trackmem command
-------------------------------------------------*/
-static void execute_trackmem(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_trackmem(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))
+ if (!validate_number_parameter(param[0], &turnOn))
return;
// Gather the cpu id (if present)
device_t *cpu = nullptr;
- if (!debug_command_parameter_cpu(machine, (params > 1) ? param[1] : nullptr, &cpu))
+ if (!validate_cpu_parameter((params > 1) ? param[1] : nullptr, &cpu))
return;
// Should we clear the existing data?
UINT64 clear = false;
- if (!debug_command_parameter_number(machine, param[2], &clear))
+ if (!validate_number_parameter(param[2], &clear))
return;
// Get the address space for the given cpu
address_space *space;
- if (!debug_command_parameter_cpu_space(machine, (params > 1) ? param[1] : nullptr, AS_PROGRAM, space))
+ if (!validate_cpu_space_parameter((params > 1) ? param[1] : nullptr, AS_PROGRAM, space))
return;
// Inform the CPU it's time to start tracking memory writes
@@ -2809,37 +2640,34 @@ static void execute_trackmem(running_machine &machine, int ref, int params, cons
execute_pcatmem - execute the pcatmem command
-------------------------------------------------*/
-static void execute_pcatmem(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_pcatmem(int ref, int params, const char *param[])
{
// Gather the required address parameter
UINT64 address;
- if (!debug_command_parameter_number(machine, param[0], &address))
+ if (!validate_number_parameter(param[0], &address))
return;
// Gather the cpu id (if present)
device_t *cpu = nullptr;
- if (!debug_command_parameter_cpu(machine, (params > 1) ? param[1] : nullptr, &cpu))
+ if (!validate_cpu_parameter((params > 1) ? param[1] : nullptr, &cpu))
return;
// Get the address space for the given cpu
address_space *space;
- if (!debug_command_parameter_cpu_space(machine, (params > 1) ? param[1] : nullptr, ref, space))
+ if (!validate_cpu_space_parameter((params > 1) ? param[1] : nullptr, ref, space))
return;
// Get the value of memory at the address
- const int nativeDataWidth = space->data_width() / 8;
- const UINT64 data = debug_read_memory(*space,
- space->address_to_byte(address),
- nativeDataWidth,
- true);
+ const int native_data_width = space->data_width() / 8;
+ const UINT64 data = m_cpu.read_memory(*space, space->address_to_byte(address), native_data_width, true);
// Recover the pc & print
- const address_spacenum spaceNum = (address_spacenum)ref;
- const offs_t result = space->device().debug()->track_mem_pc_from_space_address_data(spaceNum, address, data);
+ const address_spacenum space_num = (address_spacenum)ref;
+ const offs_t result = space->device().debug()->track_mem_pc_from_space_address_data(space_num, address, data);
if (result != (offs_t)(-1))
- debug_console_printf(machine, "%02x\n", result);
+ m_console.printf("%02x\n", result);
else
- debug_console_printf(machine, "UNKNOWN PC\n");
+ m_console.printf("UNKNOWN PC\n");
}
@@ -2847,13 +2675,13 @@ static void execute_pcatmem(running_machine &machine, int ref, int params, const
execute_snap - execute the snapshot command
-------------------------------------------------*/
-static void execute_snap(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_snap(int ref, int params, const char *param[])
{
/* if no params, use the default behavior */
if (params == 0)
{
- machine.video().save_active_screen_snapshots();
- debug_console_printf(machine, "Saved snapshot\n");
+ m_machine.video().save_active_screen_snapshots();
+ m_console.printf("Saved snapshot\n");
}
/* otherwise, we have to open the file ourselves */
@@ -2862,29 +2690,29 @@ static void execute_snap(running_machine &machine, int ref, int params, const ch
const char *filename = param[0];
int scrnum = (params > 1) ? atoi(param[1]) : 0;
- screen_device_iterator iter(machine.root_device());
+ screen_device_iterator iter(m_machine.root_device());
screen_device *screen = iter.byindex(scrnum);
- if ((screen == nullptr) || !machine.render().is_live(*screen))
+ if ((screen == nullptr) || !m_machine.render().is_live(*screen))
{
- debug_console_printf(machine, "Invalid screen number '%d'\n", scrnum);
+ m_console.printf("Invalid screen number '%d'\n", scrnum);
return;
}
std::string fname(filename);
if (fname.find(".png") == -1)
fname.append(".png");
- emu_file file(machine.options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
+ emu_file file(m_machine.options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
osd_file::error filerr = file.open(fname.c_str());
if (filerr != osd_file::error::NONE)
{
- debug_console_printf(machine, "Error creating file '%s'\n", filename);
+ m_console.printf("Error creating file '%s'\n", filename);
return;
}
screen->machine().video().save_snapshot(screen, file);
- debug_console_printf(machine, "Saved screen #%d snapshot as '%s'\n", scrnum, filename);
+ m_console.printf("Saved screen #%d snapshot as '%s'\n", scrnum, filename);
}
}
@@ -2893,9 +2721,9 @@ static void execute_snap(running_machine &machine, int ref, int params, const ch
execute_source - execute the source command
-------------------------------------------------*/
-static void execute_source(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_source(int ref, int params, const char *param[])
{
- debug_cpu_source_script(machine, param[0]);
+ m_cpu.source_script(param[0]);
}
@@ -2903,7 +2731,7 @@ static void execute_source(running_machine &machine, int ref, int params, const
execute_map - execute the map command
-------------------------------------------------*/
-static void execute_map(running_machine &machine, int ref, int params, const char *param[])
+void debugger_commands::execute_map(int ref, int params, const char *param[])
{
address_space *space;
offs_t taddress;
@@ -2911,11 +2739,11 @@ static void execute_map(running_machine &machine, int ref, int params, const cha
int intention;
/* validate parameters */
- if (!debug_command_parameter_number(machine, param[0], &address))
+ if (!validate_number_parameter(param[0], &address))
return;
/* CPU is implicit */
- if (!debug_command_parameter_cpu_space(machine, nullptr, ref, space))
+ if (!validate_cpu_space_parameter(nullptr, ref, space))
return;
/* do the translation first */
@@ -2923,18 +2751,18 @@ static void execute_map(running_machine &machine, int ref, int params, const cha
{
static const char *const intnames[] = { "Read", "Write", "Fetch" };
taddress = space->address_to_byte(address) & space->bytemask();
- if (debug_cpu_translate(*space, intention, &taddress))
+ if (m_cpu.translate(*space, intention, &taddress))
{
const char *mapname = space->get_handler_string((intention == TRANSLATE_WRITE_DEBUG) ? ROW_WRITE : ROW_READ, taddress);
- debug_console_printf(
- machine, "%7s: %0*X logical == %0*X physical -> %s\n",
+ m_console.printf(
+ "%7s: %0*X logical == %0*X physical -> %s\n",
intnames[intention & 3],
space->logaddrchars(), address,
space->addrchars(), space->byte_to_address(taddress),
mapname);
}
else
- debug_console_printf(machine, "%7s: %0*X logical is unmapped\n", intnames[intention & 3], space->logaddrchars(), address);
+ m_console.printf("%7s: %0*X logical is unmapped\n", intnames[intention & 3], space->logaddrchars(), address);
}
}
@@ -2943,19 +2771,19 @@ static void execute_map(running_machine &machine, int ref, int params, const cha
execute_memdump - execute the memdump command
-------------------------------------------------*/
-static void execute_memdump(running_machine &machine, int ref, int params, const char **param)
+void debugger_commands::execute_memdump(int ref, int params, const char **param)
{
FILE *file;
const char *filename;
filename = (params == 0) ? "memdump.log" : param[0];
- debug_console_printf(machine, "Dumping memory to %s\n", filename);
+ m_console.printf("Dumping memory to %s\n", filename);
file = fopen(filename, "w");
if (file)
{
- machine.memory().dump(file);
+ m_machine.memory().dump(file);
fclose(file);
}
}
@@ -2972,7 +2800,7 @@ static int CLIB_DECL symbol_sort_compare(const void *item1, const void *item2)
return strcmp(str1, str2);
}
-static void execute_symlist(running_machine &machine, int ref, int params, const char **param)
+void debugger_commands::execute_symlist(int ref, int params, const char **param)
{
device_t *cpu = nullptr;
const char *namelist[1000];
@@ -2983,15 +2811,15 @@ static void execute_symlist(running_machine &machine, int ref, int params, const
if (param[0] != nullptr)
{
/* validate parameters */
- if (!debug_command_parameter_cpu(machine, param[0], &cpu))
+ if (!validate_cpu_parameter(param[0], &cpu))
return;
symtable = &cpu->debug()->symtable();
- debug_console_printf(machine, "CPU '%s' symbols:\n", cpu->tag());
+ m_console.printf("CPU '%s' symbols:\n", cpu->tag());
}
else
{
- symtable = debug_cpu_get_global_symtable(machine);
- debug_console_printf(machine, "Global symbols:\n");
+ symtable = m_cpu.get_global_symtable();
+ m_console.printf("Global symbols:\n");
}
/* gather names for all symbols */
@@ -3018,10 +2846,10 @@ static void execute_symlist(running_machine &machine, int ref, int params, const
UINT64 value = entry->value();
/* only display "register" type symbols */
- debug_console_printf(machine, "%s = %X", namelist[symnum], value);
+ m_console.printf("%s = %X", namelist[symnum], value);
if (!entry->is_lval())
- debug_console_printf(machine, " (read-only)");
- debug_console_printf(machine, "\n");
+ m_console.printf(" (read-only)");
+ m_console.printf("\n");
}
}
@@ -3030,9 +2858,9 @@ static void execute_symlist(running_machine &machine, int ref, int params, const
execute_softreset - execute the softreset command
-------------------------------------------------*/
-static void execute_softreset(running_machine &machine, int ref, int params, const char **param)
+void debugger_commands::execute_softreset(int ref, int params, const char **param)
{
- machine.schedule_soft_reset();
+ m_machine.schedule_soft_reset();
}
@@ -3040,9 +2868,9 @@ static void execute_softreset(running_machine &machine, int ref, int params, con
execute_hardreset - execute the hardreset command
-------------------------------------------------*/
-static void execute_hardreset(running_machine &machine, int ref, int params, const char **param)
+void debugger_commands::execute_hardreset(int ref, int params, const char **param)
{
- machine.schedule_hard_reset();
+ m_machine.schedule_hard_reset();
}
/*-------------------------------------------------
@@ -3050,57 +2878,57 @@ static void execute_hardreset(running_machine &machine, int ref, int params, con
mounted files
-------------------------------------------------*/
-static void execute_images(running_machine &machine, int ref, int params, const char **param)
+void debugger_commands::execute_images(int ref, int params, const char **param)
{
- image_interface_iterator iter(machine.root_device());
+ image_interface_iterator iter(m_machine.root_device());
for (device_image_interface &img : iter)
- debug_console_printf(machine, "%s: %s\n", img.brief_instance_name(), img.exists() ? img.filename() : "[empty slot]");
+ m_console.printf("%s: %s\n", img.brief_instance_name(), img.exists() ? img.filename() : "[empty slot]");
if (iter.first() == nullptr)
- debug_console_printf(machine, "No image devices in this driver\n");
+ m_console.printf("No image devices in this driver\n");
}
/*-------------------------------------------------
execute_mount - execute the image mount command
-------------------------------------------------*/
-static void execute_mount(running_machine &machine, int ref, int params, const char **param)
+void debugger_commands::execute_mount(int ref, int params, const char **param)
{
bool done = false;
- for (device_image_interface &img : image_interface_iterator(machine.root_device()))
+ for (device_image_interface &img : image_interface_iterator(m_machine.root_device()))
{
if (strcmp(img.brief_instance_name(),param[0]) == 0)
{
if (img.load(param[1])==IMAGE_INIT_FAIL)
- debug_console_printf(machine, "Unable to mount file %s on %s\n",param[1],param[0]);
+ m_console.printf("Unable to mount file %s on %s\n",param[1],param[0]);
else
- debug_console_printf(machine, "File %s mounted on %s\n",param[1],param[0]);
+ m_console.printf("File %s mounted on %s\n",param[1],param[0]);
done = true;
break;
}
}
if (!done)
- debug_console_printf(machine, "There is no image device :%s\n",param[0]);
+ m_console.printf("There is no image device :%s\n",param[0]);
}
/*-------------------------------------------------
execute_unmount - execute the image unmount command
-------------------------------------------------*/
-static void execute_unmount(running_machine &machine, int ref, int params, const char **param)
+void debugger_commands::execute_unmount(int ref, int params, const char **param)
{
bool done = false;
- for (device_image_interface &img : image_interface_iterator(machine.root_device()))
+ for (device_image_interface &img : image_interface_iterator(m_machine.root_device()))
{
if (strcmp(img.brief_instance_name(),param[0]) == 0)
{
img.unload();
- debug_console_printf(machine, "Unmounted file from : %s\n",param[0]);
+ m_console.printf("Unmounted file from : %s\n",param[0]);
done = true;
break;
}
}
if (!done)
- debug_console_printf(machine, "There is no image device :%s\n",param[0]);
+ m_console.printf("There is no image device :%s\n",param[0]);
}
@@ -3109,9 +2937,9 @@ static void execute_unmount(running_machine &machine, int ref, int params, const
natural keyboard input
-------------------------------------------------*/
-static void execute_input(running_machine &machine, int ref, int params, const char **param)
+void debugger_commands::execute_input(int ref, int params, const char **param)
{
- machine.ioport().natkeyboard().post_coded(param[0]);
+ m_machine.ioport().natkeyboard().post_coded(param[0]);
}
@@ -3120,7 +2948,7 @@ static void execute_input(running_machine &machine, int ref, int params, const c
keyboard codes
-------------------------------------------------*/
-static void execute_dumpkbd(running_machine &machine, int ref, int params, const char **param)
+void debugger_commands::execute_dumpkbd(int ref, int params, const char **param)
{
// was there a file specified?
const char *filename = (params > 0) ? param[0] : nullptr;
@@ -3131,19 +2959,19 @@ static void execute_dumpkbd(running_machine &machine, int ref, int params, const
file = fopen(filename, "w");
if (file == nullptr)
{
- debug_console_printf(machine, "Cannot open \"%s\"\n", filename);
+ m_console.printf("Cannot open \"%s\"\n", filename);
return;
}
}
// loop through all codes
- std::string buffer = machine.ioport().natkeyboard().dump();
+ std::string buffer = m_machine.ioport().natkeyboard().dump();
// and output it as appropriate
if (file != nullptr)
fprintf(file, "%s\n", buffer.c_str());
else
- debug_console_printf(machine, "%s\n", buffer.c_str());
+ m_console.printf("%s\n", buffer.c_str());
// cleanup
if (file != nullptr)