summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/debug/debugcmd.cpp
diff options
context:
space:
mode:
author smf- <smf-@users.noreply.github.com>2016-09-20 13:28:39 +0100
committer smf- <smf-@users.noreply.github.com>2016-09-20 13:34:54 +0100
commitc56cd675f241ae1ff1451deb0c974341e9dd7322 (patch)
treeaac6b8eaaa2cceddcff655b25d072cb973495226 /src/emu/debug/debugcmd.cpp
parent4c791d4320e4a7ce42c63119f928d7a5f8d61edc (diff)
Fixed trace command access a parameter beyond the list supplied, added an error message if you provide an invalid boolean, allow boolean to be case-insensitive and skip empty strings when parsing booleans. [smf]
Diffstat (limited to 'src/emu/debug/debugcmd.cpp')
-rw-r--r--src/emu/debug/debugcmd.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp
index cba9368dbf4..99cdefb3b36 100644
--- a/src/emu/debug/debugcmd.cpp
+++ b/src/emu/debug/debugcmd.cpp
@@ -387,15 +387,18 @@ bool debugger_commands::validate_number_parameter(const char *param, UINT64 *res
bool debugger_commands::validate_boolean_parameter(const char *param, bool *result)
{
/* nullptr parameter does nothing and returns no error */
- if (param == nullptr)
+ if (param == nullptr || strlen(param) == 0)
return true;
/* evaluate the expression; success if no error */
- bool is_true = (strcmp(param, "true") == 0 || strcmp(param, "TRUE") == 0 || strcmp(param, "1") == 0);
- bool is_false = (strcmp(param, "false") == 0 || strcmp(param, "FALSE") == 0 || strcmp(param, "0") == 0);
+ bool is_true = (core_stricmp(param, "true") == 0 || strcmp(param, "1") == 0);
+ bool is_false = (core_stricmp(param, "false") == 0 || strcmp(param, "0") == 0);
if (!is_true && !is_false)
+ {
+ m_console.printf("Invalid boolean '%s'\n", param);
return false;
+ }
*result = is_true;
@@ -2482,7 +2485,7 @@ void debugger_commands::execute_trace_internal(int ref, int params, const char *
return;
if (!validate_boolean_parameter((params > 2) ? param[2] : nullptr, &detect_loops))
return;
- if (!debug_command_parameter_command(action = param[3]))
+ if (!debug_command_parameter_command(action = (params > 3) ? param[3] : nullptr))
return;
/* open the file */