diff options
Diffstat (limited to 'src/emu/debug/debugcmd.h')
-rw-r--r-- | src/emu/debug/debugcmd.h | 220 |
1 files changed, 106 insertions, 114 deletions
diff --git a/src/emu/debug/debugcmd.h b/src/emu/debug/debugcmd.h index 862ad93a45a..cf38c6d903a 100644 --- a/src/emu/debug/debugcmd.h +++ b/src/emu/debug/debugcmd.h @@ -13,26 +13,13 @@ #pragma once -#include "debugcpu.h" -#include "debugcon.h" +#include <string_view> class debugger_commands { public: - debugger_commands(running_machine& machine, debugger_cpu& cpu, debugger_console& console); - - /* validates a parameter as a boolean value */ - bool validate_boolean_parameter(const std::string ¶m, bool &result); - - /* validates a parameter as a numeric value */ - bool validate_number_parameter(const std::string ¶m, u64 &result); - - /* validates a parameter as a cpu */ - bool validate_cpu_parameter(const char *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); + debugger_commands(running_machine &machine, debugger_cpu &cpu, debugger_console &console); private: struct global_entry @@ -56,117 +43,122 @@ private: // TODO [RH 31 May 2016]: Move this cheat stuff into its own class struct cheat_system { - char cpu[2]; + address_space *space; u8 width; - std::vector<cheat_map> cheatmap; - u8 undo; u8 signed_cheat; u8 swapped_cheat; - }; + std::vector<cheat_map> cheatmap; + u8 undo; + u64 sign_extend(u64 value) const; + u64 byte_swap(u64 value) const; + u64 read_extended(offs_t address) const; + }; struct cheat_region_map { - u64 offset; - u64 endoffset; - const char *share; - u8 disabled; + u64 offset = 0U; + u64 endoffset = 0U; + const char *share = nullptr; + u8 disabled = 0U; }; - bool debug_command_parameter_expression(const std::string ¶m, parsed_expression &result); - bool debug_command_parameter_command(const char *param); - bool cheat_address_is_valid(address_space &space, offs_t address); - u64 cheat_sign_extend(const cheat_system *cheatsys, u64 value); - 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(symbol_table &table, int params, const u64 *param); - u64 execute_max(symbol_table &table, int params, const u64 *param); - u64 execute_if(symbol_table &table, int params, const u64 *param); - - u64 global_get(symbol_table &table, global_entry *global); - void global_set(symbol_table &table, global_entry *global, u64 value); - - int mini_printf(char *buffer, const char *format, int params, u64 *param); - - void execute_trace_internal(int ref, const std::vector<std::string> ¶ms, bool trace_over); - - void execute_help(int ref, const std::vector<std::string> ¶ms); - void execute_print(int ref, const std::vector<std::string> ¶ms); - void execute_printf(int ref, const std::vector<std::string> ¶ms); - void execute_logerror(int ref, const std::vector<std::string> ¶ms); - void execute_tracelog(int ref, const std::vector<std::string> ¶ms); - void execute_tracesym(int ref, const std::vector<std::string> ¶ms); - void execute_quit(int ref, const std::vector<std::string> ¶ms); - void execute_do(int ref, const std::vector<std::string> ¶ms); - void execute_step(int ref, const std::vector<std::string> ¶ms); - void execute_over(int ref, const std::vector<std::string> ¶ms); - void execute_out(int ref, const std::vector<std::string> ¶ms); - void execute_go(int ref, const std::vector<std::string> ¶ms); - void execute_go_vblank(int ref, const std::vector<std::string> ¶ms); - void execute_go_interrupt(int ref, const std::vector<std::string> ¶ms); - void execute_go_exception(int ref, const std::vector<std::string> ¶ms); - void execute_go_time(int ref, const std::vector<std::string> ¶ms); - void execute_go_privilege(int ref, const std::vector<std::string> ¶ms); - void execute_focus(int ref, const std::vector<std::string> ¶ms); - void execute_ignore(int ref, const std::vector<std::string> ¶ms); - void execute_observe(int ref, const std::vector<std::string> ¶ms); - void execute_suspend(int ref, const std::vector<std::string> ¶ms); - void execute_resume(int ref, const std::vector<std::string> ¶ms); - void execute_next(int ref, const std::vector<std::string> ¶ms); - void execute_comment_add(int ref, const std::vector<std::string> ¶ms); - void execute_comment_del(int ref, const std::vector<std::string> ¶ms); - void execute_comment_save(int ref, const std::vector<std::string> ¶ms); - void execute_comment_list(int ref, const std::vector<std::string> ¶ms); - void execute_comment_commit(int ref, const std::vector<std::string> ¶ms); - void execute_bpset(int ref, const std::vector<std::string> ¶ms); - void execute_bpclear(int ref, const std::vector<std::string> ¶ms); - void execute_bpdisenable(int ref, const std::vector<std::string> ¶ms); - void execute_bplist(int ref, const std::vector<std::string> ¶ms); - void execute_wpset(int ref, const std::vector<std::string> ¶ms); - void execute_wpclear(int ref, const std::vector<std::string> ¶ms); - void execute_wpdisenable(int ref, const std::vector<std::string> ¶ms); - void execute_wplist(int ref, const std::vector<std::string> ¶ms); - void execute_rpset(int ref, const std::vector<std::string> ¶ms); - void execute_rpclear(int ref, const std::vector<std::string> ¶ms); - void execute_rpdisenable(int ref, const std::vector<std::string> ¶ms); - void execute_rplist(int ref, const std::vector<std::string> ¶ms); - void execute_hotspot(int ref, const std::vector<std::string> ¶ms); - void execute_statesave(int ref, const std::vector<std::string> ¶ms); - void execute_stateload(int ref, const std::vector<std::string> ¶ms); - void execute_rewind(int ref, const std::vector<std::string> ¶ms); - void execute_save(int ref, const std::vector<std::string> ¶ms); - void execute_load(int ref, const std::vector<std::string> ¶ms); - void execute_dump(int ref, const std::vector<std::string> ¶ms); - void execute_cheatinit(int ref, const std::vector<std::string> ¶ms); - void execute_cheatnext(int ref, const std::vector<std::string> ¶ms); - void execute_cheatlist(int ref, const std::vector<std::string> ¶ms); - void execute_cheatundo(int ref, const std::vector<std::string> ¶ms); - void execute_dasm(int ref, const std::vector<std::string> ¶ms); - void execute_find(int ref, const std::vector<std::string> ¶ms); - void execute_trace(int ref, const std::vector<std::string> ¶ms); - void execute_traceover(int ref, const std::vector<std::string> ¶ms); - void execute_traceflush(int ref, const std::vector<std::string> ¶ms); - void execute_history(int ref, const std::vector<std::string> ¶ms); - void execute_trackpc(int ref, const std::vector<std::string> ¶ms); - void execute_trackmem(int ref, const std::vector<std::string> ¶ms); - void execute_pcatmem(int ref, const std::vector<std::string> ¶ms); - void execute_snap(int ref, const std::vector<std::string> ¶ms); - void execute_source(int ref, const std::vector<std::string> ¶ms); - void execute_map(int ref, const std::vector<std::string> ¶ms); - void execute_memdump(int ref, const std::vector<std::string> ¶ms); - void execute_symlist(int ref, const std::vector<std::string> ¶ms); - void execute_softreset(int ref, const std::vector<std::string> ¶ms); - void execute_hardreset(int ref, const std::vector<std::string> ¶ms); - void execute_images(int ref, const std::vector<std::string> ¶ms); - void execute_mount(int ref, const std::vector<std::string> ¶ms); - void execute_unmount(int ref, const std::vector<std::string> ¶ms); - void execute_input(int ref, const std::vector<std::string> ¶ms); - void execute_dumpkbd(int ref, const std::vector<std::string> ¶ms); + + u64 get_cpunum(); + + u64 global_get(global_entry *global); + void global_set(global_entry *global, u64 value); + + bool mini_printf(std::ostream &stream, const std::vector<std::string_view> ¶ms); + template <typename T> + void execute_index_command(std::vector<std::string_view> const ¶ms, T &&apply, char const *unused_message); + + void execute_help(const std::vector<std::string_view> ¶ms); + void execute_print(const std::vector<std::string_view> ¶ms); + void execute_printf(const std::vector<std::string_view> ¶ms); + void execute_logerror(const std::vector<std::string_view> ¶ms); + void execute_tracelog(const std::vector<std::string_view> ¶ms); + void execute_tracesym(const std::vector<std::string_view> ¶ms); + void execute_cls(const std::vector<std::string_view> ¶ms); + void execute_quit(const std::vector<std::string_view> ¶ms); + void execute_do(const std::vector<std::string_view> ¶ms); + void execute_step(const std::vector<std::string_view> ¶ms); + void execute_over(const std::vector<std::string_view> ¶ms); + void execute_out(const std::vector<std::string_view> ¶ms); + void execute_go(const std::vector<std::string_view> ¶ms); + void execute_go_vblank(const std::vector<std::string_view> ¶ms); + void execute_go_interrupt(const std::vector<std::string_view> ¶ms); + void execute_go_exception(const std::vector<std::string_view> ¶ms); + void execute_go_time(const std::vector<std::string_view> ¶ms); + void execute_go_privilege(const std::vector<std::string_view> ¶ms); + void execute_go_branch(bool sense, const std::vector<std::string_view> ¶ms); + void execute_go_next_instruction(const std::vector<std::string_view> ¶ms); + void execute_focus(const std::vector<std::string_view> ¶ms); + void execute_ignore(const std::vector<std::string_view> ¶ms); + void execute_observe(const std::vector<std::string_view> ¶ms); + void execute_suspend(const std::vector<std::string_view> ¶ms); + void execute_resume(const std::vector<std::string_view> ¶ms); + void execute_next(const std::vector<std::string_view> ¶ms); + void execute_cpulist(const std::vector<std::string_view> ¶ms); + void execute_time(const std::vector<std::string_view> ¶ms); + void execute_comment_add(const std::vector<std::string_view> ¶ms); + void execute_comment_del(const std::vector<std::string_view> ¶ms); + void execute_comment_save(const std::vector<std::string_view> ¶ms); + void execute_comment_list(const std::vector<std::string_view> ¶ms); + void execute_comment_commit(const std::vector<std::string_view> ¶ms); + void execute_bpset(const std::vector<std::string_view> ¶ms); + void execute_bpclear(const std::vector<std::string_view> ¶ms); + void execute_bpdisenable(bool enable, const std::vector<std::string_view> ¶ms); + void execute_bplist(const std::vector<std::string_view> ¶ms); + void execute_wpset(int spacenum, const std::vector<std::string_view> ¶ms); + void execute_wpclear(const std::vector<std::string_view> ¶ms); + void execute_wpdisenable(bool enable, const std::vector<std::string_view> ¶ms); + void execute_wplist(const std::vector<std::string_view> ¶ms); + void execute_rpset(const std::vector<std::string_view> ¶ms); + void execute_rpclear(const std::vector<std::string_view> ¶ms); + void execute_rpdisenable(bool enable, const std::vector<std::string_view> ¶ms); + void execute_rplist(const std::vector<std::string_view> ¶ms); + void execute_epset(const std::vector<std::string_view> ¶ms); + void execute_epclear(const std::vector<std::string_view> ¶ms); + void execute_epdisenable(bool enable, const std::vector<std::string_view> ¶ms); + void execute_eplist(const std::vector<std::string_view> ¶ms); + void execute_statesave(const std::vector<std::string_view> ¶ms); + void execute_stateload(const std::vector<std::string_view> ¶ms); + void execute_rewind(const std::vector<std::string_view> ¶ms); + void execute_save(int spacenum, const std::vector<std::string_view> ¶ms); + void execute_saveregion(const std::vector<std::string_view> ¶ms); + void execute_load(int spacenum, const std::vector<std::string_view> ¶ms); + void execute_loadregion(const std::vector<std::string_view> ¶ms); + void execute_dump(int spacenum, const std::vector<std::string_view> ¶ms); + void execute_strdump(int spacenum, const std::vector<std::string_view> ¶ms); + void execute_cheatrange(bool init, const std::vector<std::string_view> ¶ms); + void execute_cheatnext(bool initial, const std::vector<std::string_view> ¶ms); + void execute_cheatlist(const std::vector<std::string_view> ¶ms); + void execute_cheatundo(const std::vector<std::string_view> ¶ms); + void execute_dasm(const std::vector<std::string_view> ¶ms); + void execute_find(int spacenum, const std::vector<std::string_view> ¶ms); + void execute_fill(int spacenum, const std::vector<std::string_view> ¶ms); + void execute_trace(const std::vector<std::string_view> ¶ms, bool trace_over); + void execute_traceflush(const std::vector<std::string_view> ¶ms); + void execute_history(const std::vector<std::string_view> ¶ms); + void execute_trackpc(const std::vector<std::string_view> ¶ms); + void execute_trackmem(const std::vector<std::string_view> ¶ms); + void execute_pcatmem(int spacenum, const std::vector<std::string_view> ¶ms); + void execute_snap(const std::vector<std::string_view> ¶ms); + void execute_source(const std::vector<std::string_view> ¶ms); + void execute_map(int spacenum, const std::vector<std::string_view> ¶ms); + void execute_memdump(const std::vector<std::string_view> ¶ms); + void execute_symlist(const std::vector<std::string_view> ¶ms); + void execute_softreset(const std::vector<std::string_view> ¶ms); + void execute_hardreset(const std::vector<std::string_view> ¶ms); + void execute_images(const std::vector<std::string_view> ¶ms); + void execute_mount(const std::vector<std::string_view> ¶ms); + void execute_unmount(const std::vector<std::string_view> ¶ms); + void execute_input(const std::vector<std::string_view> ¶ms); + void execute_dumpkbd(const std::vector<std::string_view> ¶ms); running_machine& m_machine; - debugger_cpu& m_cpu; debugger_console& m_console; std::unique_ptr<global_entry []> m_global_array; |