diff options
Diffstat (limited to 'src/emu/debug/dvbpoints.cpp')
-rw-r--r-- | src/emu/debug/dvbpoints.cpp | 66 |
1 files changed, 35 insertions, 31 deletions
diff --git a/src/emu/debug/dvbpoints.cpp b/src/emu/debug/dvbpoints.cpp index d86ce1150cc..0290f8719dc 100644 --- a/src/emu/debug/dvbpoints.cpp +++ b/src/emu/debug/dvbpoints.cpp @@ -1,79 +1,81 @@ // license:BSD-3-Clause -// copyright-holders:Aaron Giles +// copyright-holders:Andrew Gardner, Vas Crabb /********************************************************************* - dvbpoints.c + dvbpoints.cpp Breakpoint debugger view. ***************************************************************************/ #include "emu.h" -#include "debugger.h" #include "dvbpoints.h" +#include "debugcpu.h" +#include "points.h" + #include <algorithm> #include <iomanip> // Sorting functors for the qsort function -static bool cIndexAscending(const device_debug::breakpoint *a, const device_debug::breakpoint *b) +static bool cIndexAscending(const debug_breakpoint *a, const debug_breakpoint *b) { return a->index() < b->index(); } -static bool cIndexDescending(const device_debug::breakpoint *a, const device_debug::breakpoint *b) +static bool cIndexDescending(const debug_breakpoint *a, const debug_breakpoint *b) { return cIndexAscending(b, a); } -static bool cEnabledAscending(const device_debug::breakpoint *a, const device_debug::breakpoint *b) +static bool cEnabledAscending(const debug_breakpoint *a, const debug_breakpoint *b) { return !a->enabled() && b->enabled(); } -static bool cEnabledDescending(const device_debug::breakpoint *a, const device_debug::breakpoint *b) +static bool cEnabledDescending(const debug_breakpoint *a, const debug_breakpoint *b) { return cEnabledAscending(b, a); } -static bool cCpuAscending(const device_debug::breakpoint *a, const device_debug::breakpoint *b) +static bool cCpuAscending(const debug_breakpoint *a, const debug_breakpoint *b) { return strcmp(a->debugInterface()->device().tag(), b->debugInterface()->device().tag()) < 0; } -static bool cCpuDescending(const device_debug::breakpoint *a, const device_debug::breakpoint *b) +static bool cCpuDescending(const debug_breakpoint *a, const debug_breakpoint *b) { return cCpuAscending(b, a); } -static bool cAddressAscending(const device_debug::breakpoint *a, const device_debug::breakpoint *b) +static bool cAddressAscending(const debug_breakpoint *a, const debug_breakpoint *b) { return a->address() < b->address(); } -static bool cAddressDescending(const device_debug::breakpoint *a, const device_debug::breakpoint *b) +static bool cAddressDescending(const debug_breakpoint *a, const debug_breakpoint *b) { return cAddressAscending(b, a); } -static bool cConditionAscending(const device_debug::breakpoint *a, const device_debug::breakpoint *b) +static bool cConditionAscending(const debug_breakpoint *a, const debug_breakpoint *b) { return strcmp(a->condition(), b->condition()) < 0; } -static bool cConditionDescending(const device_debug::breakpoint *a, const device_debug::breakpoint *b) +static bool cConditionDescending(const debug_breakpoint *a, const debug_breakpoint *b) { return cConditionAscending(b, a); } -static bool cActionAscending(const device_debug::breakpoint *a, const device_debug::breakpoint *b) +static bool cActionAscending(const debug_breakpoint *a, const debug_breakpoint *b) { - return strcmp(a->action(), b->action()) < 0; + return a->action() < b->action(); } -static bool cActionDescending(const device_debug::breakpoint *a, const device_debug::breakpoint *b) +static bool cActionDescending(const debug_breakpoint *a, const debug_breakpoint *b) { return cActionAscending(b, a); } @@ -96,7 +98,7 @@ debug_view_breakpoints::debug_view_breakpoints(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(); } @@ -118,18 +120,20 @@ debug_view_breakpoints::~debug_view_breakpoints() void debug_view_breakpoints::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]); } @@ -167,7 +171,7 @@ void debug_view_breakpoints::view_click(const int button, const debug_view_xy& p return; // Enable / disable - const_cast<device_debug::breakpoint &>(*m_buffer[bpIndex]).setEnabled(!m_buffer[bpIndex]->enabled()); + const_cast<debug_breakpoint &>(*m_buffer[bpIndex]).setEnabled(!m_buffer[bpIndex]->enabled()); machine().debug_view().update_all(DVT_DISASSEMBLY); } @@ -189,12 +193,12 @@ void debug_view_breakpoints::pad_ostream_to_length(std::ostream& str, int len) void debug_view_breakpoints::gather_breakpoints() { 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(); - for (const device_debug::breakpoint &bp : debugInterface.breakpoint_list()) - m_buffer.push_back(&bp); + device_debug &debugInterface = *source->device()->debug(); + for (const auto &bpp : debugInterface.breakpoint_list()) + m_buffer.push_back(bpp.second.get()); } // And now for the sort @@ -214,7 +218,7 @@ void debug_view_breakpoints::view_update() gather_breakpoints(); // 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; @@ -222,7 +226,7 @@ void debug_view_breakpoints::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) @@ -268,7 +272,7 @@ void debug_view_breakpoints::view_update() int bpi = row + m_topleft.y - 1; if ((bpi < m_buffer.size()) && (bpi >= 0)) { - const device_debug::breakpoint *const bp = m_buffer[bpi]; + const debug_breakpoint *const bp = m_buffer[bpi]; linebuf.clear(); linebuf.rdbuf()->clear(); |