summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/debug/debugcmd.cpp
diff options
context:
space:
mode:
author Nathan Woods <npwoods@mess.org>2017-01-15 16:10:51 -0500
committer Nathan Woods <npwoods@mess.org>2017-01-15 16:19:03 -0500
commit46b62fb1946ea80dcb668d019ee0d4471c6c2f21 (patch)
tree04887162bcd182d79048f12b24849d3c16845e26 /src/emu/debug/debugcmd.cpp
parent063ea0512c45447dc44c28971deaccd0712160f3 (diff)
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
Diffstat (limited to 'src/emu/debug/debugcmd.cpp')
-rw-r--r--src/emu/debug/debugcmd.cpp37
1 files changed, 37 insertions, 0 deletions
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));
@@ -725,6 +726,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
-------------------------------------------------*/