summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/debug/debugcmd.h
diff options
context:
space:
mode:
author Vas Crabb <cuavas@users.noreply.github.com>2021-10-01 05:26:11 +1000
committer GitHub <noreply@github.com>2021-10-01 05:26:11 +1000
commit360d3a5950f0649270822e2db1ea25028eabd18b (patch)
tree8019fee8da58f31e84889088935c09ff3eec4cd6 /src/emu/debug/debugcmd.h
parent6eee76c1a0c7e4f317bf55dde5ddb2d25356b6be (diff)
debugger: Extended target address syntax to include device/address space. (#8630)
Added a validity check to ensure address space names are tag-like and unique, since they're now used as identifiers in debugger commands. Extended the syntax for target addresses to allow them to be qualified with a colon followed by an optional device tag and/or address space name. If only the device needs to be specified, a debugger CPU number may also be used. This makes commands like bpset and wpset more flexible, as they can operate on CPUs other than the currently visible CPU. Commands like find, fill, dump and load are more flexible as they can access any space of any device. Removed now-redundant CPU parameters from many commands, and renamed pcatmemp to pcatmem for consistency with other commands. Extended region syntax for saver/loadr to support tags relative to the visible CPU (e.g. you can use "." for the region with the same name as the visible CPU, or "^sibling" syntax). Added an optional root device parameter to memdump. Changed interpretation of Boolean values to support numeric expressions as well as true/false strings and literal 1/0. Added checks that the specified device is CPU-like to various commands that require a CPU (e.g. focus). Previously these commands would crash or trigger an assertion failure if a tag for a non-CPU devices was specified. Fixed the cpunum symbol so it uses the same rules for determining what is or isn't a CPU as parameter parsing. Made device_t sanitise subtags better. Previously you could cause an assertion failure or crash MAME by giving it unexpected relative tags via Lua or the debugger. Added help topic alias support, and reworked the data structures to improve the performance of looking up debugger commands and help topics. Removed the "ref" parameter from debugger command functions (std::bind can hold extra argument values for you if you need them). Also added an error message if duplicate debugger commands are registered. Updated help for commands that changed syntax, and also updated summaries for some commands that had changed in the past without corresponding help updates.
Diffstat (limited to 'src/emu/debug/debugcmd.h')
-rw-r--r--src/emu/debug/debugcmd.h199
1 files changed, 100 insertions, 99 deletions
diff --git a/src/emu/debug/debugcmd.h b/src/emu/debug/debugcmd.h
index 7ed81ce9f00..6c389644df2 100644
--- a/src/emu/debug/debugcmd.h
+++ b/src/emu/debug/debugcmd.h
@@ -16,26 +16,34 @@
#include "debugcpu.h"
#include "debugcon.h"
+#include <string_view>
+
class debugger_commands
{
public:
- debugger_commands(running_machine& machine, debugger_cpu& cpu, debugger_console& console);
+ debugger_commands(running_machine &machine, debugger_cpu &cpu, debugger_console &console);
- /* validates a parameter as a boolean value */
+ // validates a parameter as a boolean value
bool validate_boolean_parameter(const std::string &param, bool &result);
- /* validates a parameter as a numeric value */
- bool validate_number_parameter(const std::string &param, u64 &result);
+ // validates a parameter as a numeric value
+ bool validate_number_parameter(std::string_view param, u64 &result);
+
+ // validates a parameter as a device
+ bool validate_device_parameter(std::string_view param, device_t *&result);
- /* validates a parameter as a cpu */
- bool validate_cpu_parameter(const char *param, device_t *&result);
+ // validates a parameter as a CPU
+ bool validate_cpu_parameter(std::string_view param, device_t *&result);
- /* validates a parameter as a cpu and retrieves the given address space */
- bool validate_cpu_space_parameter(const char *param, int spacenum, address_space *&result);
+ // validates a parameter as an address space identifier
+ bool validate_device_space_parameter(std::string_view param, int spacenum, address_space *&result);
- /* validates a parameter as a memory region name and retrieves the given region */
- bool validate_memory_region_parameter(const std::string &param, memory_region *&result);
+ // validates a parameter as a target address and retrieves the given address space and address
+ bool validate_target_address_parameter(std::string_view param, int spacenum, address_space *&space, u64 &addr);
+
+ // validates a parameter as a memory region name and retrieves the given region
+ bool validate_memory_region_parameter(std::string_view param, memory_region *&result);
private:
struct global_entry
@@ -67,7 +75,6 @@ private:
u8 swapped_cheat;
};
-
struct cheat_region_map
{
u64 offset;
@@ -76,7 +83,9 @@ private:
u8 disabled;
};
- bool debug_command_parameter_expression(const std::string &param, parsed_expression &result);
+ device_t &get_device_search_base(std::string_view &param);
+ device_t *get_cpu_by_index(u64 cpunum);
+ bool debug_command_parameter_expression(std::string_view param, parsed_expression &result);
bool debug_command_parameter_command(const char *param);
bool cheat_address_is_valid(address_space &space, offs_t address);
@@ -84,14 +93,6 @@ private:
u64 cheat_byte_swap(const cheat_system *cheatsys, u64 value);
u64 cheat_read_extended(const cheat_system *cheatsys, address_space &space, offs_t address);
- u64 execute_min(int params, const u64 *param);
- u64 execute_max(int params, const u64 *param);
- u64 execute_if(int params, const u64 *param);
- u64 execute_abs(int params, const u64 *param);
- u64 execute_bit(int params, const u64 *param);
- u64 execute_s8(int params, const u64 *param);
- u64 execute_s16(int params, const u64 *param);
- u64 execute_s32(int params, const u64 *param);
u64 get_cpunum();
u64 global_get(global_entry *global);
@@ -99,85 +100,85 @@ private:
int mini_printf(char *buffer, const char *format, int params, u64 *param);
- void execute_trace_internal(int ref, const std::vector<std::string> &params, bool trace_over);
-
- void execute_help(int ref, const std::vector<std::string> &params);
- void execute_print(int ref, const std::vector<std::string> &params);
- void execute_printf(int ref, const std::vector<std::string> &params);
- void execute_logerror(int ref, const std::vector<std::string> &params);
- void execute_tracelog(int ref, const std::vector<std::string> &params);
- void execute_tracesym(int ref, const std::vector<std::string> &params);
- void execute_cls(int ref, const std::vector<std::string> &params);
- void execute_quit(int ref, const std::vector<std::string> &params);
- void execute_do(int ref, const std::vector<std::string> &params);
- void execute_step(int ref, const std::vector<std::string> &params);
- void execute_over(int ref, const std::vector<std::string> &params);
- void execute_out(int ref, const std::vector<std::string> &params);
- void execute_go(int ref, const std::vector<std::string> &params);
- void execute_go_vblank(int ref, const std::vector<std::string> &params);
- void execute_go_interrupt(int ref, const std::vector<std::string> &params);
- void execute_go_exception(int ref, const std::vector<std::string> &params);
- void execute_go_time(int ref, const std::vector<std::string> &params);
- void execute_go_privilege(int ref, const std::vector<std::string> &params);
- void execute_focus(int ref, const std::vector<std::string> &params);
- void execute_ignore(int ref, const std::vector<std::string> &params);
- void execute_observe(int ref, const std::vector<std::string> &params);
- void execute_suspend(int ref, const std::vector<std::string> &params);
- void execute_resume(int ref, const std::vector<std::string> &params);
- void execute_next(int ref, const std::vector<std::string> &params);
- void execute_cpulist(int ref, const std::vector<std::string> &params);
- void execute_comment_add(int ref, const std::vector<std::string> &params);
- void execute_comment_del(int ref, const std::vector<std::string> &params);
- void execute_comment_save(int ref, const std::vector<std::string> &params);
- void execute_comment_list(int ref, const std::vector<std::string> &params);
- void execute_comment_commit(int ref, const std::vector<std::string> &params);
- void execute_bpset(int ref, const std::vector<std::string> &params);
- void execute_bpclear(int ref, const std::vector<std::string> &params);
- void execute_bpdisenable(int ref, const std::vector<std::string> &params);
- void execute_bplist(int ref, const std::vector<std::string> &params);
- void execute_wpset(int ref, const std::vector<std::string> &params);
- void execute_wpclear(int ref, const std::vector<std::string> &params);
- void execute_wpdisenable(int ref, const std::vector<std::string> &params);
- void execute_wplist(int ref, const std::vector<std::string> &params);
- void execute_rpset(int ref, const std::vector<std::string> &params);
- void execute_rpclear(int ref, const std::vector<std::string> &params);
- void execute_rpdisenable(int ref, const std::vector<std::string> &params);
- void execute_rplist(int ref, const std::vector<std::string> &params);
- void execute_statesave(int ref, const std::vector<std::string> &params);
- void execute_stateload(int ref, const std::vector<std::string> &params);
- void execute_rewind(int ref, const std::vector<std::string> &params);
- void execute_save(int ref, const std::vector<std::string> &params);
- void execute_saveregion(int ref, const std::vector<std::string> &params);
- void execute_load(int ref, const std::vector<std::string> &params);
- void execute_loadregion(int ref, const std::vector<std::string> &params);
- void execute_dump(int ref, const std::vector<std::string> &params);
- void execute_strdump(int ref, const std::vector<std::string> &params);
- void execute_cheatinit(int ref, const std::vector<std::string> &params);
- void execute_cheatnext(int ref, const std::vector<std::string> &params);
- void execute_cheatlist(int ref, const std::vector<std::string> &params);
- void execute_cheatundo(int ref, const std::vector<std::string> &params);
- void execute_dasm(int ref, const std::vector<std::string> &params);
- void execute_find(int ref, const std::vector<std::string> &params);
- void execute_fill(int ref, const std::vector<std::string> &params);
- void execute_trace(int ref, const std::vector<std::string> &params);
- void execute_traceover(int ref, const std::vector<std::string> &params);
- void execute_traceflush(int ref, const std::vector<std::string> &params);
- void execute_history(int ref, const std::vector<std::string> &params);
- void execute_trackpc(int ref, const std::vector<std::string> &params);
- void execute_trackmem(int ref, const std::vector<std::string> &params);
- void execute_pcatmem(int ref, const std::vector<std::string> &params);
- void execute_snap(int ref, const std::vector<std::string> &params);
- void execute_source(int ref, const std::vector<std::string> &params);
- void execute_map(int ref, const std::vector<std::string> &params);
- void execute_memdump(int ref, const std::vector<std::string> &params);
- void execute_symlist(int ref, const std::vector<std::string> &params);
- void execute_softreset(int ref, const std::vector<std::string> &params);
- void execute_hardreset(int ref, const std::vector<std::string> &params);
- void execute_images(int ref, const std::vector<std::string> &params);
- void execute_mount(int ref, const std::vector<std::string> &params);
- void execute_unmount(int ref, const std::vector<std::string> &params);
- void execute_input(int ref, const std::vector<std::string> &params);
- void execute_dumpkbd(int ref, const std::vector<std::string> &params);
+ void execute_trace_internal(const std::vector<std::string> &params, bool trace_over);
+
+ void execute_help(const std::vector<std::string> &params);
+ void execute_print(const std::vector<std::string> &params);
+ void execute_printf(const std::vector<std::string> &params);
+ void execute_logerror(const std::vector<std::string> &params);
+ void execute_tracelog(const std::vector<std::string> &params);
+ void execute_tracesym(const std::vector<std::string> &params);
+ void execute_cls(const std::vector<std::string> &params);
+ void execute_quit(const std::vector<std::string> &params);
+ void execute_do(const std::vector<std::string> &params);
+ void execute_step(const std::vector<std::string> &params);
+ void execute_over(const std::vector<std::string> &params);
+ void execute_out(const std::vector<std::string> &params);
+ void execute_go(const std::vector<std::string> &params);
+ void execute_go_vblank(const std::vector<std::string> &params);
+ void execute_go_interrupt(const std::vector<std::string> &params);
+ void execute_go_exception(const std::vector<std::string> &params);
+ void execute_go_time(const std::vector<std::string> &params);
+ void execute_go_privilege(const std::vector<std::string> &params);
+ void execute_focus(const std::vector<std::string> &params);
+ void execute_ignore(const std::vector<std::string> &params);
+ void execute_observe(const std::vector<std::string> &params);
+ void execute_suspend(const std::vector<std::string> &params);
+ void execute_resume(const std::vector<std::string> &params);
+ void execute_next(const std::vector<std::string> &params);
+ void execute_cpulist(const std::vector<std::string> &params);
+ void execute_comment_add(const std::vector<std::string> &params);
+ void execute_comment_del(const std::vector<std::string> &params);
+ void execute_comment_save(const std::vector<std::string> &params);
+ void execute_comment_list(const std::vector<std::string> &params);
+ void execute_comment_commit(const std::vector<std::string> &params);
+ void execute_bpset(const std::vector<std::string> &params);
+ void execute_bpclear(const std::vector<std::string> &params);
+ void execute_bpdisenable(bool enable, const std::vector<std::string> &params);
+ void execute_bplist(const std::vector<std::string> &params);
+ void execute_wpset(int spacenum, const std::vector<std::string> &params);
+ void execute_wpclear(const std::vector<std::string> &params);
+ void execute_wpdisenable(bool enable, const std::vector<std::string> &params);
+ void execute_wplist(const std::vector<std::string> &params);
+ void execute_rpset(const std::vector<std::string> &params);
+ void execute_rpclear(const std::vector<std::string> &params);
+ void execute_rpdisenable(bool enable, const std::vector<std::string> &params);
+ void execute_rplist(const std::vector<std::string> &params);
+ void execute_statesave(const std::vector<std::string> &params);
+ void execute_stateload(const std::vector<std::string> &params);
+ void execute_rewind(const std::vector<std::string> &params);
+ void execute_save(int spacenum, const std::vector<std::string> &params);
+ void execute_saveregion(const std::vector<std::string> &params);
+ void execute_load(int spacenum, const std::vector<std::string> &params);
+ void execute_loadregion(const std::vector<std::string> &params);
+ void execute_dump(int spacenum, const std::vector<std::string> &params);
+ void execute_strdump(int spacenum, const std::vector<std::string> &params);
+ void execute_cheatrange(bool init, const std::vector<std::string> &params);
+ void execute_cheatnext(bool initial, const std::vector<std::string> &params);
+ void execute_cheatlist(const std::vector<std::string> &params);
+ void execute_cheatundo(const std::vector<std::string> &params);
+ void execute_dasm(const std::vector<std::string> &params);
+ void execute_find(int spacenum, const std::vector<std::string> &params);
+ void execute_fill(int spacenum, const std::vector<std::string> &params);
+ void execute_trace(const std::vector<std::string> &params);
+ void execute_traceover(const std::vector<std::string> &params);
+ void execute_traceflush(const std::vector<std::string> &params);
+ void execute_history(const std::vector<std::string> &params);
+ void execute_trackpc(const std::vector<std::string> &params);
+ void execute_trackmem(const std::vector<std::string> &params);
+ void execute_pcatmem(int spacenum, const std::vector<std::string> &params);
+ void execute_snap(const std::vector<std::string> &params);
+ void execute_source(const std::vector<std::string> &params);
+ void execute_map(int spacenum, const std::vector<std::string> &params);
+ void execute_memdump(const std::vector<std::string> &params);
+ void execute_symlist(const std::vector<std::string> &params);
+ void execute_softreset(const std::vector<std::string> &params);
+ void execute_hardreset(const std::vector<std::string> &params);
+ void execute_images(const std::vector<std::string> &params);
+ void execute_mount(const std::vector<std::string> &params);
+ void execute_unmount(const std::vector<std::string> &params);
+ void execute_input(const std::vector<std::string> &params);
+ void execute_dumpkbd(const std::vector<std::string> &params);
running_machine& m_machine;
debugger_console& m_console;