summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/debug/debugcmd.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2019-03-26 11:13:37 +1100
committer Vas Crabb <vas@vastheman.com>2019-03-26 11:13:37 +1100
commit97b67170277437131adf6ed4d60139c172529e4f (patch)
tree7a5cbf608f191075f1612b1af15832c206a3fe2d /src/emu/debug/debugcmd.cpp
parentb380514764cf857469bae61c11143a19f79a74c5 (diff)
(nw) Clean up the mess on master
This effectively reverts b380514764cf857469bae61c11143a19f79a74c5 and c24473ddff715ecec2e258a6eb38960cf8c8e98e, restoring the state at 598cd5227223c3b04ca31f0dbc1981256d9ea3ff. Before pushing, please check that what you're about to push is sane. Check your local commit log and ensure there isn't anything out-of-place before pushing to mainline. When things like this happen, it wastes everyone's time. I really don't need this in a week when real work™ is busting my balls and I'm behind where I want to be with preparing for MAME release.
Diffstat (limited to 'src/emu/debug/debugcmd.cpp')
-rw-r--r--src/emu/debug/debugcmd.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp
index 05fb6acbddd..66bc8578464 100644
--- a/src/emu/debug/debugcmd.cpp
+++ b/src/emu/debug/debugcmd.cpp
@@ -21,6 +21,7 @@
#include "natkeyboard.h"
#include "render.h"
#include <ctype.h>
+#include <algorithm>
#include <fstream>
@@ -460,12 +461,17 @@ bool debugger_commands::validate_cpu_parameter(const char *param, device_t *&res
return false;
}
- /* if we got a valid one, return */
- device_execute_interface *exec = execute_interface_iterator(m_machine.root_device()).byindex(cpunum);
- if (exec != nullptr)
+ // attempt to find by numerical index
+ int index = 0;
+ for (device_execute_interface &exec : execute_interface_iterator(m_machine.root_device()))
{
- result = &exec->device();
- return true;
+ // real CPUs should have pcbase
+ const device_state_interface *state;
+ if (exec.device().interface(state) && state->state_find_entry(STATE_GENPCBASE) != nullptr && index++ == cpunum)
+ {
+ result = &exec.device();
+ return true;
+ }
}
/* if out of range, complain */
@@ -3215,13 +3221,6 @@ void debugger_commands::execute_memdump(int ref, const std::vector<std::string>
execute_symlist - execute the symlist command
-------------------------------------------------*/
-static int CLIB_DECL symbol_sort_compare(const void *item1, const void *item2)
-{
- const char *str1 = *(const char **)item1;
- const char *str2 = *(const char **)item2;
- return strcmp(str1, str2);
-}
-
void debugger_commands::execute_symlist(int ref, const std::vector<std::string> &params)
{
device_t *cpu = nullptr;
@@ -3257,7 +3256,9 @@ void debugger_commands::execute_symlist(int ref, const std::vector<std::string>
/* sort the symbols */
if (count > 1)
- qsort((void *)namelist, count, sizeof(namelist[0]), symbol_sort_compare);
+ std::sort(&namelist[0], &namelist[count], [](const char *item1, const char *item2) {
+ return strcmp(item1, item2) < 0;
+ });
/* iterate over symbols and print out relevant ones */
for (symnum = 0; symnum < count; symnum++)