summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/debug/dvwpoints.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/debug/dvwpoints.cpp')
-rw-r--r--src/emu/debug/dvwpoints.cpp65
1 files changed, 35 insertions, 30 deletions
diff --git a/src/emu/debug/dvwpoints.cpp b/src/emu/debug/dvwpoints.cpp
index b0584b5d61c..116904232a1 100644
--- a/src/emu/debug/dvwpoints.cpp
+++ b/src/emu/debug/dvwpoints.cpp
@@ -1,8 +1,8 @@
// license:BSD-3-Clause
-// copyright-holders:Aaron Giles
+// copyright-holders:Andrew Gardner, Vas Crabb
/*********************************************************************
- dvwpoints.c
+ dvwpoints.cpp
Watchpoint debugger view.
@@ -11,87 +11,90 @@
#include "emu.h"
#include "dvwpoints.h"
+#include "debugcpu.h"
+#include "points.h"
+
#include <algorithm>
#include <iomanip>
-static bool cIndexAscending(const device_debug::watchpoint *a, const device_debug::watchpoint *b)
+static bool cIndexAscending(const debug_watchpoint *a, const debug_watchpoint *b)
{
return a->index() < b->index();
}
-static bool cIndexDescending(const device_debug::watchpoint *a, const device_debug::watchpoint *b)
+static bool cIndexDescending(const debug_watchpoint *a, const debug_watchpoint *b)
{
return cIndexAscending(b, a);
}
-static bool cEnabledAscending(const device_debug::watchpoint *a, const device_debug::watchpoint *b)
+static bool cEnabledAscending(const debug_watchpoint *a, const debug_watchpoint *b)
{
return !a->enabled() && b->enabled();
}
-static bool cEnabledDescending(const device_debug::watchpoint *a, const device_debug::watchpoint *b)
+static bool cEnabledDescending(const debug_watchpoint *a, const debug_watchpoint *b)
{
return cEnabledAscending(b, a);
}
-static bool cCpuAscending(const device_debug::watchpoint *a, const device_debug::watchpoint *b)
+static bool cCpuAscending(const debug_watchpoint *a, const debug_watchpoint *b)
{
return strcmp(a->debugInterface()->device().tag(), b->debugInterface()->device().tag()) < 0;
}
-static bool cCpuDescending(const device_debug::watchpoint *a, const device_debug::watchpoint *b)
+static bool cCpuDescending(const debug_watchpoint *a, const debug_watchpoint *b)
{
return cCpuAscending(b, a);
}
-static bool cSpaceAscending(const device_debug::watchpoint *a, const device_debug::watchpoint *b)
+static bool cSpaceAscending(const debug_watchpoint *a, const debug_watchpoint *b)
{
return strcmp(a->space().name(), b->space().name()) < 0;
}
-static bool cSpaceDescending(const device_debug::watchpoint *a, const device_debug::watchpoint *b)
+static bool cSpaceDescending(const debug_watchpoint *a, const debug_watchpoint *b)
{
return cSpaceAscending(b, a);
}
-static bool cAddressAscending(const device_debug::watchpoint *a, const device_debug::watchpoint *b)
+static bool cAddressAscending(const debug_watchpoint *a, const debug_watchpoint *b)
{
return a->address() < b->address();
}
-static bool cAddressDescending(const device_debug::watchpoint *a, const device_debug::watchpoint *b)
+static bool cAddressDescending(const debug_watchpoint *a, const debug_watchpoint *b)
{
return cAddressAscending(b, a);
}
-static bool cTypeAscending(const device_debug::watchpoint *a, const device_debug::watchpoint *b)
+static bool cTypeAscending(const debug_watchpoint *a, const debug_watchpoint *b)
{
return int(a->type()) < int(b->type());
}
-static bool cTypeDescending(const device_debug::watchpoint *a, const device_debug::watchpoint *b)
+static bool cTypeDescending(const debug_watchpoint *a, const debug_watchpoint *b)
{
return cTypeAscending(b, a);
}
-static bool cConditionAscending(const device_debug::watchpoint *a, const device_debug::watchpoint *b)
+static bool cConditionAscending(const debug_watchpoint *a, const debug_watchpoint *b)
{
return strcmp(a->condition(), b->condition()) < 0;
}
-static bool cConditionDescending(const device_debug::watchpoint *a, const device_debug::watchpoint *b)
+static bool cConditionDescending(const debug_watchpoint *a, const debug_watchpoint *b)
{
return cConditionAscending(b, a);
}
-static bool cActionAscending(const device_debug::watchpoint *a, const device_debug::watchpoint *b)
+static bool cActionAscending(const debug_watchpoint *a, const debug_watchpoint *b)
{
return a->action() < b->action();
}
-static bool cActionDescending(const device_debug::watchpoint *a, const device_debug::watchpoint *b)
+static bool cActionDescending(const debug_watchpoint *a, const debug_watchpoint *b)
{
return cActionAscending(b, a);
}
@@ -113,7 +116,7 @@ debug_view_watchpoints::debug_view_watchpoints(running_machine &machine, debug_v
{
// fail if no available sources
enumerate_sources();
- if (m_source_list.count() == 0)
+ if (m_source_list.empty())
throw std::bad_alloc();
}
@@ -135,18 +138,20 @@ debug_view_watchpoints::~debug_view_watchpoints()
void debug_view_watchpoints::enumerate_sources()
{
// start with an empty list
- m_source_list.reset();
+ m_source_list.clear();
// iterate over devices with disassembly interfaces
- for (device_disasm_interface &dasm : disasm_interface_iterator(machine().root_device()))
+ for (device_disasm_interface &dasm : disasm_interface_enumerator(machine().root_device()))
{
- std::string name;
- name = string_format("%s '%s'", dasm.device().name(), dasm.device().tag());
- m_source_list.append(*global_alloc(debug_view_source(name.c_str(), &dasm.device())));
+ m_source_list.emplace_back(
+ std::make_unique<debug_view_source>(
+ util::string_format("%s '%s'", dasm.device().name(), dasm.device().tag()),
+ &dasm.device()));
}
// reset the source to a known good entry
- set_source(*m_source_list.first());
+ if (!m_source_list.empty())
+ set_source(*m_source_list[0]);
}
@@ -208,10 +213,10 @@ void debug_view_watchpoints::pad_ostream_to_length(std::ostream& str, int len)
void debug_view_watchpoints::gather_watchpoints()
{
m_buffer.resize(0);
- for (const debug_view_source &source : m_source_list)
+ for (auto &source : m_source_list)
{
// Collect
- device_debug &debugInterface = *source.device()->debug();
+ device_debug &debugInterface = *source->device()->debug();
for (int spacenum = 0; spacenum < debugInterface.watchpoint_space_count(); ++spacenum)
{
for (const auto &wp : debugInterface.watchpoint_vector(spacenum))
@@ -236,7 +241,7 @@ void debug_view_watchpoints::view_update()
gather_watchpoints();
// Set the view region so the scroll bars update
- m_total.x = tableBreaks[ARRAY_LENGTH(tableBreaks) - 1];
+ m_total.x = tableBreaks[std::size(tableBreaks) - 1];
m_total.y = m_buffer.size() + 1;
if (m_total.y < 10)
m_total.y = 10;
@@ -244,7 +249,7 @@ void debug_view_watchpoints::view_update()
// Draw
debug_view_char *dest = &m_viewdata[0];
util::ovectorstream linebuf;
- linebuf.reserve(ARRAY_LENGTH(tableBreaks) - 1);
+ linebuf.reserve(std::size(tableBreaks) - 1);
// Header
if (m_visible.y > 0)
@@ -299,7 +304,7 @@ void debug_view_watchpoints::view_update()
if ((wpi < m_buffer.size()) && wpi >= 0)
{
static char const *const types[] = { "unkn ", "read ", "write", "r/w " };
- device_debug::watchpoint *const wp = m_buffer[wpi];
+ debug_watchpoint *const wp = m_buffer[wpi];
linebuf.clear();
linebuf.rdbuf()->clear();