From b380514764cf857469bae61c11143a19f79a74c5 Mon Sep 17 00:00:00 2001 From: andreasnaive Date: Mon, 25 Mar 2019 23:13:40 +0100 Subject: Revert "conflict resolution (nw)" This reverts commit c24473ddff715ecec2e258a6eb38960cf8c8e98e, reversing changes made to 009cba4fb8102102168ef32870892438327f3705. --- src/emu/debug/debugcmd.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'src/emu/debug/debugcmd.cpp') diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index 66bc8578464..05fb6acbddd 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -21,7 +21,6 @@ #include "natkeyboard.h" #include "render.h" #include -#include #include @@ -461,17 +460,12 @@ bool debugger_commands::validate_cpu_parameter(const char *param, device_t *&res return false; } - // attempt to find by numerical index - int index = 0; - for (device_execute_interface &exec : execute_interface_iterator(m_machine.root_device())) + /* if we got a valid one, return */ + device_execute_interface *exec = execute_interface_iterator(m_machine.root_device()).byindex(cpunum); + if (exec != nullptr) { - // 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; - } + result = &exec->device(); + return true; } /* if out of range, complain */ @@ -3221,6 +3215,13 @@ void debugger_commands::execute_memdump(int ref, const std::vector 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 ¶ms) { device_t *cpu = nullptr; @@ -3256,9 +3257,7 @@ void debugger_commands::execute_symlist(int ref, const std::vector /* sort the symbols */ if (count > 1) - std::sort(&namelist[0], &namelist[count], [](const char *item1, const char *item2) { - return strcmp(item1, item2) < 0; - }); + qsort((void *)namelist, count, sizeof(namelist[0]), symbol_sort_compare); /* iterate over symbols and print out relevant ones */ for (symnum = 0; symnum < count; symnum++) -- cgit v1.2.3-70-g09d2