summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/debugger
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2019-09-10 15:11:00 -0400
committer AJR <ajrhacker@users.noreply.github.com>2019-09-10 15:11:02 -0400
commit53df4f447db0408d00bdcbee3105e013bdd19c3a (patch)
tree0ccccacae81b902088f16cf704345fa53b3b252b /src/osd/modules/debugger
parente52c9cc290a710c11fef4a08c715e46d04db9f07 (diff)
Use std::forward_list for breakpoint and registerpoint lists (nw)
Diffstat (limited to 'src/osd/modules/debugger')
-rw-r--r--src/osd/modules/debugger/debuggdbstub.cpp10
-rw-r--r--src/osd/modules/debugger/osx/debugconsole.mm11
-rw-r--r--src/osd/modules/debugger/osx/debugwindowhandler.h2
-rw-r--r--src/osd/modules/debugger/osx/debugwindowhandler.mm8
-rw-r--r--src/osd/modules/debugger/osx/disassemblyviewer.mm9
-rw-r--r--src/osd/modules/debugger/qt/dasmwindow.cpp25
-rw-r--r--src/osd/modules/debugger/qt/mainwindow.cpp28
-rw-r--r--src/osd/modules/debugger/win/disasmbasewininfo.cpp27
8 files changed, 32 insertions, 88 deletions
diff --git a/src/osd/modules/debugger/debuggdbstub.cpp b/src/osd/modules/debugger/debuggdbstub.cpp
index 4028dd3b994..4c7e4e3707e 100644
--- a/src/osd/modules/debugger/debuggdbstub.cpp
+++ b/src/osd/modules/debugger/debuggdbstub.cpp
@@ -977,13 +977,9 @@ debug_gdbstub::cmd_reply debug_gdbstub::handle_s(const char *buf)
//-------------------------------------------------------------------------
static bool remove_breakpoint(device_debug *debug, uint64_t address, int /*kind*/)
{
- device_debug::breakpoint *bp = debug->breakpoint_first();
- while ( bp != nullptr )
- {
- if ( bp->address() == address )
- return debug->breakpoint_clear(bp->index());
- bp = bp->next();
- }
+ const device_debug::breakpoint *bp = debug->breakpoint_find(address);
+ if (bp != nullptr)
+ return debug->breakpoint_clear(bp->index());
return false;
}
diff --git a/src/osd/modules/debugger/osx/debugconsole.mm b/src/osd/modules/debugger/osx/debugconsole.mm
index b6c02c67224..1bd285e8c3b 100644
--- a/src/osd/modules/debugger/osx/debugconsole.mm
+++ b/src/osd/modules/debugger/osx/debugconsole.mm
@@ -237,8 +237,7 @@
if ([dasmView cursorVisible] && (machine->debugger().cpu().get_visible_cpu() == &device))
{
offs_t const address = [dasmView selectedAddress];
- device_debug::breakpoint *bp = [[self class] findBreakpointAtAddress:address
- forDevice:device];
+ const device_debug::breakpoint *bp = [dasmView source]->device()->debug()->breakpoint_find(address);
// if it doesn't exist, add a new one
NSString *command;
@@ -255,8 +254,7 @@
device_t &device = *[dasmView source]->device();
if ([dasmView cursorVisible] && (machine->debugger().cpu().get_visible_cpu() == &device))
{
- device_debug::breakpoint *bp = [[self class] findBreakpointAtAddress:[dasmView selectedAddress]
- forDevice:device];
+ const device_debug::breakpoint *bp = [dasmView source]->device()->debug()->breakpoint_find([dasmView selectedAddress]);
if (bp != nullptr)
{
NSString *command;
@@ -566,11 +564,10 @@
BOOL const haveCursor = [dasmView cursorVisible];
BOOL const isCurrent = (machine->debugger().cpu().get_visible_cpu() == [dasmView source]->device());
- device_debug::breakpoint *breakpoint = nullptr;
+ const device_debug::breakpoint *breakpoint = nullptr;
if (haveCursor)
{
- breakpoint = [[self class] findBreakpointAtAddress:[dasmView selectedAddress]
- forDevice:*[dasmView source]->device()];
+ breakpoint = [dasmView source]->device()->debug()->breakpoint_find([dasmView selectedAddress]);
}
if (action == @selector(debugToggleBreakpoint:))
diff --git a/src/osd/modules/debugger/osx/debugwindowhandler.h b/src/osd/modules/debugger/osx/debugwindowhandler.h
index 4feeff267c9..c48bbb031b2 100644
--- a/src/osd/modules/debugger/osx/debugwindowhandler.h
+++ b/src/osd/modules/debugger/osx/debugwindowhandler.h
@@ -45,8 +45,6 @@ enum
+ (void)addCommonActionItems:(NSMenu *)menu;
+ (NSPopUpButton *)newActionButtonWithFrame:(NSRect)frame;
-+ (device_debug::breakpoint *)findBreakpointAtAddress:(offs_t)address forDevice:(device_t &)device;
-
- (id)initWithMachine:(running_machine &)m title:(NSString *)t;
- (void)activate;
diff --git a/src/osd/modules/debugger/osx/debugwindowhandler.mm b/src/osd/modules/debugger/osx/debugwindowhandler.mm
index 1f483139452..27d487c86ff 100644
--- a/src/osd/modules/debugger/osx/debugwindowhandler.mm
+++ b/src/osd/modules/debugger/osx/debugwindowhandler.mm
@@ -134,14 +134,6 @@ NSString *const MAMESaveDebuggerConfigurationNotification = @"MAMESaveDebuggerCo
}
-+ (device_debug::breakpoint *)findBreakpointAtAddress:(offs_t)address forDevice:(device_t &)device {
- device_debug *const cpuinfo = device.debug();
- device_debug::breakpoint *bp = cpuinfo->breakpoint_first();
- while ((bp != nullptr) && (address != bp->address())) bp = bp->next();
- return bp;
-}
-
-
- (id)initWithMachine:(running_machine &)m title:(NSString *)t {
if (!(self = [super init]))
return nil;
diff --git a/src/osd/modules/debugger/osx/disassemblyviewer.mm b/src/osd/modules/debugger/osx/disassemblyviewer.mm
index 5c9c1c8aa23..eb039f4ca17 100644
--- a/src/osd/modules/debugger/osx/disassemblyviewer.mm
+++ b/src/osd/modules/debugger/osx/disassemblyviewer.mm
@@ -176,7 +176,7 @@
{
device_t &device = *[dasmView source]->device();
offs_t const address = [dasmView selectedAddress];
- device_debug::breakpoint *bp = [[self class] findBreakpointAtAddress:address forDevice:device];
+ const device_debug::breakpoint *bp = device.debug()->breakpoint_find(address);
// if it doesn't exist, add a new one
if (bp == nullptr)
@@ -203,7 +203,7 @@
{
device_t &device = *[dasmView source]->device();
offs_t const address = [dasmView selectedAddress];
- device_debug::breakpoint *bp = [[self class] findBreakpointAtAddress:address forDevice:device];
+ const device_debug::breakpoint *bp = device.debug()->breakpoint_find(address);
if (bp != nullptr)
{
device.debug()->breakpoint_enable(bp->index(), !bp->enabled());
@@ -252,11 +252,10 @@
BOOL const inContextMenu = ([item menu] == [dasmView menu]);
BOOL const haveCursor = [dasmView cursorVisible];
- device_debug::breakpoint *breakpoint = nullptr;
+ const device_debug::breakpoint *breakpoint = nullptr;
if (haveCursor)
{
- breakpoint = [[self class] findBreakpointAtAddress:[dasmView selectedAddress]
- forDevice:*[dasmView source]->device()];
+ breakpoint = [dasmView source]->device()->debug()->breakpoint_find([dasmView selectedAddress]);
}
if (action == @selector(debugToggleBreakpoint:))
diff --git a/src/osd/modules/debugger/qt/dasmwindow.cpp b/src/osd/modules/debugger/qt/dasmwindow.cpp
index 396f97c78bf..5c575b400b1 100644
--- a/src/osd/modules/debugger/qt/dasmwindow.cpp
+++ b/src/osd/modules/debugger/qt/dasmwindow.cpp
@@ -143,26 +143,17 @@ void DasmWindow::toggleBreakpointAtCursor(bool changedTo)
device_debug *const cpuinfo = device->debug();
// Find an existing breakpoint at this address
- int32_t bpindex = -1;
- for (device_debug::breakpoint* bp = cpuinfo->breakpoint_first();
- bp != nullptr;
- bp = bp->next())
- {
- if (address == bp->address())
- {
- bpindex = bp->index();
- break;
- }
- }
+ const device_debug::breakpoint *bp = cpuinfo->breakpoint_find(address);
// If none exists, add a new one
- if (bpindex == -1)
+ if (bp == nullptr)
{
- bpindex = cpuinfo->breakpoint_set(address, nullptr, nullptr);
+ int32_t bpindex = cpuinfo->breakpoint_set(address, nullptr, nullptr);
m_machine->debugger().console().printf("Breakpoint %X set\n", bpindex);
}
else
{
+ int32_t bpindex = bp->index();
cpuinfo->breakpoint_clear(bpindex);
m_machine->debugger().console().printf("Breakpoint %X cleared\n", bpindex);
}
@@ -183,9 +174,7 @@ void DasmWindow::enableBreakpointAtCursor(bool changedTo)
device_debug *const cpuinfo = device->debug();
// Find an existing breakpoint at this address
- device_debug::breakpoint* bp = cpuinfo->breakpoint_first();
- while ((bp != nullptr) && (bp->address() != address))
- bp = bp->next();
+ const device_debug::breakpoint *bp = cpuinfo->breakpoint_find(address);
if (bp != nullptr)
{
@@ -241,9 +230,7 @@ void DasmWindow::dasmViewUpdated()
device_debug *const cpuinfo = device->debug();
// Find an existing breakpoint at this address
- device_debug::breakpoint* bp = cpuinfo->breakpoint_first();
- while ((bp != nullptr) && (bp->address() != address))
- bp = bp->next();
+ const device_debug::breakpoint *bp = cpuinfo->breakpoint_find(address);
if (bp != nullptr)
{
diff --git a/src/osd/modules/debugger/qt/mainwindow.cpp b/src/osd/modules/debugger/qt/mainwindow.cpp
index fffe3577e9e..84aad82e363 100644
--- a/src/osd/modules/debugger/qt/mainwindow.cpp
+++ b/src/osd/modules/debugger/qt/mainwindow.cpp
@@ -220,27 +220,17 @@ void MainWindow::toggleBreakpointAtCursor(bool changedTo)
device_debug *const cpuinfo = dasmView->source()->device()->debug();
// Find an existing breakpoint at this address
- int32_t bpindex = -1;
- for (device_debug::breakpoint* bp = cpuinfo->breakpoint_first();
- bp != nullptr;
- bp = bp->next())
- {
- if (address == bp->address())
- {
- bpindex = bp->index();
- break;
- }
- }
+ const device_debug::breakpoint *bp = cpuinfo->breakpoint_find(address);
// If none exists, add a new one
std::string command;
- if (bpindex == -1)
+ if (bp == nullptr)
{
command = string_format("bpset 0x%X", address);
}
else
{
- command = string_format("bpclear 0x%X", bpindex);
+ command = string_format("bpclear 0x%X", bp.index());
}
m_machine->debugger().console().execute_command(command.c_str(), true);
}
@@ -258,14 +248,12 @@ void MainWindow::enableBreakpointAtCursor(bool changedTo)
device_debug *const cpuinfo = dasmView->source()->device()->debug();
// Find an existing breakpoint at this address
- device_debug::breakpoint* bp = cpuinfo->breakpoint_first();
- while ((bp != nullptr) && (bp->address() != address))
- bp = bp->next();
+ const device_debug::breakpoint *bp = cpuinfo->breakpoint_find(address);
if (bp != nullptr)
{
- int32_t const bpindex = bp->index();
- std::string command = string_format(bp->enabled() ? "bpdisable 0x%X" : "bpenable 0x%X", bpindex);
+ int32_t const bpindex = bp.index();
+ std::string command = string_format(bp.enabled() ? "bpdisable 0x%X" : "bpenable 0x%X", bpindex);
m_machine->debugger().console().execute_command(command.c_str(), true);
}
}
@@ -418,9 +406,7 @@ void MainWindow::dasmViewUpdated()
device_debug *const cpuinfo = device->debug();
// Find an existing breakpoint at this address
- device_debug::breakpoint* bp = cpuinfo->breakpoint_first();
- while ((bp != nullptr) && (bp->address() != address))
- bp = bp->next();
+ const device_debug::breakpoint *bp = cpuinfo->breakpoint_find(address);
if (bp != nullptr)
{
diff --git a/src/osd/modules/debugger/win/disasmbasewininfo.cpp b/src/osd/modules/debugger/win/disasmbasewininfo.cpp
index ef4c5122ba6..c466e059f23 100644
--- a/src/osd/modules/debugger/win/disasmbasewininfo.cpp
+++ b/src/osd/modules/debugger/win/disasmbasewininfo.cpp
@@ -115,9 +115,7 @@ void disasmbasewin_info::update_menu()
device_debug *const debug = dasmview->source_device()->debug();
// first find an existing breakpoint at this address
- device_debug::breakpoint *bp = debug->breakpoint_first();
- while ((bp != nullptr) && (bp->address() != address))
- bp = bp->next();
+ const device_debug::breakpoint *bp = debug->breakpoint_find(address);
if (bp == nullptr)
{
@@ -166,28 +164,21 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam)
{
offs_t const address = dasmview->selected_address();
device_debug *const debug = dasmview->source_device()->debug();
- int32_t bpindex = -1;
// first find an existing breakpoint at this address
- for (device_debug::breakpoint *bp = debug->breakpoint_first(); bp != nullptr; bp = bp->next())
- {
- if (address == bp->address())
- {
- bpindex = bp->index();
- break;
- }
- }
+ const device_debug::breakpoint *bp = debug->breakpoint_find(address);
// if it doesn't exist, add a new one
if (!is_main_console())
{
- if (bpindex == -1)
+ if (bp == nullptr)
{
- bpindex = debug->breakpoint_set(address, nullptr, nullptr);
+ int32_t bpindex = debug->breakpoint_set(address, nullptr, nullptr);
machine().debugger().console().printf("Breakpoint %X set\n", bpindex);
}
else
{
+ int32_t bpindex = bp->index();
debug->breakpoint_clear(bpindex);
machine().debugger().console().printf("Breakpoint %X cleared\n", bpindex);
}
@@ -197,10 +188,10 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam)
else if (dasmview->source_is_visible_cpu())
{
std::string command;
- if (bpindex == -1)
+ if (bp == nullptr)
command = string_format("bpset 0x%X", address);
else
- command = string_format("bpclear 0x%X", bpindex);
+ command = string_format("bpclear 0x%X", bp->index());
machine().debugger().console().execute_command(command.c_str(), true);
}
}
@@ -213,9 +204,7 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam)
device_debug *const debug = dasmview->source_device()->debug();
// first find an existing breakpoint at this address
- device_debug::breakpoint *bp = debug->breakpoint_first();
- while ((bp != nullptr) && (bp->address() != address))
- bp = bp->next();
+ const device_debug::breakpoint *bp = debug->breakpoint_find(address);
// if it doesn't exist, add a new one
if (bp != nullptr)