From 46b62fb1946ea80dcb668d019ee0d4471c6c2f21 Mon Sep 17 00:00:00 2001 From: Nathan Woods Date: Sun, 15 Jan 2017 16:10:51 -0500 Subject: Created a new debugger command 'tracesym' 'tracesym' is intended to be a shorthand of 'tracelog', whereby the user doesn't have to specify a format string; the default format string is used --- src/emu/debug/debugcmd.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/emu/debug/debugcmd.cpp') diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index 5469670caa6..c2427d5eae8 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -136,6 +136,7 @@ debugger_commands::debugger_commands(running_machine& machine, debugger_cpu& cpu 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("tracesym", CMDFLAG_NONE, 0, 1, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_tracesym, 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)); @@ -724,6 +725,42 @@ void debugger_commands::execute_tracelog(int ref, int params, const char *param[ } +/*------------------------------------------------- + execute_tracesym - execute the tracesym command +-------------------------------------------------*/ + +void debugger_commands::execute_tracesym(int ref, int params, const char *param[]) +{ + // build a format string appropriate for the parameters and validate them + std::stringstream format; + u64 values[MAX_COMMAND_PARAMS]; + for (int i = 0; i < params; i++) + { + // find this symbol + symbol_entry *sym = m_cpu.get_visible_symtable()->find(param[i]); + if (!sym) + { + m_console.printf("Unknown symbol: %s\n", param[i]); + return; + } + + // build the format string + util::stream_format(format, "%s=%s ", + param[i], + sym->format().empty() ? "%16X" : sym->format()); + + // validate the parameter + if (!validate_number_parameter(param[i], &values[i])) + return; + } + + // then do a printf + char buffer[1024]; + if (mini_printf(buffer, format.str().c_str(), params, values)) + m_cpu.get_visible_cpu()->debug()->trace_printf("%s", buffer); +} + + /*------------------------------------------------- execute_quit - execute the quit command -------------------------------------------------*/ -- cgit v1.2.3