diff options
Diffstat (limited to 'src/emu/debug/debugcmd.cpp')
-rw-r--r-- | src/emu/debug/debugcmd.cpp | 331 |
1 files changed, 173 insertions, 158 deletions
diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index 781ce93e9a5..064f102299c 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -464,15 +464,15 @@ void debugger_commands::global_set(global_entry *global, u64 value) /// the parameter is an empty string. /// \return true if the parameter is a valid Boolean value or an empty /// string, or false otherwise. -bool debugger_commands::validate_boolean_parameter(const std::string ¶m, bool &result) +bool debugger_commands::validate_boolean_parameter(std::string_view param, bool &result) { // nullptr parameter does nothing and returns no error if (param.empty()) return true; // evaluate the expression; success if no error - bool const is_true = !core_stricmp(param.c_str(), "true"); - bool const is_false = !core_stricmp(param.c_str(), "false"); + bool const is_true = util::streqlower(param, "true"); + bool const is_false = util::streqlower(param, "false"); if (is_true || is_false) { @@ -895,12 +895,8 @@ bool debugger_commands::debug_command_parameter_expression(std::string_view para command parameter -------------------------------------------------*/ -bool debugger_commands::debug_command_parameter_command(const char *param) +bool debugger_commands::debug_command_parameter_command(std::string_view param) { - /* nullptr parameter does nothing and returns no error */ - if (param == nullptr) - return true; - /* validate the comment; success if no error */ CMDERR err = m_console.validate_command(param); if (err.error_class() == CMDERR::NONE) @@ -917,7 +913,7 @@ bool debugger_commands::debug_command_parameter_command(const char *param) execute_help - execute the help command -------------------------------------------------*/ -void debugger_commands::execute_help(const std::vector<std::string> ¶ms) +void debugger_commands::execute_help(const std::vector<std::string_view> ¶ms) { if (params.size() == 0) m_console.printf_wrap(80, "%s\n", debug_get_help(std::string_view())); @@ -930,7 +926,7 @@ void debugger_commands::execute_help(const std::vector<std::string> ¶ms) execute_print - execute the print command -------------------------------------------------*/ -void debugger_commands::execute_print(const std::vector<std::string> ¶ms) +void debugger_commands::execute_print(const std::vector<std::string_view> ¶ms) { /* validate the other parameters */ u64 values[MAX_COMMAND_PARAMS]; @@ -1079,7 +1075,7 @@ bool debugger_commands::mini_printf(std::ostream &stream, std::string_view forma -------------------------------------------------*/ template <typename T> -void debugger_commands::execute_index_command(std::vector<std::string> const ¶ms, T &&apply, char const *unused_message) +void debugger_commands::execute_index_command(std::vector<std::string_view> const ¶ms, T &&apply, char const *unused_message) { std::vector<u64> index(params.size()); for (int paramnum = 0; paramnum < params.size(); paramnum++) @@ -1108,7 +1104,7 @@ void debugger_commands::execute_index_command(std::vector<std::string> const &pa execute_printf - execute the printf command -------------------------------------------------*/ -void debugger_commands::execute_printf(const std::vector<std::string> ¶ms) +void debugger_commands::execute_printf(const std::vector<std::string_view> ¶ms) { /* validate the other parameters */ u64 values[MAX_COMMAND_PARAMS]; @@ -1127,7 +1123,7 @@ void debugger_commands::execute_printf(const std::vector<std::string> ¶ms) execute_logerror - execute the logerror command -------------------------------------------------*/ -void debugger_commands::execute_logerror(const std::vector<std::string> ¶ms) +void debugger_commands::execute_logerror(const std::vector<std::string_view> ¶ms) { /* validate the other parameters */ u64 values[MAX_COMMAND_PARAMS]; @@ -1146,7 +1142,7 @@ void debugger_commands::execute_logerror(const std::vector<std::string> ¶ms) execute_tracelog - execute the tracelog command -------------------------------------------------*/ -void debugger_commands::execute_tracelog(const std::vector<std::string> ¶ms) +void debugger_commands::execute_tracelog(const std::vector<std::string_view> ¶ms) { /* validate the other parameters */ u64 values[MAX_COMMAND_PARAMS]; @@ -1165,7 +1161,7 @@ void debugger_commands::execute_tracelog(const std::vector<std::string> ¶ms) execute_tracesym - execute the tracesym command -------------------------------------------------*/ -void debugger_commands::execute_tracesym(const std::vector<std::string> ¶ms) +void debugger_commands::execute_tracesym(const std::vector<std::string_view> ¶ms) { // build a format string appropriate for the parameters and validate them std::stringstream format; @@ -1201,7 +1197,7 @@ void debugger_commands::execute_tracesym(const std::vector<std::string> ¶ms) execute_cls - execute the cls command -------------------------------------------------*/ -void debugger_commands::execute_cls(const std::vector<std::string> ¶ms) +void debugger_commands::execute_cls(const std::vector<std::string_view> ¶ms) { text_buffer_clear(m_console.get_console_textbuf()); } @@ -1211,7 +1207,7 @@ void debugger_commands::execute_cls(const std::vector<std::string> ¶ms) execute_quit - execute the quit command -------------------------------------------------*/ -void debugger_commands::execute_quit(const std::vector<std::string> ¶ms) +void debugger_commands::execute_quit(const std::vector<std::string_view> ¶ms) { osd_printf_warning("Exited via the debugger\n"); m_machine.schedule_exit(); @@ -1222,7 +1218,7 @@ void debugger_commands::execute_quit(const std::vector<std::string> ¶ms) execute_do - execute the do command -------------------------------------------------*/ -void debugger_commands::execute_do(const std::vector<std::string> ¶ms) +void debugger_commands::execute_do(const std::vector<std::string_view> ¶ms) { u64 dummy; validate_number_parameter(params[0], dummy); @@ -1233,7 +1229,7 @@ void debugger_commands::execute_do(const std::vector<std::string> ¶ms) execute_step - execute the step command -------------------------------------------------*/ -void debugger_commands::execute_step(const std::vector<std::string> ¶ms) +void debugger_commands::execute_step(const std::vector<std::string_view> ¶ms) { /* if we have a parameter, use it */ u64 steps = 1; @@ -1248,7 +1244,7 @@ void debugger_commands::execute_step(const std::vector<std::string> ¶ms) execute_over - execute the over command -------------------------------------------------*/ -void debugger_commands::execute_over(const std::vector<std::string> ¶ms) +void debugger_commands::execute_over(const std::vector<std::string_view> ¶ms) { /* if we have a parameter, use it */ u64 steps = 1; @@ -1263,7 +1259,7 @@ void debugger_commands::execute_over(const std::vector<std::string> ¶ms) execute_out - execute the out command -------------------------------------------------*/ -void debugger_commands::execute_out(const std::vector<std::string> ¶ms) +void debugger_commands::execute_out(const std::vector<std::string_view> ¶ms) { m_console.get_visible_cpu()->debug()->single_step_out(); } @@ -1273,7 +1269,7 @@ void debugger_commands::execute_out(const std::vector<std::string> ¶ms) execute_go - execute the go command -------------------------------------------------*/ -void debugger_commands::execute_go(const std::vector<std::string> ¶ms) +void debugger_commands::execute_go(const std::vector<std::string_view> ¶ms) { u64 addr = ~0; @@ -1290,7 +1286,7 @@ void debugger_commands::execute_go(const std::vector<std::string> ¶ms) command -------------------------------------------------*/ -void debugger_commands::execute_go_vblank(const std::vector<std::string> ¶ms) +void debugger_commands::execute_go_vblank(const std::vector<std::string_view> ¶ms) { m_console.get_visible_cpu()->debug()->go_vblank(); } @@ -1300,7 +1296,7 @@ void debugger_commands::execute_go_vblank(const std::vector<std::string> ¶ms execute_go_interrupt - execute the goint command -------------------------------------------------*/ -void debugger_commands::execute_go_interrupt(const std::vector<std::string> ¶ms) +void debugger_commands::execute_go_interrupt(const std::vector<std::string_view> ¶ms) { u64 irqline = -1; @@ -1315,7 +1311,7 @@ void debugger_commands::execute_go_interrupt(const std::vector<std::string> &par execute_go_exception - execute the goex command -------------------------------------------------*/ -void debugger_commands::execute_go_exception(const std::vector<std::string> ¶ms) +void debugger_commands::execute_go_exception(const std::vector<std::string_view> ¶ms) { u64 exception = -1; @@ -1335,7 +1331,7 @@ void debugger_commands::execute_go_exception(const std::vector<std::string> &par execute_go_time - execute the gtime command -------------------------------------------------*/ -void debugger_commands::execute_go_time(const std::vector<std::string> ¶ms) +void debugger_commands::execute_go_time(const std::vector<std::string_view> ¶ms) { u64 milliseconds = -1; @@ -1351,7 +1347,7 @@ void debugger_commands::execute_go_time(const std::vector<std::string> ¶ms) /*------------------------------------------------- execute_go_privilege - execute the gp command -------------------------------------------------*/ -void debugger_commands::execute_go_privilege(const std::vector<std::string> ¶ms) +void debugger_commands::execute_go_privilege(const std::vector<std::string_view> ¶ms) { parsed_expression condition(m_console.visible_symtable()); if (params.size() > 0 && !debug_command_parameter_expression(params[0], condition)) @@ -1365,7 +1361,7 @@ void debugger_commands::execute_go_privilege(const std::vector<std::string> &par execute_go_branch - execute gbt or gbf command -------------------------------------------------*/ -void debugger_commands::execute_go_branch(bool sense, const std::vector<std::string> ¶ms) +void debugger_commands::execute_go_branch(bool sense, const std::vector<std::string_view> ¶ms) { parsed_expression condition(m_console.visible_symtable()); if (params.size() > 0 && !debug_command_parameter_expression(params[0], condition)) @@ -1379,7 +1375,7 @@ void debugger_commands::execute_go_branch(bool sense, const std::vector<std::str execute_go_next_instruction - execute gni command -------------------------------------------------*/ -void debugger_commands::execute_go_next_instruction(const std::vector<std::string> ¶ms) +void debugger_commands::execute_go_next_instruction(const std::vector<std::string_view> ¶ms) { u64 count = 1; static constexpr u64 MAX_COUNT = 512; @@ -1420,7 +1416,7 @@ void debugger_commands::execute_go_next_instruction(const std::vector<std::strin execute_next - execute the next command -------------------------------------------------*/ -void debugger_commands::execute_next(const std::vector<std::string> ¶ms) +void debugger_commands::execute_next(const std::vector<std::string_view> ¶ms) { m_console.get_visible_cpu()->debug()->go_next_device(); } @@ -1430,7 +1426,7 @@ void debugger_commands::execute_next(const std::vector<std::string> ¶ms) execute_focus - execute the focus command -------------------------------------------------*/ -void debugger_commands::execute_focus(const std::vector<std::string> ¶ms) +void debugger_commands::execute_focus(const std::vector<std::string_view> ¶ms) { // validate params device_t *cpu; @@ -1452,7 +1448,7 @@ void debugger_commands::execute_focus(const std::vector<std::string> ¶ms) execute_ignore - execute the ignore command -------------------------------------------------*/ -void debugger_commands::execute_ignore(const std::vector<std::string> ¶ms) +void debugger_commands::execute_ignore(const std::vector<std::string_view> ¶ms) { if (params.empty()) { @@ -1515,7 +1511,7 @@ void debugger_commands::execute_ignore(const std::vector<std::string> ¶ms) execute_observe - execute the observe command -------------------------------------------------*/ -void debugger_commands::execute_observe(const std::vector<std::string> ¶ms) +void debugger_commands::execute_observe(const std::vector<std::string_view> ¶ms) { if (params.empty()) { @@ -1563,7 +1559,7 @@ void debugger_commands::execute_observe(const std::vector<std::string> ¶ms) execute_suspend - suspend execution on cpu -------------------------------------------------*/ -void debugger_commands::execute_suspend(const std::vector<std::string> ¶ms) +void debugger_commands::execute_suspend(const std::vector<std::string_view> ¶ms) { // if there are no parameters, dump the ignore list if (params.empty()) @@ -1622,7 +1618,7 @@ void debugger_commands::execute_suspend(const std::vector<std::string> ¶ms) execute_resume - Resume execution on CPU -------------------------------------------------*/ -void debugger_commands::execute_resume(const std::vector<std::string> ¶ms) +void debugger_commands::execute_resume(const std::vector<std::string_view> ¶ms) { // if there are no parameters, dump the ignore list if (params.empty()) @@ -1667,7 +1663,7 @@ void debugger_commands::execute_resume(const std::vector<std::string> ¶ms) // execute_cpulist - list all CPUs //------------------------------------------------- -void debugger_commands::execute_cpulist(const std::vector<std::string> ¶ms) +void debugger_commands::execute_cpulist(const std::vector<std::string_view> ¶ms) { int index = 0; for (device_execute_interface &exec : execute_interface_enumerator(m_machine.root_device())) @@ -1682,7 +1678,7 @@ void debugger_commands::execute_cpulist(const std::vector<std::string> ¶ms) // execute_time - execute the time command //------------------------------------------------- -void debugger_commands::execute_time(const std::vector<std::string> ¶ms) +void debugger_commands::execute_time(const std::vector<std::string_view> ¶ms) { m_console.printf("%s\n", m_machine.time().as_string()); } @@ -1691,7 +1687,7 @@ void debugger_commands::execute_time(const std::vector<std::string> ¶ms) execute_comment - add a comment to a line -------------------------------------------------*/ -void debugger_commands::execute_comment_add(const std::vector<std::string> ¶ms) +void debugger_commands::execute_comment_add(const std::vector<std::string_view> ¶ms) { // param 1 is the address for the comment u64 address; @@ -1711,7 +1707,8 @@ void debugger_commands::execute_comment_add(const std::vector<std::string> ¶ } // Now try adding the comment - cpu->debug()->comment_add(address, params[1].c_str(), 0x00ff0000); + std::string text(params[1]); + cpu->debug()->comment_add(address, text.c_str(), 0x00ff0000); cpu->machine().debug_view().update_all(DVT_DISASSEMBLY); } @@ -1720,7 +1717,7 @@ void debugger_commands::execute_comment_add(const std::vector<std::string> ¶ execute_comment_del - remove a comment from an addr --------------------------------------------------------*/ -void debugger_commands::execute_comment_del(const std::vector<std::string> ¶ms) +void debugger_commands::execute_comment_del(const std::vector<std::string_view> ¶ms) { // param 1 can either be a command or the address for the comment u64 address; @@ -1739,25 +1736,25 @@ void debugger_commands::execute_comment_del(const std::vector<std::string> ¶ } /** - * @fn void execute_comment_list(const std::vector<std::string> ¶ms) + * @fn void execute_comment_list(const std::vector<std::string_view> ¶ms) * @brief Print current list of comments in debugger * * */ -void debugger_commands::execute_comment_list(const std::vector<std::string> ¶ms) +void debugger_commands::execute_comment_list(const std::vector<std::string_view> ¶ms) { if (!m_machine.debugger().cpu().comment_load(false)) m_console.printf("Error while parsing XML file\n"); } /** - * @fn void execute_comment_commit(const std::vector<std::string> ¶ms) + * @fn void execute_comment_commit(const std::vector<std::string_view> ¶ms) * @brief Add and Save current list of comments in debugger * */ -void debugger_commands::execute_comment_commit(const std::vector<std::string> ¶ms) +void debugger_commands::execute_comment_commit(const std::vector<std::string_view> ¶ms) { execute_comment_add(params); execute_comment_save(params); @@ -1767,7 +1764,7 @@ void debugger_commands::execute_comment_commit(const std::vector<std::string> &p execute_comment - add a comment to a line -------------------------------------------------*/ -void debugger_commands::execute_comment_save(const std::vector<std::string> ¶ms) +void debugger_commands::execute_comment_save(const std::vector<std::string_view> ¶ms) { if (m_machine.debugger().cpu().comment_save()) m_console.printf("Comment successfully saved\n"); @@ -1777,7 +1774,7 @@ void debugger_commands::execute_comment_save(const std::vector<std::string> &par // TODO: add color hex editing capabilities for comments, see below for more info /** - * @fn void execute_comment_color(const std::vector<std::string> ¶ms) + * @fn void execute_comment_color(const std::vector<std::string_view> ¶ms) * @brief Modifies comment given at address $xx with given color * Useful for marking comment with a different color scheme (for example by marking start and end of a given function visually). * @param[in] "address,color" First is the comment address in the current context, color can be hexadecimal or shorthanded to common 1bpp RGB names. @@ -1794,7 +1791,7 @@ void debugger_commands::execute_comment_save(const std::vector<std::string> &par command -------------------------------------------------*/ -void debugger_commands::execute_bpset(const std::vector<std::string> ¶ms) +void debugger_commands::execute_bpset(const std::vector<std::string_view> ¶ms) { // param 1 is the address/CPU u64 address; @@ -1822,12 +1819,12 @@ void debugger_commands::execute_bpset(const std::vector<std::string> ¶ms) return; // param 3 is the action - const char *action = nullptr; - if (params.size() > 2 && !debug_command_parameter_command(action = params[2].c_str())) + std::string action; + if (params.size() > 2 && !debug_command_parameter_command(action = params[2])) return; // set the breakpoint - int const bpnum = debug->breakpoint_set(address, condition.is_empty() ? nullptr : condition.original_string(), action); + int const bpnum = debug->breakpoint_set(address, condition.is_empty() ? nullptr : condition.original_string(), action.c_str()); m_console.printf("Breakpoint %X set\n", bpnum); } @@ -1837,7 +1834,7 @@ void debugger_commands::execute_bpset(const std::vector<std::string> ¶ms) clear command -------------------------------------------------*/ -void debugger_commands::execute_bpclear(const std::vector<std::string> ¶ms) +void debugger_commands::execute_bpclear(const std::vector<std::string_view> ¶ms) { if (params.empty()) // if no parameters, clear all { @@ -1866,7 +1863,7 @@ void debugger_commands::execute_bpclear(const std::vector<std::string> ¶ms) disable/enable commands -------------------------------------------------*/ -void debugger_commands::execute_bpdisenable(bool enable, const std::vector<std::string> ¶ms) +void debugger_commands::execute_bpdisenable(bool enable, const std::vector<std::string_view> ¶ms) { if (params.empty()) // if no parameters, disable/enable all { @@ -1895,7 +1892,7 @@ void debugger_commands::execute_bpdisenable(bool enable, const std::vector<std:: command -------------------------------------------------*/ -void debugger_commands::execute_bplist(const std::vector<std::string> ¶ms) +void debugger_commands::execute_bplist(const std::vector<std::string_view> ¶ms) { int printed = 0; std::string buffer; @@ -1946,7 +1943,7 @@ void debugger_commands::execute_bplist(const std::vector<std::string> ¶ms) command -------------------------------------------------*/ -void debugger_commands::execute_wpset(int spacenum, const std::vector<std::string> ¶ms) +void debugger_commands::execute_wpset(int spacenum, const std::vector<std::string_view> ¶ms) { u64 address, length; address_space *space; @@ -1969,11 +1966,11 @@ void debugger_commands::execute_wpset(int spacenum, const std::vector<std::strin // param 3 is the type read_or_write type; - if (!core_stricmp(params[2].c_str(), "r")) + if (util::streqlower(params[2], "r")) type = read_or_write::READ; - else if (!core_stricmp(params[2].c_str(), "w")) + else if (util::streqlower(params[2], "w")) type = read_or_write::WRITE; - else if (!core_stricmp(params[2].c_str(), "rw") || !core_stricmp(params[2].c_str(), "wr")) + else if (util::streqlower(params[2], "rw") || util::streqlower(params[2], "wr")) type = read_or_write::READWRITE; else { @@ -1987,12 +1984,12 @@ void debugger_commands::execute_wpset(int spacenum, const std::vector<std::strin return; // param 5 is the action - const char *action = nullptr; - if (params.size() > 4 && !debug_command_parameter_command(action = params[4].c_str())) + std::string action; + if (params.size() > 4 && !debug_command_parameter_command(action = params[4])) return; // set the watchpoint - int const wpnum = debug->watchpoint_set(*space, type, address, length, (condition.is_empty()) ? nullptr : condition.original_string(), action); + int const wpnum = debug->watchpoint_set(*space, type, address, length, (condition.is_empty()) ? nullptr : condition.original_string(), action.c_str()); m_console.printf("Watchpoint %X set\n", wpnum); } @@ -2002,7 +1999,7 @@ void debugger_commands::execute_wpset(int spacenum, const std::vector<std::strin clear command -------------------------------------------------*/ -void debugger_commands::execute_wpclear(const std::vector<std::string> ¶ms) +void debugger_commands::execute_wpclear(const std::vector<std::string_view> ¶ms) { if (params.empty()) // if no parameters, clear all { @@ -2031,7 +2028,7 @@ void debugger_commands::execute_wpclear(const std::vector<std::string> ¶ms) disable/enable commands -------------------------------------------------*/ -void debugger_commands::execute_wpdisenable(bool enable, const std::vector<std::string> ¶ms) +void debugger_commands::execute_wpdisenable(bool enable, const std::vector<std::string_view> ¶ms) { if (params.empty()) // if no parameters, disable/enable all { @@ -2060,7 +2057,7 @@ void debugger_commands::execute_wpdisenable(bool enable, const std::vector<std:: command -------------------------------------------------*/ -void debugger_commands::execute_wplist(const std::vector<std::string> ¶ms) +void debugger_commands::execute_wplist(const std::vector<std::string_view> ¶ms) { int printed = 0; std::string buffer; @@ -2123,7 +2120,7 @@ void debugger_commands::execute_wplist(const std::vector<std::string> ¶ms) command -------------------------------------------------*/ -void debugger_commands::execute_rpset(const std::vector<std::string> ¶ms) +void debugger_commands::execute_rpset(const std::vector<std::string_view> ¶ms) { // CPU is implicit device_t *cpu; @@ -2136,12 +2133,12 @@ void debugger_commands::execute_rpset(const std::vector<std::string> ¶ms) return; // param 2 is the action - const char *action = nullptr; - if (params.size() > 1 && !debug_command_parameter_command(action = params[1].c_str())) + std::string action; + if (params.size() > 1 && !debug_command_parameter_command(action = params[1])) return; // set the registerpoint - int const rpnum = cpu->debug()->registerpoint_set(condition.original_string(), action); + int const rpnum = cpu->debug()->registerpoint_set(condition.original_string(), action.c_str()); m_console.printf("Registerpoint %X set\n", rpnum); } @@ -2151,7 +2148,7 @@ void debugger_commands::execute_rpset(const std::vector<std::string> ¶ms) clear command -------------------------------------------------*/ -void debugger_commands::execute_rpclear(const std::vector<std::string> ¶ms) +void debugger_commands::execute_rpclear(const std::vector<std::string_view> ¶ms) { if (params.empty()) // if no parameters, clear all { @@ -2180,7 +2177,7 @@ void debugger_commands::execute_rpclear(const std::vector<std::string> ¶ms) disable/enable commands -------------------------------------------------*/ -void debugger_commands::execute_rpdisenable(bool enable, const std::vector<std::string> ¶ms) +void debugger_commands::execute_rpdisenable(bool enable, const std::vector<std::string_view> ¶ms) { if (params.empty()) // if no parameters, disable/enable all { @@ -2209,7 +2206,7 @@ void debugger_commands::execute_rpdisenable(bool enable, const std::vector<std:: command -------------------------------------------------*/ -void debugger_commands::execute_rplist(const std::vector<std::string> ¶ms) +void debugger_commands::execute_rplist(const std::vector<std::string_view> ¶ms) { int printed = 0; std::string buffer; @@ -2256,7 +2253,7 @@ void debugger_commands::execute_rplist(const std::vector<std::string> ¶ms) execute_statesave - execute the statesave command -------------------------------------------------*/ -void debugger_commands::execute_statesave(const std::vector<std::string> ¶ms) +void debugger_commands::execute_statesave(const std::vector<std::string_view> ¶ms) { m_machine.immediate_save(params[0]); m_console.printf("State save attempted. Please refer to window message popup for results.\n"); @@ -2267,7 +2264,7 @@ void debugger_commands::execute_statesave(const std::vector<std::string> ¶ms execute_stateload - execute the stateload command -------------------------------------------------*/ -void debugger_commands::execute_stateload(const std::vector<std::string> ¶ms) +void debugger_commands::execute_stateload(const std::vector<std::string_view> ¶ms) { m_machine.immediate_load(params[0]); @@ -2285,7 +2282,7 @@ void debugger_commands::execute_stateload(const std::vector<std::string> ¶ms execute_rewind - execute the rewind command -------------------------------------------------*/ -void debugger_commands::execute_rewind(const std::vector<std::string> ¶ms) +void debugger_commands::execute_rewind(const std::vector<std::string_view> ¶ms) { bool success = m_machine.rewind_step(); if (success) @@ -2304,7 +2301,7 @@ void debugger_commands::execute_rewind(const std::vector<std::string> ¶ms) execute_save - execute the save command -------------------------------------------------*/ -void debugger_commands::execute_save(int spacenum, const std::vector<std::string> ¶ms) +void debugger_commands::execute_save(int spacenum, const std::vector<std::string_view> ¶ms) { u64 offset, endoffset, length; address_space *space; @@ -2321,7 +2318,8 @@ void debugger_commands::execute_save(int spacenum, const std::vector<std::string endoffset++; // open the file - FILE *const f = fopen(params[0].c_str(), "wb"); + std::string filename(params[0]); + FILE *const f = fopen(filename.c_str(), "wb"); if (!f) { m_console.printf("Error opening file '%s'\n", params[0]); @@ -2391,7 +2389,7 @@ void debugger_commands::execute_save(int spacenum, const std::vector<std::string execute_saveregion - execute the save command on region memory -------------------------------------------------*/ -void debugger_commands::execute_saveregion(const std::vector<std::string> ¶ms) +void debugger_commands::execute_saveregion(const std::vector<std::string_view> ¶ms) { u64 offset, length; memory_region *region; @@ -2413,7 +2411,8 @@ void debugger_commands::execute_saveregion(const std::vector<std::string> ¶m length = region->bytes() - offset; /* open the file */ - FILE *f = fopen(params[0].c_str(), "wb"); + std::string filename(params[0]); + FILE *f = fopen(filename.c_str(), "wb"); if (!f) { m_console.printf("Error opening file '%s'\n", params[0]); @@ -2430,7 +2429,7 @@ void debugger_commands::execute_saveregion(const std::vector<std::string> ¶m execute_load - execute the load command -------------------------------------------------*/ -void debugger_commands::execute_load(int spacenum, const std::vector<std::string> ¶ms) +void debugger_commands::execute_load(int spacenum, const std::vector<std::string_view> ¶ms) { u64 offset, endoffset, length = 0; address_space *space; @@ -2443,7 +2442,8 @@ void debugger_commands::execute_load(int spacenum, const std::vector<std::string // open the file std::ifstream f; - f.open(params[0], std::ifstream::in | std::ifstream::binary); + std::string fname(params[0]); + f.open(fname.c_str(), std::ifstream::in | std::ifstream::binary); if (f.fail()) { m_console.printf("Error opening file '%s'\n", params[0]); @@ -2538,7 +2538,7 @@ void debugger_commands::execute_load(int spacenum, const std::vector<std::string execute_loadregion - execute the load command on region memory -------------------------------------------------*/ -void debugger_commands::execute_loadregion(const std::vector<std::string> ¶ms) +void debugger_commands::execute_loadregion(const std::vector<std::string_view> ¶ms) { u64 offset, length; memory_region *region; @@ -2560,7 +2560,8 @@ void debugger_commands::execute_loadregion(const std::vector<std::string> ¶m length = region->bytes() - offset; // open the file - FILE *const f = fopen(params[0].c_str(), "rb"); + std::string filename(params[0]); + FILE *const f = fopen(filename.c_str(), "rb"); if (!f) { m_console.printf("Error opening file '%s'\n", params[0]); @@ -2586,7 +2587,7 @@ void debugger_commands::execute_loadregion(const std::vector<std::string> ¶m execute_dump - execute the dump command -------------------------------------------------*/ -void debugger_commands::execute_dump(int spacenum, const std::vector<std::string> ¶ms) +void debugger_commands::execute_dump(int spacenum, const std::vector<std::string_view> ¶ms) { // validate parameters address_space *space; @@ -2638,7 +2639,8 @@ void debugger_commands::execute_dump(int spacenum, const std::vector<std::string offset = offset & space->addrmask(); // open the file - FILE *const f = fopen(params[0].c_str(), "w"); + std::string filename(params[0]); + FILE *const f = fopen(filename.c_str(), "w"); if (!f) { m_console.printf("Error opening file '%s'\n", params[0]); @@ -2747,7 +2749,7 @@ void debugger_commands::execute_dump(int spacenum, const std::vector<std::string // execute_strdump - execute the strdump command //------------------------------------------------- -void debugger_commands::execute_strdump(int spacenum, const std::vector<std::string> ¶ms) +void debugger_commands::execute_strdump(int spacenum, const std::vector<std::string_view> ¶ms) { // validate parameters u64 offset; @@ -2774,7 +2776,8 @@ void debugger_commands::execute_strdump(int spacenum, const std::vector<std::str } // open the file - FILE *f = fopen(params[0].c_str(), "w"); + std::string filename(params[0]); + FILE *f = fopen(filename.c_str(), "w"); if (!f) { m_console.printf("Error opening file '%s'\n", params[0]); @@ -2923,7 +2926,7 @@ void debugger_commands::execute_strdump(int spacenum, const std::vector<std::str cheats -------------------------------------------------*/ -void debugger_commands::execute_cheatrange(bool init, const std::vector<std::string> ¶ms) +void debugger_commands::execute_cheatrange(bool init, const std::vector<std::string_view> ¶ms) { address_space *space = m_cheat.space; if (!space && !init) @@ -2940,7 +2943,7 @@ void debugger_commands::execute_cheatrange(bool init, const std::vector<std::str // first argument is sign/size/swap flags if (!params.empty()) { - std::string const &srtpnt = params[0]; + std::string_view const &srtpnt = params[0]; if (!srtpnt.empty()) { width = 1; @@ -3092,7 +3095,7 @@ void debugger_commands::execute_cheatrange(bool init, const std::vector<std::str execute_cheatnext - execute the search -------------------------------------------------*/ -void debugger_commands::execute_cheatnext(bool initial, const std::vector<std::string> ¶ms) +void debugger_commands::execute_cheatnext(bool initial, const std::vector<std::string_view> ¶ms) { enum { @@ -3126,25 +3129,25 @@ void debugger_commands::execute_cheatnext(bool initial, const std::vector<std::s // decode condition u8 condition; - if (!core_stricmp(params[0].c_str(), "all")) + if (util::streqlower(params[0], "all")) condition = CHEAT_ALL; - else if (!core_stricmp(params[0].c_str(), "equal") || !core_stricmp(params[0].c_str(), "eq")) + else if (util::streqlower(params[0], "equal") || util::streqlower(params[0], "eq")) condition = (params.size() > 1) ? CHEAT_EQUALTO : CHEAT_EQUAL; - else if (!core_stricmp(params[0].c_str(), "notequal") || !core_stricmp(params[0].c_str(), "ne")) + else if (util::streqlower(params[0], "notequal") || util::streqlower(params[0], "ne")) condition = (params.size() > 1) ? CHEAT_NOTEQUALTO : CHEAT_NOTEQUAL; - else if (!core_stricmp(params[0].c_str(), "decrease") || !core_stricmp(params[0].c_str(), "de") || params[0] == "-") + else if (util::streqlower(params[0], "decrease") || util::streqlower(params[0], "de") || params[0] == "-") condition = (params.size() > 1) ? CHEAT_DECREASEOF : CHEAT_DECREASE; - else if (!core_stricmp(params[0].c_str(), "increase") || !core_stricmp(params[0].c_str(), "in") || params[0] == "+") + else if (util::streqlower(params[0], "increase") || util::streqlower(params[0], "in") || params[0] == "+") condition = (params.size() > 1) ? CHEAT_INCREASEOF : CHEAT_INCREASE; - else if (!core_stricmp(params[0].c_str(), "decreaseorequal") || !core_stricmp(params[0].c_str(), "deeq")) + else if (util::streqlower(params[0], "decreaseorequal") || util::streqlower(params[0], "deeq")) condition = CHEAT_DECREASE_OR_EQUAL; - else if (!core_stricmp(params[0].c_str(), "increaseorequal") || !core_stricmp(params[0].c_str(), "ineq")) + else if (util::streqlower(params[0], "increaseorequal") || util::streqlower(params[0], "ineq")) condition = CHEAT_INCREASE_OR_EQUAL; - else if (!core_stricmp(params[0].c_str(), "smallerof") || !core_stricmp(params[0].c_str(), "lt") || params[0] == "<") + else if (util::streqlower(params[0], "smallerof") || util::streqlower(params[0], "lt") || params[0] == "<") condition = CHEAT_SMALLEROF; - else if (!core_stricmp(params[0].c_str(), "greaterof") || !core_stricmp(params[0].c_str(), "gt") || params[0] == ">") + else if (util::streqlower(params[0], "greaterof") || util::streqlower(params[0], "gt") || params[0] == ">") condition = CHEAT_GREATEROF; - else if (!core_stricmp(params[0].c_str(), "changedby") || !core_stricmp(params[0].c_str(), "ch") || params[0] == "~") + else if (util::streqlower(params[0], "changedby") || util::streqlower(params[0], "ch") || params[0] == "~") condition = CHEAT_CHANGEDBY; else { @@ -3256,7 +3259,7 @@ void debugger_commands::execute_cheatnext(bool initial, const std::vector<std::s } if (active_cheat <= 5) - execute_cheatlist(std::vector<std::string>()); + execute_cheatlist(std::vector<std::string_view>()); m_console.printf("%u cheats found\n", active_cheat); } @@ -3266,7 +3269,7 @@ void debugger_commands::execute_cheatnext(bool initial, const std::vector<std::s execute_cheatlist - show a list of active cheat -------------------------------------------------*/ -void debugger_commands::execute_cheatlist(const std::vector<std::string> ¶ms) +void debugger_commands::execute_cheatlist(const std::vector<std::string_view> ¶ms) { address_space *const space = m_cheat.space; if (!space) @@ -3278,7 +3281,8 @@ void debugger_commands::execute_cheatlist(const std::vector<std::string> ¶ms FILE *f = nullptr; if (params.size() > 0) { - f = fopen(params[0].c_str(), "w"); + std::string filename(params[0]); + f = fopen(filename.c_str(), "w"); if (!f) { m_console.printf("Error opening file '%s'\n", params[0]); @@ -3383,7 +3387,7 @@ void debugger_commands::execute_cheatlist(const std::vector<std::string> ¶ms execute_cheatundo - undo the last search -------------------------------------------------*/ -void debugger_commands::execute_cheatundo(const std::vector<std::string> ¶ms) +void debugger_commands::execute_cheatundo(const std::vector<std::string_view> ¶ms) { if (m_cheat.undo > 0) { @@ -3412,7 +3416,7 @@ void debugger_commands::execute_cheatundo(const std::vector<std::string> ¶ms execute_find - execute the find command -------------------------------------------------*/ -void debugger_commands::execute_find(int spacenum, const std::vector<std::string> ¶ms) +void debugger_commands::execute_find(int spacenum, const std::vector<std::string_view> ¶ms) { u64 offset, length; address_space *space; @@ -3436,11 +3440,11 @@ void debugger_commands::execute_find(int spacenum, const std::vector<std::string int data_count = 0; for (int i = 2; i < params.size(); i++) { - char const *pdata = params[i].c_str(); - auto const pdatalen = params[i].length() - 1; + std::string_view pdata = params[i]; - if (pdata[0] == '"' && pdata[pdatalen] == '"') // check for a string + if (!pdata.empty() && pdata.front() == '"' && pdata.back() == '"') // check for a string { + auto const pdatalen = params[i].length() - 1; for (int j = 1; j < pdatalen; j++) { data_to_find[data_count] = pdata[j]; @@ -3451,13 +3455,16 @@ void debugger_commands::execute_find(int spacenum, const std::vector<std::string { // check for a 'b','w','d',or 'q' prefix data_size[data_count] = cur_data_size; - if (tolower(u8(pdata[0])) == 'b' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 1; pdata += 2; } - if (tolower(u8(pdata[0])) == 'w' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 2; pdata += 2; } - if (tolower(u8(pdata[0])) == 'd' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 4; pdata += 2; } - if (tolower(u8(pdata[0])) == 'q' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 8; pdata += 2; } + if (pdata.length() >= 2) + { + if (tolower(u8(pdata[0])) == 'b' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 1; pdata.remove_prefix(2); } + if (tolower(u8(pdata[0])) == 'w' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 2; pdata.remove_prefix(2); } + if (tolower(u8(pdata[0])) == 'd' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 4; pdata.remove_prefix(2); } + if (tolower(u8(pdata[0])) == 'q' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 8; pdata.remove_prefix(2); } + } // look for a wildcard - if (!strcmp(pdata, "?")) + if (pdata == "?") data_size[data_count++] |= 0x10; // otherwise, validate as a number @@ -3538,7 +3545,7 @@ void debugger_commands::execute_find(int spacenum, const std::vector<std::string // execute_fill - execute the fill command //------------------------------------------------- -void debugger_commands::execute_fill(int spacenum, const std::vector<std::string> ¶ms) +void debugger_commands::execute_fill(int spacenum, const std::vector<std::string_view> ¶ms) { u64 offset, length; address_space *space; @@ -3561,12 +3568,12 @@ void debugger_commands::execute_fill(int spacenum, const std::vector<std::string int data_count = 0; for (int i = 2; i < params.size(); i++) { - const char *pdata = params[i].c_str(); - size_t pdatalen = strlen(pdata) - 1; + std::string_view pdata = params[i]; // check for a string - if (pdata[0] == '"' && pdata[pdatalen] == '"') + if (!pdata.empty() && pdata.front() == '"' && pdata.back() == '"') { + auto const pdatalen = pdata.length() - 1; for (int j = 1; j < pdatalen; j++) { fill_data[data_count] = pdata[j]; @@ -3579,10 +3586,13 @@ void debugger_commands::execute_fill(int spacenum, const std::vector<std::string { // check for a 'b','w','d',or 'q' prefix fill_data_size[data_count] = cur_data_size; - if (tolower(u8(pdata[0])) == 'b' && pdata[1] == '.') { fill_data_size[data_count] = cur_data_size = 1; pdata += 2; } - if (tolower(u8(pdata[0])) == 'w' && pdata[1] == '.') { fill_data_size[data_count] = cur_data_size = 2; pdata += 2; } - if (tolower(u8(pdata[0])) == 'd' && pdata[1] == '.') { fill_data_size[data_count] = cur_data_size = 4; pdata += 2; } - if (tolower(u8(pdata[0])) == 'q' && pdata[1] == '.') { fill_data_size[data_count] = cur_data_size = 8; pdata += 2; } + if (pdata.length() >= 2) + { + if (tolower(u8(pdata[0])) == 'b' && pdata[1] == '.') { fill_data_size[data_count] = cur_data_size = 1; pdata.remove_prefix(2); } + if (tolower(u8(pdata[0])) == 'w' && pdata[1] == '.') { fill_data_size[data_count] = cur_data_size = 2; pdata.remove_prefix(2); } + if (tolower(u8(pdata[0])) == 'd' && pdata[1] == '.') { fill_data_size[data_count] = cur_data_size = 4; pdata.remove_prefix(2); } + if (tolower(u8(pdata[0])) == 'q' && pdata[1] == '.') { fill_data_size[data_count] = cur_data_size = 8; pdata.remove_prefix(2); } + } // validate as a number if (!validate_number_parameter(pdata, fill_data[data_count++])) @@ -3643,7 +3653,7 @@ void debugger_commands::execute_fill(int spacenum, const std::vector<std::string execute_dasm - execute the dasm command -------------------------------------------------*/ -void debugger_commands::execute_dasm(const std::vector<std::string> ¶ms) +void debugger_commands::execute_dasm(const std::vector<std::string_view> ¶ms) { u64 offset, length; bool bytes = true; @@ -3702,7 +3712,8 @@ void debugger_commands::execute_dasm(const std::vector<std::string> ¶ms) } /* write the data */ - std::ofstream f(params[0]); + std::string fname(params[0]); + std::ofstream f(fname); if (!f.good()) { m_console.printf("Error opening file '%s'\n", params[0]); @@ -3741,14 +3752,14 @@ void debugger_commands::execute_dasm(const std::vector<std::string> ¶ms) trace over and trace info -------------------------------------------------*/ -void debugger_commands::execute_trace(const std::vector<std::string> ¶ms, bool trace_over) +void debugger_commands::execute_trace(const std::vector<std::string_view> ¶ms, bool trace_over) { - const char *action = nullptr; + std::string action; bool detect_loops = true; bool logerror = false; device_t *cpu; const char *mode; - std::string filename = params[0]; + std::string filename(params[0]); // replace macros strreplace(filename, "{game}", m_machine.basename()); @@ -3759,14 +3770,15 @@ void debugger_commands::execute_trace(const std::vector<std::string> ¶ms, bo if (params.size() > 2) { std::stringstream stream; - stream.str(params[2]); + std::string flagparam(params[2]); + stream.str(flagparam); std::string flag; while (std::getline(stream, flag, '|')) { - if (!core_stricmp(flag.c_str(), "noloop")) + if (util::streqlower(flag, "noloop")) detect_loops = false; - else if (!core_stricmp(flag.c_str(), "logerror")) + else if (util::streqlower(flag, "logerror")) logerror = true; else { @@ -3775,12 +3787,12 @@ void debugger_commands::execute_trace(const std::vector<std::string> ¶ms, bo } } } - if (!debug_command_parameter_command(action = (params.size() > 3) ? params[3].c_str() : nullptr)) + if (params.size() > 3 && !debug_command_parameter_command(action = params[3])) return; // open the file FILE *f = nullptr; - if (core_stricmp(filename.c_str(), "off") != 0) + if (!util::streqlower(filename, "off")) { mode = "w"; @@ -3800,7 +3812,7 @@ void debugger_commands::execute_trace(const std::vector<std::string> ¶ms, bo } // do it - cpu->debug()->trace(f, trace_over, detect_loops, logerror, action); + cpu->debug()->trace(f, trace_over, detect_loops, logerror, action.c_str()); if (f) m_console.printf("Tracing CPU '%s' to file %s\n", cpu->tag(), filename); else @@ -3812,7 +3824,7 @@ void debugger_commands::execute_trace(const std::vector<std::string> ¶ms, bo execute_traceflush - execute the trace flush command -------------------------------------------------*/ -void debugger_commands::execute_traceflush(const std::vector<std::string> ¶ms) +void debugger_commands::execute_traceflush(const std::vector<std::string_view> ¶ms) { m_machine.debugger().cpu().flush_traces(); } @@ -3822,7 +3834,7 @@ void debugger_commands::execute_traceflush(const std::vector<std::string> ¶m execute_history - execute the history command -------------------------------------------------*/ -void debugger_commands::execute_history(const std::vector<std::string> ¶ms) +void debugger_commands::execute_history(const std::vector<std::string_view> ¶ms) { // validate parameters device_t *device; @@ -3870,7 +3882,7 @@ void debugger_commands::execute_history(const std::vector<std::string> ¶ms) execute_trackpc - execute the trackpc command -------------------------------------------------*/ -void debugger_commands::execute_trackpc(const std::vector<std::string> ¶ms) +void debugger_commands::execute_trackpc(const std::vector<std::string_view> ¶ms) { // Gather the on/off switch (if present) bool turnOn = true; @@ -3919,7 +3931,7 @@ void debugger_commands::execute_trackpc(const std::vector<std::string> ¶ms) execute_trackmem - execute the trackmem command -------------------------------------------------*/ -void debugger_commands::execute_trackmem(const std::vector<std::string> ¶ms) +void debugger_commands::execute_trackmem(const std::vector<std::string_view> ¶ms) { // Gather the on/off switch (if present) bool turnOn = true; @@ -3957,7 +3969,7 @@ void debugger_commands::execute_trackmem(const std::vector<std::string> ¶ms) execute_pcatmem - execute the pcatmem command -------------------------------------------------*/ -void debugger_commands::execute_pcatmem(int spacenum, const std::vector<std::string> ¶ms) +void debugger_commands::execute_pcatmem(int spacenum, const std::vector<std::string_view> ¶ms) { // Gather the required target address/space parameter u64 address; @@ -4008,7 +4020,7 @@ void debugger_commands::execute_pcatmem(int spacenum, const std::vector<std::str execute_snap - execute the snapshot command -------------------------------------------------*/ -void debugger_commands::execute_snap(const std::vector<std::string> ¶ms) +void debugger_commands::execute_snap(const std::vector<std::string_view> ¶ms) { /* if no params, use the default behavior */ if (params.empty()) @@ -4020,8 +4032,9 @@ void debugger_commands::execute_snap(const std::vector<std::string> ¶ms) /* otherwise, we have to open the file ourselves */ else { - const char *filename = params[0].c_str(); - int scrnum = (params.size() > 1) ? atoi(params[1].c_str()) : 0; + u64 scrnum = 0; + if (params.size() > 1 && !validate_number_parameter(params[1], scrnum)) + return; screen_device_enumerator iter(m_machine.root_device()); screen_device *screen = iter.byindex(scrnum); @@ -4032,7 +4045,7 @@ void debugger_commands::execute_snap(const std::vector<std::string> ¶ms) return; } - std::string fname(filename); + std::string fname(params[0]); if (fname.find(".png") == -1) fname.append(".png"); emu_file file(m_machine.options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); @@ -4040,12 +4053,12 @@ void debugger_commands::execute_snap(const std::vector<std::string> ¶ms) if (filerr) { - m_console.printf("Error creating file '%s' (%s:%d %s)\n", filename, filerr.category().name(), filerr.value(), filerr.message()); + m_console.printf("Error creating file '%s' (%s:%d %s)\n", params[0], filerr.category().name(), filerr.value(), filerr.message()); return; } screen->machine().video().save_snapshot(screen, file); - m_console.printf("Saved screen #%d snapshot as '%s'\n", scrnum, filename); + m_console.printf("Saved screen #%d snapshot as '%s'\n", scrnum, params[0]); } } @@ -4054,9 +4067,10 @@ void debugger_commands::execute_snap(const std::vector<std::string> ¶ms) execute_source - execute the source command -------------------------------------------------*/ -void debugger_commands::execute_source(const std::vector<std::string> ¶ms) +void debugger_commands::execute_source(const std::vector<std::string_view> ¶ms) { - m_console.source_script(params[0].c_str()); + std::string filename(params[0]); + m_console.source_script(filename.c_str()); } @@ -4064,7 +4078,7 @@ void debugger_commands::execute_source(const std::vector<std::string> ¶ms) execute_map - execute the map command -------------------------------------------------*/ -void debugger_commands::execute_map(int spacenum, const std::vector<std::string> ¶ms) +void debugger_commands::execute_map(int spacenum, const std::vector<std::string_view> ¶ms) { // validate parameters u64 address; @@ -4097,14 +4111,15 @@ void debugger_commands::execute_map(int spacenum, const std::vector<std::string> execute_memdump - execute the memdump command -------------------------------------------------*/ -void debugger_commands::execute_memdump(const std::vector<std::string> ¶ms) +void debugger_commands::execute_memdump(const std::vector<std::string_view> ¶ms) { device_t *root = &m_machine.root_device(); if ((params.size() >= 2) && !validate_device_parameter(params[1], root)) return; - char const *const filename = params.empty() ? "memdump.log" : params[0].c_str(); - FILE *const file = fopen(filename, "w"); + using namespace std::literals; + std::string filename = params.empty() ? "memdump.log"s : std::string(params[0]); + FILE *const file = fopen(filename.c_str(), "w"); if (!file) { m_console.printf("Error opening file %s\n", filename); @@ -4163,7 +4178,7 @@ void debugger_commands::execute_memdump(const std::vector<std::string> ¶ms) execute_symlist - execute the symlist command -------------------------------------------------*/ -void debugger_commands::execute_symlist(const std::vector<std::string> ¶ms) +void debugger_commands::execute_symlist(const std::vector<std::string_view> ¶ms) { const char *namelist[1000]; symbol_table *symtable; @@ -4225,7 +4240,7 @@ void debugger_commands::execute_symlist(const std::vector<std::string> ¶ms) execute_softreset - execute the softreset command -------------------------------------------------*/ -void debugger_commands::execute_softreset(const std::vector<std::string> ¶ms) +void debugger_commands::execute_softreset(const std::vector<std::string_view> ¶ms) { m_machine.schedule_soft_reset(); } @@ -4235,7 +4250,7 @@ void debugger_commands::execute_softreset(const std::vector<std::string> ¶ms execute_hardreset - execute the hardreset command -------------------------------------------------*/ -void debugger_commands::execute_hardreset(const std::vector<std::string> ¶ms) +void debugger_commands::execute_hardreset(const std::vector<std::string_view> ¶ms) { m_machine.schedule_hard_reset(); } @@ -4245,7 +4260,7 @@ void debugger_commands::execute_hardreset(const std::vector<std::string> ¶ms mounted files -------------------------------------------------*/ -void debugger_commands::execute_images(const std::vector<std::string> ¶ms) +void debugger_commands::execute_images(const std::vector<std::string_view> ¶ms) { image_interface_enumerator iter(m_machine.root_device()); for (device_image_interface &img : iter) @@ -4275,7 +4290,7 @@ void debugger_commands::execute_images(const std::vector<std::string> ¶ms) execute_mount - execute the image mount command -------------------------------------------------*/ -void debugger_commands::execute_mount(const std::vector<std::string> ¶ms) +void debugger_commands::execute_mount(const std::vector<std::string_view> ¶ms) { for (device_image_interface &img : image_interface_enumerator(m_machine.root_device())) { @@ -4295,7 +4310,7 @@ void debugger_commands::execute_mount(const std::vector<std::string> ¶ms) execute_unmount - execute the image unmount command -------------------------------------------------*/ -void debugger_commands::execute_unmount(const std::vector<std::string> ¶ms) +void debugger_commands::execute_unmount(const std::vector<std::string_view> ¶ms) { for (device_image_interface &img : image_interface_enumerator(m_machine.root_device())) { @@ -4322,7 +4337,7 @@ void debugger_commands::execute_unmount(const std::vector<std::string> ¶ms) natural keyboard input -------------------------------------------------*/ -void debugger_commands::execute_input(const std::vector<std::string> ¶ms) +void debugger_commands::execute_input(const std::vector<std::string_view> ¶ms) { m_machine.natkeyboard().post_coded(params[0]); } @@ -4333,15 +4348,15 @@ void debugger_commands::execute_input(const std::vector<std::string> ¶ms) keyboard codes -------------------------------------------------*/ -void debugger_commands::execute_dumpkbd(const std::vector<std::string> ¶ms) +void debugger_commands::execute_dumpkbd(const std::vector<std::string_view> ¶ms) { // was there a file specified? - const char *filename = !params.empty() ? params[0].c_str() : nullptr; + std::string filename = !params.empty() ? std::string(params[0]) : std::string(); FILE *file = nullptr; - if (filename != nullptr) + if (!filename.empty()) { // if so, open it - file = fopen(filename, "w"); + file = fopen(filename.c_str(), "w"); if (file == nullptr) { m_console.printf("Cannot open \"%s\"\n", filename); |