mirror of
https://github.com/holub/mame
synced 2025-10-06 17:08:28 +03:00
simplify (nw)
This commit is contained in:
parent
8eb32c4c4b
commit
7dec0b4143
@ -16,26 +16,12 @@
|
|||||||
#include "debug/debugvw.h"
|
#include "debug/debugvw.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
TYPE DEFINITIONS
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
struct machine_entry
|
|
||||||
{
|
|
||||||
machine_entry * next;
|
|
||||||
running_machine * machine;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
GLOBAL VARIABLES
|
GLOBAL VARIABLES
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static machine_entry *machine_list;
|
static running_machine *g_machine = nullptr;
|
||||||
static int atexit_registered;
|
static int g_atexit_registered = FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -60,25 +46,20 @@ void debugger_init(running_machine &machine)
|
|||||||
/* only if debugging is enabled */
|
/* only if debugging is enabled */
|
||||||
if (machine.debug_flags & DEBUG_FLAG_ENABLED)
|
if (machine.debug_flags & DEBUG_FLAG_ENABLED)
|
||||||
{
|
{
|
||||||
machine_entry *entry;
|
|
||||||
|
|
||||||
/* initialize the submodules */
|
/* initialize the submodules */
|
||||||
machine.m_debug_view.reset(global_alloc(debug_view_manager(machine)));
|
machine.m_debug_view = std::make_unique<debug_view_manager>(machine);
|
||||||
debug_cpu_init(machine);
|
debug_cpu_init(machine);
|
||||||
debug_command_init(machine);
|
debug_command_init(machine);
|
||||||
debug_console_init(machine);
|
debug_console_init(machine);
|
||||||
|
|
||||||
/* allocate a new entry for our global list */
|
/* allocate a new entry for our global list */
|
||||||
machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(debugger_exit), &machine));
|
machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(debugger_exit), &machine));
|
||||||
entry = global_alloc(machine_entry);
|
g_machine = &machine;
|
||||||
entry->next = machine_list;
|
|
||||||
entry->machine = &machine;
|
|
||||||
machine_list = entry;
|
|
||||||
|
|
||||||
/* register an atexit handler if we haven't yet */
|
/* register an atexit handler if we haven't yet */
|
||||||
if (!atexit_registered)
|
if (!g_atexit_registered)
|
||||||
atexit(debugger_flush_all_traces_on_abnormal_exit);
|
atexit(debugger_flush_all_traces_on_abnormal_exit);
|
||||||
atexit_registered = TRUE;
|
g_atexit_registered = TRUE;
|
||||||
|
|
||||||
/* listen in on the errorlog */
|
/* listen in on the errorlog */
|
||||||
machine.add_logerror_callback(debug_errorlog_write_line);
|
machine.add_logerror_callback(debug_errorlog_write_line);
|
||||||
@ -107,17 +88,7 @@ void debugger_refresh_display(running_machine &machine)
|
|||||||
|
|
||||||
static void debugger_exit(running_machine &machine)
|
static void debugger_exit(running_machine &machine)
|
||||||
{
|
{
|
||||||
machine_entry **entryptr;
|
g_machine = nullptr;
|
||||||
|
|
||||||
/* remove this machine from the list; it came down cleanly */
|
|
||||||
for (entryptr = &machine_list; *entryptr != nullptr; entryptr = &(*entryptr)->next)
|
|
||||||
if ((*entryptr)->machine == &machine)
|
|
||||||
{
|
|
||||||
machine_entry *deleteme = *entryptr;
|
|
||||||
*entryptr = deleteme->next;
|
|
||||||
global_free(deleteme);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -129,12 +100,8 @@ static void debugger_exit(running_machine &machine)
|
|||||||
|
|
||||||
void debugger_flush_all_traces_on_abnormal_exit(void)
|
void debugger_flush_all_traces_on_abnormal_exit(void)
|
||||||
{
|
{
|
||||||
/* clear out the machine list and flush traces on each one */
|
if(g_machine!=nullptr)
|
||||||
while (machine_list != nullptr)
|
|
||||||
{
|
{
|
||||||
machine_entry *deleteme = machine_list;
|
debug_cpu_flush_traces(*g_machine);
|
||||||
debug_cpu_flush_traces(*deleteme->machine);
|
|
||||||
machine_list = deleteme->next;
|
|
||||||
global_free(deleteme);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user