summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2020-05-25 11:15:39 -0400
committer AJR <ajrhacker@users.noreply.github.com>2020-05-25 11:15:39 -0400
commit0fa6e7eb86d3b247c46f840ef230c9331f3cc948 (patch)
treee01509e44adcff62a7d8e087c58572fce6b90e13 /src/osd
parentad7a31ad57b09e1e0e9bb1adb03767f9dd386605 (diff)
Debugger expression and memory access overhaul
- Memory references in expressions no longer default to the console's visible CPU if no device name was specified, except when entered through the console itself. Expressions in view windows now use the context of the currently selected device instead. - The pcatmem debug command and similar qt mouseover function now produce an error message if the initial address translation fails. Related internal changes (nw) - The debugger_cpu class no longer interprets memory accesses. The existing routines have been moved into symbol_table (which used to invoke them as callbacks), and reimplemented in most other places. Thecode duplication is a bit messy, but could be potentially improved in the future with new utility classes. - The cheat engine no longer needs to hook into the debugger_cpu class or instantiate a dummy instance of it. - The inclusion of debug/express.h within emu.h has been undone. Some debugging structures now need unique_ptr to wrap the resulting incomplete classes; hopefully the performance impact of this is negligible. Another direct consequence is that the breakpoint, watchpoint and registerpoint classes are no longer inside device_debug and have their own source file. - The breakpoint list is now a std::multimap, using the addresses as keys to hopefully expedite lookup. - The visible CPU pointer has been removed from the debugger_cpu class, being now considered a property of the console instead. - Many minor bits of code have been simplified.
Diffstat (limited to 'src/osd')
-rw-r--r--src/osd/modules/debugger/debuggdbstub.cpp21
-rw-r--r--src/osd/modules/debugger/debugimgui.cpp36
-rw-r--r--src/osd/modules/debugger/debugwin.cpp2
-rw-r--r--src/osd/modules/debugger/none.cpp3
-rw-r--r--src/osd/modules/debugger/osx/debugconsole.mm21
-rw-r--r--src/osd/modules/debugger/osx/debugview.mm3
-rw-r--r--src/osd/modules/debugger/osx/debugwindowhandler.mm21
-rw-r--r--src/osd/modules/debugger/osx/disassemblyviewer.mm9
-rw-r--r--src/osd/modules/debugger/osx/memoryview.mm1
-rw-r--r--src/osd/modules/debugger/osx/memoryviewer.mm4
-rw-r--r--src/osd/modules/debugger/osx/registersview.mm4
-rw-r--r--src/osd/modules/debugger/qt/dasmwindow.cpp9
-rw-r--r--src/osd/modules/debugger/qt/mainwindow.cpp17
-rw-r--r--src/osd/modules/debugger/qt/memorywindow.cpp60
-rw-r--r--src/osd/modules/debugger/qt/windowqt.cpp18
-rw-r--r--src/osd/modules/debugger/win/consolewininfo.cpp4
-rw-r--r--src/osd/modules/debugger/win/debugviewinfo.cpp5
-rw-r--r--src/osd/modules/debugger/win/debugwininfo.cpp19
-rw-r--r--src/osd/modules/debugger/win/disasmbasewininfo.cpp7
19 files changed, 149 insertions, 115 deletions
diff --git a/src/osd/modules/debugger/debuggdbstub.cpp b/src/osd/modules/debugger/debuggdbstub.cpp
index 63dbd420184..b8c0bbe7b80 100644
--- a/src/osd/modules/debugger/debuggdbstub.cpp
+++ b/src/osd/modules/debugger/debuggdbstub.cpp
@@ -9,6 +9,7 @@
#include "emu.h"
#include "debug/debugcon.h"
#include "debug/debugcpu.h"
+#include "debug/points.h"
#include "debug/textbuf.h"
#include "debug_module.h"
#include "debugger.h"
@@ -426,8 +427,8 @@ private:
std::map<offs_t, uint64_t> m_address_map;
- device_debug::breakpoint *m_triggered_breakpoint;
- device_debug::watchpoint *m_triggered_watchpoint;
+ debug_breakpoint *m_triggered_breakpoint;
+ debug_watchpoint *m_triggered_watchpoint;
std::string m_target_xml;
@@ -596,7 +597,7 @@ void debug_gdbstub::wait_for_debugger(device_t &device, bool firststop)
}
else
{
- device_debug *debug = m_debugger_cpu->get_visible_cpu()->debug();
+ device_debug *debug = m_debugger_console->get_visible_cpu()->debug();
m_triggered_watchpoint = debug->triggered_watchpoint();
m_triggered_breakpoint = debug->triggered_breakpoint();
if ( m_send_stop_packet )
@@ -683,7 +684,7 @@ debug_gdbstub::cmd_reply debug_gdbstub::handle_c(const char *buf)
if ( *buf != '\0' )
return REPLY_UNSUPPORTED;
- m_debugger_cpu->get_visible_cpu()->debug()->go();
+ m_debugger_console->get_visible_cpu()->debug()->go();
m_send_stop_packet = true;
return REPLY_NONE;
}
@@ -696,7 +697,7 @@ debug_gdbstub::cmd_reply debug_gdbstub::handle_D(const char *buf)
if ( *buf != '\0' )
return REPLY_UNSUPPORTED;
- m_debugger_cpu->get_visible_cpu()->debug()->go();
+ m_debugger_console->get_visible_cpu()->debug()->go();
m_dettached = true;
return REPLY_OK;
@@ -752,7 +753,7 @@ debug_gdbstub::cmd_reply debug_gdbstub::handle_H(const char *buf)
debug_gdbstub::cmd_reply debug_gdbstub::handle_k(const char *buf)
{
m_machine->schedule_exit();
- m_debugger_cpu->get_visible_cpu()->debug()->go();
+ m_debugger_console->get_visible_cpu()->debug()->go();
m_dettached = true;
m_socket.close();
return REPLY_NONE;
@@ -969,7 +970,7 @@ debug_gdbstub::cmd_reply debug_gdbstub::handle_s(const char *buf)
if ( *buf != '\0' )
return REPLY_UNSUPPORTED;
- m_debugger_cpu->get_visible_cpu()->debug()->single_step();
+ m_debugger_console->get_visible_cpu()->debug()->single_step();
m_send_stop_packet = true;
return REPLY_NONE;
}
@@ -977,7 +978,7 @@ debug_gdbstub::cmd_reply debug_gdbstub::handle_s(const char *buf)
//-------------------------------------------------------------------------
static bool remove_breakpoint(device_debug *debug, uint64_t address, int /*kind*/)
{
- const device_debug::breakpoint *bp = debug->breakpoint_find(address);
+ const debug_breakpoint *bp = debug->breakpoint_find(address);
if (bp != nullptr)
return debug->breakpoint_clear(bp->index());
return false;
@@ -1021,7 +1022,7 @@ debug_gdbstub::cmd_reply debug_gdbstub::handle_z(const char *buf)
m_address_map.erase(offset);
}
- device_debug *debug = m_debugger_cpu->get_visible_cpu()->debug();
+ device_debug *debug = m_debugger_console->get_visible_cpu()->debug();
switch ( type )
{
// Note: software and hardware breakpoints are treated both the
@@ -1062,7 +1063,7 @@ debug_gdbstub::cmd_reply debug_gdbstub::handle_Z(const char *buf)
m_address_map[offset] = address;
}
- device_debug *debug = m_debugger_cpu->get_visible_cpu()->debug();
+ device_debug *debug = m_debugger_console->get_visible_cpu()->debug();
switch ( type )
{
// Note: software and hardware breakpoints are treated both the
diff --git a/src/osd/modules/debugger/debugimgui.cpp b/src/osd/modules/debugger/debugimgui.cpp
index c1e3a4de21d..296b148c5db 100644
--- a/src/osd/modules/debugger/debugimgui.cpp
+++ b/src/osd/modules/debugger/debugimgui.cpp
@@ -375,36 +375,36 @@ void debug_imgui::handle_keys()
else
{
m_machine->schedule_soft_reset();
- m_machine->debugger().cpu().get_visible_cpu()->debug()->go();
+ m_machine->debugger().console().get_visible_cpu()->debug()->go();
}
}
if(ImGui::IsKeyPressed(ITEM_ID_F5,false))
{
- m_machine->debugger().cpu().get_visible_cpu()->debug()->go();
+ m_machine->debugger().console().get_visible_cpu()->debug()->go();
m_running = true;
}
if(ImGui::IsKeyPressed(ITEM_ID_F6,false))
{
- m_machine->debugger().cpu().get_visible_cpu()->debug()->go_next_device();
+ m_machine->debugger().console().get_visible_cpu()->debug()->go_next_device();
m_running = true;
}
if(ImGui::IsKeyPressed(ITEM_ID_F7,false))
{
- m_machine->debugger().cpu().get_visible_cpu()->debug()->go_interrupt();
+ m_machine->debugger().console().get_visible_cpu()->debug()->go_interrupt();
m_running = true;
}
if(ImGui::IsKeyPressed(ITEM_ID_F8,false))
- m_machine->debugger().cpu().get_visible_cpu()->debug()->go_vblank();
+ m_machine->debugger().console().get_visible_cpu()->debug()->go_vblank();
if(ImGui::IsKeyPressed(ITEM_ID_F9,false))
- m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step_out();
+ m_machine->debugger().console().get_visible_cpu()->debug()->single_step_out();
if(ImGui::IsKeyPressed(ITEM_ID_F10,false))
- m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step_over();
+ m_machine->debugger().console().get_visible_cpu()->debug()->single_step_over();
if(ImGui::IsKeyPressed(ITEM_ID_F11,false))
- m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step();
+ m_machine->debugger().console().get_visible_cpu()->debug()->single_step();
if(ImGui::IsKeyPressed(ITEM_ID_F12,false))
{
- m_machine->debugger().cpu().get_visible_cpu()->debug()->go();
+ m_machine->debugger().console().get_visible_cpu()->debug()->go();
m_hide = true;
}
@@ -484,7 +484,7 @@ void debug_imgui::handle_console(running_machine* machine)
// if console input is empty, then do a single step
if(strlen(view_main_console->console_input) == 0)
{
- m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step();
+ m_machine->debugger().console().get_visible_cpu()->debug()->single_step();
view_main_console->exec_cmd = false;
history_pos = view_main_console->console_history.size();
return;
@@ -1248,33 +1248,33 @@ void debug_imgui::draw_console()
ImGui::Separator();
if(ImGui::MenuItem("Run", "F5"))
{
- m_machine->debugger().cpu().get_visible_cpu()->debug()->go();
+ m_machine->debugger().console().get_visible_cpu()->debug()->go();
m_running = true;
}
if(ImGui::MenuItem("Go to next CPU", "F6"))
{
- m_machine->debugger().cpu().get_visible_cpu()->debug()->go_next_device();
+ m_machine->debugger().console().get_visible_cpu()->debug()->go_next_device();
m_running = true;
}
if(ImGui::MenuItem("Run until next interrupt", "F7"))
{
- m_machine->debugger().cpu().get_visible_cpu()->debug()->go_interrupt();
+ m_machine->debugger().console().get_visible_cpu()->debug()->go_interrupt();
m_running = true;
}
if(ImGui::MenuItem("Run until VBLANK", "F8"))
- m_machine->debugger().cpu().get_visible_cpu()->debug()->go_vblank();
+ m_machine->debugger().console().get_visible_cpu()->debug()->go_vblank();
if(ImGui::MenuItem("Run and hide debugger", "F12"))
{
- m_machine->debugger().cpu().get_visible_cpu()->debug()->go();
+ m_machine->debugger().console().get_visible_cpu()->debug()->go();
m_hide = true;
}
ImGui::Separator();
if(ImGui::MenuItem("Single step", "F11"))
- m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step();
+ m_machine->debugger().console().get_visible_cpu()->debug()->single_step();
if(ImGui::MenuItem("Step over", "F10"))
- m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step_over();
+ m_machine->debugger().console().get_visible_cpu()->debug()->single_step_over();
if(ImGui::MenuItem("Step out", "F9"))
- m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step_out();
+ m_machine->debugger().console().get_visible_cpu()->debug()->single_step_out();
ImGui::EndMenu();
}
diff --git a/src/osd/modules/debugger/debugwin.cpp b/src/osd/modules/debugger/debugwin.cpp
index 975e7ba6bc6..18bbc07dd70 100644
--- a/src/osd/modules/debugger/debugwin.cpp
+++ b/src/osd/modules/debugger/debugwin.cpp
@@ -161,7 +161,7 @@ void debugger_windows::debugger_update()
{
HWND const focuswnd = GetFocus();
- m_machine->debugger().cpu().get_visible_cpu()->debug()->halt_on_next_instruction("User-initiated break\n");
+ m_machine->debugger().debug_break();
// if we were focused on some window's edit box, reset it to default
for (auto &info : m_window_list)
diff --git a/src/osd/modules/debugger/none.cpp b/src/osd/modules/debugger/none.cpp
index 3ce8d6572bc..ef23fe04089 100644
--- a/src/osd/modules/debugger/none.cpp
+++ b/src/osd/modules/debugger/none.cpp
@@ -10,6 +10,7 @@
#include "debug_module.h"
#include "modules/osdmodule.h"
+#include "debug/debugcon.h"
#include "debug/debugcpu.h"
#include "debugger.h"
@@ -42,7 +43,7 @@ void debug_none::init_debugger(running_machine &machine)
void debug_none::wait_for_debugger(device_t &device, bool firststop)
{
- m_machine->debugger().cpu().get_visible_cpu()->debug()->go();
+ m_machine->debugger().console().get_visible_cpu()->debug()->go();
}
void debug_none::debugger_update()
diff --git a/src/osd/modules/debugger/osx/debugconsole.mm b/src/osd/modules/debugger/osx/debugconsole.mm
index 1bd285e8c3b..c1689a8b855 100644
--- a/src/osd/modules/debugger/osx/debugconsole.mm
+++ b/src/osd/modules/debugger/osx/debugconsole.mm
@@ -24,6 +24,7 @@
#include "debugger.h"
#include "debug/debugcon.h"
#include "debug/debugcpu.h"
+#include "debug/points.h"
#include "util/xmlfile.h"
@@ -181,7 +182,7 @@
[dasmSplit setFrame:rhsFrame];
// select the current processor
- [self setCPU:machine->debugger().cpu().get_visible_cpu()];
+ [self setCPU:machine->debugger().console().get_visible_cpu()];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(auxiliaryWindowWillClose:)
@@ -219,7 +220,7 @@
NSString *command = [sender stringValue];
if ([command length] == 0)
{
- machine->debugger().cpu().get_visible_cpu()->debug()->single_step();
+ machine->debugger().console().get_visible_cpu()->debug()->single_step();
[history reset];
}
else
@@ -234,10 +235,10 @@
- (IBAction)debugToggleBreakpoint:(id)sender {
device_t &device = *[dasmView source]->device();
- if ([dasmView cursorVisible] && (machine->debugger().cpu().get_visible_cpu() == &device))
+ if ([dasmView cursorVisible] && (machine->debugger().console().get_visible_cpu() == &device))
{
offs_t const address = [dasmView selectedAddress];
- const device_debug::breakpoint *bp = [dasmView source]->device()->debug()->breakpoint_find(address);
+ const debug_breakpoint *bp = [dasmView source]->device()->debug()->breakpoint_find(address);
// if it doesn't exist, add a new one
NSString *command;
@@ -252,9 +253,9 @@
- (IBAction)debugToggleBreakpointEnable:(id)sender {
device_t &device = *[dasmView source]->device();
- if ([dasmView cursorVisible] && (machine->debugger().cpu().get_visible_cpu() == &device))
+ if ([dasmView cursorVisible] && (machine->debugger().console().get_visible_cpu() == &device))
{
- const device_debug::breakpoint *bp = [dasmView source]->device()->debug()->breakpoint_find([dasmView selectedAddress]);
+ const debug_breakpoint *bp = [dasmView source]->device()->debug()->breakpoint_find([dasmView selectedAddress]);
if (bp != nullptr)
{
NSString *command;
@@ -270,7 +271,7 @@
- (IBAction)debugRunToCursor:(id)sender {
device_t &device = *[dasmView source]->device();
- if ([dasmView cursorVisible] && (machine->debugger().cpu().get_visible_cpu() == &device))
+ if ([dasmView cursorVisible] && (machine->debugger().console().get_visible_cpu() == &device))
{
NSString *command = [NSString stringWithFormat:@"go 0x%lX", (unsigned long)[dasmView selectedAddress]];
machine->debugger().console().execute_command([command UTF8String], 1);
@@ -499,7 +500,7 @@
[[NSNotificationCenter defaultCenter] postNotificationName:MAMEHideDebuggerNotification
object:self
userInfo:info];
- machine->debugger().cpu().get_visible_cpu()->debug()->go();
+ machine->debugger().console().get_visible_cpu()->debug()->go();
}
}
@@ -562,9 +563,9 @@
SEL const action = [item action];
BOOL const inContextMenu = ([item menu] == [dasmView menu]);
BOOL const haveCursor = [dasmView cursorVisible];
- BOOL const isCurrent = (machine->debugger().cpu().get_visible_cpu() == [dasmView source]->device());
+ BOOL const isCurrent = (machine->debugger().console().get_visible_cpu() == [dasmView source]->device());
- const device_debug::breakpoint *breakpoint = nullptr;
+ const debug_breakpoint *breakpoint = nullptr;
if (haveCursor)
{
breakpoint = [dasmView source]->device()->debug()->breakpoint_find([dasmView selectedAddress]);
diff --git a/src/osd/modules/debugger/osx/debugview.mm b/src/osd/modules/debugger/osx/debugview.mm
index a414e4ad8a4..df7c4dbcc01 100644
--- a/src/osd/modules/debugger/osx/debugview.mm
+++ b/src/osd/modules/debugger/osx/debugview.mm
@@ -10,6 +10,7 @@
#include "emu.h"
#include "debugger.h"
+#include "debug/debugcon.h"
#include "debug/debugcpu.h"
#include "modules/lib/osdobj_common.h"
@@ -871,7 +872,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
- (void)insertNewline:(id)sender {
- machine->debugger().cpu().get_visible_cpu()->debug()->single_step();
+ machine->debugger().console().get_visible_cpu()->debug()->single_step();
}
diff --git a/src/osd/modules/debugger/osx/debugwindowhandler.mm b/src/osd/modules/debugger/osx/debugwindowhandler.mm
index c1aa8e383a2..fd1eb44f6d3 100644
--- a/src/osd/modules/debugger/osx/debugwindowhandler.mm
+++ b/src/osd/modules/debugger/osx/debugwindowhandler.mm
@@ -14,6 +14,7 @@
#import "debugview.h"
#include "debugger.h"
+#include "debug/debugcon.h"
#include "util/xmlfile.h"
@@ -189,12 +190,12 @@ NSString *const MAMESaveDebuggerConfigurationNotification = @"MAMESaveDebuggerCo
- (IBAction)debugBreak:(id)sender {
if (machine->debug_flags & DEBUG_FLAG_ENABLED)
- machine->debugger().cpu().get_visible_cpu()->debug()->halt_on_next_instruction("User-initiated break\n");
+ machine->debugger().console().get_visible_cpu()->debug()->halt_on_next_instruction("User-initiated break\n");
}
- (IBAction)debugRun:(id)sender {
- machine->debugger().cpu().get_visible_cpu()->debug()->go();
+ machine->debugger().console().get_visible_cpu()->debug()->go();
}
@@ -203,43 +204,43 @@ NSString *const MAMESaveDebuggerConfigurationNotification = @"MAMESaveDebuggerCo
object:self
userInfo:[NSDictionary dictionaryWithObject:[NSValue valueWithPointer:machine]
forKey:@"MAMEDebugMachine"]];
- machine->debugger().cpu().get_visible_cpu()->debug()->go();
+ machine->debugger().console().get_visible_cpu()->debug()->go();
}
- (IBAction)debugRunToNextCPU:(id)sender {
- machine->debugger().cpu().get_visible_cpu()->debug()->go_next_device();
+ machine->debugger().console().get_visible_cpu()->debug()->go_next_device();
}
- (IBAction)debugRunToNextInterrupt:(id)sender {
- machine->debugger().cpu().get_visible_cpu()->debug()->go_interrupt();
+ machine->debugger().console().get_visible_cpu()->debug()->go_interrupt();
}
- (IBAction)debugRunToNextVBLANK:(id)sender {
- machine->debugger().cpu().get_visible_cpu()->debug()->go_vblank();
+ machine->debugger().console().get_visible_cpu()->debug()->go_vblank();
}
- (IBAction)debugStepInto:(id)sender {
- machine->debugger().cpu().get_visible_cpu()->debug()->single_step();
+ machine->debugger().console().get_visible_cpu()->debug()->single_step();
}
- (IBAction)debugStepOver:(id)sender {
- machine->debugger().cpu().get_visible_cpu()->debug()->single_step_over();
+ machine->debugger().console().get_visible_cpu()->debug()->single_step_over();
}
- (IBAction)debugStepOut:(id)sender {
- machine->debugger().cpu().get_visible_cpu()->debug()->single_step_out();
+ machine->debugger().console().get_visible_cpu()->debug()->single_step_out();
}
- (IBAction)debugSoftReset:(id)sender {
machine->schedule_soft_reset();
- machine->debugger().cpu().get_visible_cpu()->debug()->go();
+ machine->debugger().console().get_visible_cpu()->debug()->go();
}
diff --git a/src/osd/modules/debugger/osx/disassemblyviewer.mm b/src/osd/modules/debugger/osx/disassemblyviewer.mm
index eb039f4ca17..1f286a6bfc4 100644
--- a/src/osd/modules/debugger/osx/disassemblyviewer.mm
+++ b/src/osd/modules/debugger/osx/disassemblyviewer.mm
@@ -16,6 +16,7 @@
#include "debugger.h"
#include "debug/debugcon.h"
#include "debug/debugcpu.h"
+#include "debug/points.h"
#include "util/xmlfile.h"
@@ -109,7 +110,7 @@
[actionButton release];
// set default state
- [dasmView selectSubviewForDevice:machine->debugger().cpu().get_visible_cpu()];
+ [dasmView selectSubviewForDevice:machine->debugger().console().get_visible_cpu()];
[dasmView setExpression:@"curpc"];
[expressionField setStringValue:@"curpc"];
[expressionField selectText:self];
@@ -176,7 +177,7 @@
{
device_t &device = *[dasmView source]->device();
offs_t const address = [dasmView selectedAddress];
- const device_debug::breakpoint *bp = device.debug()->breakpoint_find(address);
+ const debug_breakpoint *bp = device.debug()->breakpoint_find(address);
// if it doesn't exist, add a new one
if (bp == nullptr)
@@ -203,7 +204,7 @@
{
device_t &device = *[dasmView source]->device();
offs_t const address = [dasmView selectedAddress];
- const device_debug::breakpoint *bp = device.debug()->breakpoint_find(address);
+ const debug_breakpoint *bp = device.debug()->breakpoint_find(address);
if (bp != nullptr)
{
device.debug()->breakpoint_enable(bp->index(), !bp->enabled());
@@ -252,7 +253,7 @@
BOOL const inContextMenu = ([item menu] == [dasmView menu]);
BOOL const haveCursor = [dasmView cursorVisible];
- const device_debug::breakpoint *breakpoint = nullptr;
+ const debug_breakpoint *breakpoint = nullptr;
if (haveCursor)
{
breakpoint = [dasmView source]->device()->debug()->breakpoint_find([dasmView selectedAddress]);
diff --git a/src/osd/modules/debugger/osx/memoryview.mm b/src/osd/modules/debugger/osx/memoryview.mm
index 78af307e993..0db48236b79 100644
--- a/src/osd/modules/debugger/osx/memoryview.mm
+++ b/src/osd/modules/debugger/osx/memoryview.mm
@@ -9,7 +9,6 @@
#include "emu.h"
#import "memoryview.h"
-#include "debug/debugcpu.h"
#include "debug/debugvw.h"
#include "util/xmlfile.h"
diff --git a/src/osd/modules/debugger/osx/memoryviewer.mm b/src/osd/modules/debugger/osx/memoryviewer.mm
index 80d5434a826..b1064aee69f 100644
--- a/src/osd/modules/debugger/osx/memoryviewer.mm
+++ b/src/osd/modules/debugger/osx/memoryviewer.mm
@@ -14,7 +14,7 @@
#import "memoryview.h"
#include "debugger.h"
-#include "debug/debugcpu.h"
+#include "debug/debugcon.h"
#include "debug/dvmemory.h"
#include "util/xmlfile.h"
@@ -108,7 +108,7 @@
[actionButton release];
// set default state
- [memoryView selectSubviewForDevice:machine->debugger().cpu().get_visible_cpu()];
+ [memoryView selectSubviewForDevice:machine->debugger().console().get_visible_cpu()];
[memoryView setExpression:@"0"];
[expressionField setStringValue:@"0"];
[expressionField selectText:self];
diff --git a/src/osd/modules/debugger/osx/registersview.mm b/src/osd/modules/debugger/osx/registersview.mm
index ae202fa488e..c710179c5bd 100644
--- a/src/osd/modules/debugger/osx/registersview.mm
+++ b/src/osd/modules/debugger/osx/registersview.mm
@@ -10,7 +10,7 @@
#include "emu.h"
#include "debugger.h"
-#include "debug/debugcpu.h"
+#include "debug/debugcon.h"
#include "debug/debugvw.h"
@@ -30,7 +30,7 @@
- (NSSize)maximumFrameSize {
debug_view_xy max;
- device_t *curcpu = machine->debugger().cpu().get_visible_cpu();
+ device_t *curcpu = machine->debugger().console().get_visible_cpu();
const debug_view_source *source = view->source_for_device(curcpu);
max.x = max.y = 0;
diff --git a/src/osd/modules/debugger/qt/dasmwindow.cpp b/src/osd/modules/debugger/qt/dasmwindow.cpp
index 04cbd523cdd..52b33b50da8 100644
--- a/src/osd/modules/debugger/qt/dasmwindow.cpp
+++ b/src/osd/modules/debugger/qt/dasmwindow.cpp
@@ -12,6 +12,7 @@
#include "debug/debugcon.h"
#include "debug/debugcpu.h"
#include "debug/dvdisasm.h"
+#include "debug/points.h"
DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) :
@@ -141,7 +142,7 @@ void DasmWindow::toggleBreakpointAtCursor(bool changedTo)
device_debug *const cpuinfo = device->debug();
// Find an existing breakpoint at this address
- const device_debug::breakpoint *bp = cpuinfo->breakpoint_find(address);
+ const debug_breakpoint *bp = cpuinfo->breakpoint_find(address);
// If none exists, add a new one
if (bp == nullptr)
@@ -172,7 +173,7 @@ void DasmWindow::enableBreakpointAtCursor(bool changedTo)
device_debug *const cpuinfo = device->debug();
// Find an existing breakpoint at this address
- const device_debug::breakpoint *bp = cpuinfo->breakpoint_find(address);
+ const debug_breakpoint *bp = cpuinfo->breakpoint_find(address);
if (bp != nullptr)
{
@@ -228,7 +229,7 @@ void DasmWindow::dasmViewUpdated()
device_debug *const cpuinfo = device->debug();
// Find an existing breakpoint at this address
- const device_debug::breakpoint *bp = cpuinfo->breakpoint_find(address);
+ const debug_breakpoint *bp = cpuinfo->breakpoint_find(address);
if (bp != nullptr)
{
@@ -260,7 +261,7 @@ void DasmWindow::populateComboBox()
void DasmWindow::setToCurrentCpu()
{
- device_t* curCpu = m_machine->debugger().cpu().get_visible_cpu();
+ device_t* curCpu = m_machine->debugger().console().get_visible_cpu();
if (curCpu)
{
const debug_view_source *source = m_dasmView->view()->source_for_device(curCpu);
diff --git a/src/osd/modules/debugger/qt/mainwindow.cpp b/src/osd/modules/debugger/qt/mainwindow.cpp
index 6a79ebf955d..f2026db67e9 100644
--- a/src/osd/modules/debugger/qt/mainwindow.cpp
+++ b/src/osd/modules/debugger/qt/mainwindow.cpp
@@ -14,6 +14,7 @@
#include "debug/debugcon.h"
#include "debug/debugcpu.h"
#include "debug/dvdisasm.h"
+#include "debug/points.h"
MainWindow::MainWindow(running_machine* machine, QWidget* parent) :
@@ -214,13 +215,13 @@ bool MainWindow::eventFilter(QObject* obj, QEvent* event)
void MainWindow::toggleBreakpointAtCursor(bool changedTo)
{
debug_view_disasm *const dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view());
- if (dasmView->cursor_visible() && (m_machine->debugger().cpu().get_visible_cpu() == dasmView->source()->device()))
+ if (dasmView->cursor_visible() && (m_machine->debugger().console().get_visible_cpu() == dasmView->source()->device()))
{
offs_t const address = downcast<debug_view_disasm *>(dasmView)->selected_address();
device_debug *const cpuinfo = dasmView->source()->device()->debug();
// Find an existing breakpoint at this address
- const device_debug::breakpoint *bp = cpuinfo->breakpoint_find(address);
+ const debug_breakpoint *bp = cpuinfo->breakpoint_find(address);
// If none exists, add a new one
std::string command;
@@ -242,13 +243,13 @@ void MainWindow::toggleBreakpointAtCursor(bool changedTo)
void MainWindow::enableBreakpointAtCursor(bool changedTo)
{
debug_view_disasm *const dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view());
- if (dasmView->cursor_visible() && (m_machine->debugger().cpu().get_visible_cpu() == dasmView->source()->device()))
+ if (dasmView->cursor_visible() && (m_machine->debugger().console().get_visible_cpu() == dasmView->source()->device()))
{
offs_t const address = dasmView->selected_address();
device_debug *const cpuinfo = dasmView->source()->device()->debug();
// Find an existing breakpoint at this address
- const device_debug::breakpoint *bp = cpuinfo->breakpoint_find(address);
+ const debug_breakpoint *bp = cpuinfo->breakpoint_find(address);
if (bp != nullptr)
{
@@ -265,7 +266,7 @@ void MainWindow::enableBreakpointAtCursor(bool changedTo)
void MainWindow::runToCursor(bool changedTo)
{
debug_view_disasm* dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view());
- if (dasmView->cursor_visible() && (m_machine->debugger().cpu().get_visible_cpu() == dasmView->source()->device()))
+ if (dasmView->cursor_visible() && (m_machine->debugger().console().get_visible_cpu() == dasmView->source()->device()))
{
offs_t address = downcast<debug_view_disasm*>(dasmView)->selected_address();
std::string command = string_format("go 0x%X", address);
@@ -304,7 +305,7 @@ void MainWindow::executeCommand(bool withClear)
// A blank command is a "silent step"
if (command == "")
{
- m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step();
+ m_machine->debugger().console().get_visible_cpu()->debug()->single_step();
return;
}
@@ -396,7 +397,7 @@ void MainWindow::unmountImage(bool changedTo)
void MainWindow::dasmViewUpdated()
{
debug_view_disasm *const dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view());
- bool const haveCursor = dasmView->cursor_visible() && (m_machine->debugger().cpu().get_visible_cpu() == dasmView->source()->device());
+ bool const haveCursor = dasmView->cursor_visible() && (m_machine->debugger().console().get_visible_cpu() == dasmView->source()->device());
bool haveBreakpoint = false;
bool breakpointEnabled = false;
if (haveCursor)
@@ -406,7 +407,7 @@ void MainWindow::dasmViewUpdated()
device_debug *const cpuinfo = device->debug();
// Find an existing breakpoint at this address
- const device_debug::breakpoint *bp = cpuinfo->breakpoint_find(address);
+ const debug_breakpoint *bp = cpuinfo->breakpoint_find(address);
if (bp != nullptr)
{
diff --git a/src/osd/modules/debugger/qt/memorywindow.cpp b/src/osd/modules/debugger/qt/memorywindow.cpp
index 2124effcbbd..bead6af0cef 100644
--- a/src/osd/modules/debugger/qt/memorywindow.cpp
+++ b/src/osd/modules/debugger/qt/memorywindow.cpp
@@ -295,7 +295,7 @@ void MemoryWindow::populateComboBox()
void MemoryWindow::setToCurrentCpu()
{
- device_t* curCpu = m_machine->debugger().cpu().get_visible_cpu();
+ device_t* curCpu = m_machine->debugger().console().get_visible_cpu();
if (curCpu)
{
const debug_view_source *source = m_memTable->view()->source_for_device(curCpu);
@@ -355,27 +355,51 @@ void DebuggerMemView::mousePressEvent(QMouseEvent* event)
const offs_t address = memView->addressAtCursorPosition(clickViewPosition);
const debug_view_memory_source* source = downcast<const debug_view_memory_source*>(memView->source());
address_space* addressSpace = source->space();
- const int nativeDataWidth = addressSpace->data_width() / 8;
- const uint64_t memValue = source->device()->machine().debugger().cpu().read_memory(*addressSpace,
- addressSpace->address_to_byte(address),
- nativeDataWidth,
- true);
- const offs_t pc = source->device()->debug()->track_mem_pc_from_space_address_data(addressSpace->spacenum(),
- address,
- memValue);
- if (pc != (offs_t)(-1))
+ offs_t a = address & space->logaddrmask();
+ if (!addressSpace->device().memory().translate(addressSpace->spacenum(), TRANSLATE_READ_DEBUG, a))
{
- // TODO: You can specify a box that the tooltip stays alive within - might be good?
- const QString addressAndPc = QString("Address %1 written at PC=%2").arg(address, 2, 16).arg(pc, 2, 16);
- QToolTip::showText(QCursor::pos(), addressAndPc, nullptr);
-
- // Copy the PC into the clipboard as well
- QClipboard *clipboard = QApplication::clipboard();
- clipboard->setText(QString("%1").arg(pc, 2, 16));
+ QToolTip::showText(QCursor::pos(), "Bad address", nullptr);
}
else
{
- QToolTip::showText(QCursor::pos(), "UNKNOWN PC", nullptr);
+ uint64_t memValue = addressSpace->unmap();
+ auto dis = addressSpace->device().machine().disable_side_effects();
+ switch (addressSpace->data_width())
+ {
+ case 8:
+ memValue = space->read_byte(a);
+ break;
+
+ case 16:
+ memValue = space->read_word_unaligned(a);
+ break;
+
+ case 32:
+ memValue = space->read_dword_unaligned(a);
+ break;
+
+ case 64:
+ memValue = space->read_qword_unaligned(a);
+ break;
+ }
+
+ const offs_t pc = source->device()->debug()->track_mem_pc_from_space_address_data(addressSpace->spacenum(),
+ address,
+ memValue);
+ if (pc != (offs_t)(-1))
+ {
+ // TODO: You can specify a box that the tooltip stays alive within - might be good?
+ const QString addressAndPc = QString("Address %1 written at PC=%2").arg(address, 2, 16).arg(pc, 2, 16);
+ QToolTip::showText(QCursor::pos(), addressAndPc, nullptr);
+
+ // Copy the PC into the clipboard as well
+ QClipboard *clipboard = QApplication::clipboard();
+ clipboard->setText(QString("%1").arg(pc, 2, 16));
+ }
+ else
+ {
+ QToolTip::showText(QCursor::pos(), "UNKNOWN PC", nullptr);
+ }
}
}
diff --git a/src/osd/modules/debugger/qt/windowqt.cpp b/src/osd/modules/debugger/qt/windowqt.cpp
index dda9ee64dc7..aa32ffb5220 100644
--- a/src/osd/modules/debugger/qt/windowqt.cpp
+++ b/src/osd/modules/debugger/qt/windowqt.cpp
@@ -179,49 +179,49 @@ void WindowQt::debugActOpenDevices()
void WindowQt::debugActRun()
{
- m_machine->debugger().cpu().get_visible_cpu()->debug()->go();
+ m_machine->debugger().console().get_visible_cpu()->debug()->go();
}
void WindowQt::debugActRunAndHide()
{
- m_machine->debugger().cpu().get_visible_cpu()->debug()->go();
+ m_machine->debugger().console().get_visible_cpu()->debug()->go();
hideAll();
}
void WindowQt::debugActRunToNextCpu()
{
- m_machine->debugger().cpu().get_visible_cpu()->debug()->go_next_device();
+ m_machine->debugger().console().get_visible_cpu()->debug()->go_next_device();
}
void WindowQt::debugActRunNextInt()
{
- m_machine->debugger().cpu().get_visible_cpu()->debug()->go_interrupt();
+ m_machine->debugger().console().get_visible_cpu()->debug()->go_interrupt();
}
void WindowQt::debugActRunNextVBlank()
{
- m_machine->debugger().cpu().get_visible_cpu()->debug()->go_vblank();
+ m_machine->debugger().console().get_visible_cpu()->debug()->go_vblank();
}
void WindowQt::debugActStepInto()
{
- m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step();
+ m_machine->debugger().console().get_visible_cpu()->debug()->single_step();
}
void WindowQt::debugActStepOver()
{
- m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step_over();
+ m_machine->debugger().console().get_visible_cpu()->debug()->single_step_over();
}
void WindowQt::debugActStepOut()
{
- m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step_out();
+ m_machine->debugger().console().get_visible_cpu()->debug()->single_step_out();
}
void WindowQt::debugActSoftReset()
{
m_machine->schedule_soft_reset();
- m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step();
+ m_machine->debugger().console().get_visible_cpu()->debug()->single_step();
}
void WindowQt::debugActHardReset()
diff --git a/src/osd/modules/debugger/win/consolewininfo.cpp b/src/osd/modules/debugger/win/consolewininfo.cpp
index 27a6228d2f5..e6ad4c0986f 100644
--- a/src/osd/modules/debugger/win/consolewininfo.cpp
+++ b/src/osd/modules/debugger/win/consolewininfo.cpp
@@ -78,7 +78,7 @@ consolewin_info::consolewin_info(debugger_windows_interface &debugger) :
}
// recompute the children
- set_cpu(*machine().debugger().cpu().get_visible_cpu());
+ set_cpu(*machine().debugger().console().get_visible_cpu());
// mark the edit box as the default focus and set it
editwin_info::set_default_focus();
@@ -481,7 +481,7 @@ bool consolewin_info::handle_command(WPARAM wparam, LPARAM lparam)
void consolewin_info::process_string(std::string const &string)
{
if (string.empty()) // an empty string is a single step
- machine().debugger().cpu().get_visible_cpu()->debug()->single_step();
+ machine().debugger().console().get_visible_cpu()->debug()->single_step();
else // otherwise, just process the command
machine().debugger().console().execute_command(string, true);
diff --git a/src/osd/modules/debugger/win/debugviewinfo.cpp b/src/osd/modules/debugger/win/debugviewinfo.cpp
index ff46d13c7fe..1b824a04b8c 100644
--- a/src/osd/modules/debugger/win/debugviewinfo.cpp
+++ b/src/osd/modules/debugger/win/debugviewinfo.cpp
@@ -12,6 +12,7 @@
#include "debugwininfo.h"
#include "uimetrics.h"
#include "debugger.h"
+#include "debug/debugcon.h"
#include "debug/debugcpu.h"
#include "strconv.h"
@@ -207,7 +208,7 @@ bool debugview_info::source_is_visible_cpu() const
if (m_view != nullptr)
{
const debug_view_source *const source = m_view->source();
- return (source != nullptr) && (machine().debugger().cpu().get_visible_cpu() == source->device());
+ return (source != nullptr) && (machine().debugger().console().get_visible_cpu() == source->device());
}
return false;
}
@@ -245,7 +246,7 @@ bool debugview_info::set_source_for_device(device_t &device)
bool debugview_info::set_source_for_visible_cpu()
{
- device_t *const curcpu = machine().debugger().cpu().get_visible_cpu();
+ device_t *const curcpu = machine().debugger().console().get_visible_cpu();
if (curcpu != nullptr)
return set_source_for_device(*curcpu);
else
diff --git a/src/osd/modules/debugger/win/debugwininfo.cpp b/src/osd/modules/debugger/win/debugwininfo.cpp
index 1645582038c..e684e1f32fa 100644
--- a/src/osd/modules/debugger/win/debugwininfo.cpp
+++ b/src/osd/modules/debugger/win/debugwininfo.cpp
@@ -12,6 +12,7 @@
#include "debugviewinfo.h"
#include "debugger.h"
+#include "debug/debugcon.h"
#include "debug/debugcpu.h"
#include "window.h"
#include "winutf8.h"
@@ -300,31 +301,31 @@ bool debugwin_info::handle_command(WPARAM wparam, LPARAM lparam)
case ID_RUN_AND_HIDE:
debugger().hide_all();
case ID_RUN:
- machine().debugger().cpu().get_visible_cpu()->debug()->go();
+ machine().debugger().console().get_visible_cpu()->debug()->go();
return true;
case ID_NEXT_CPU:
- machine().debugger().cpu().get_visible_cpu()->debug()->go_next_device();
+ machine().debugger().console().get_visible_cpu()->debug()->go_next_device();
return true;
case ID_RUN_VBLANK:
- machine().debugger().cpu().get_visible_cpu()->debug()->go_vblank();
+ machine().debugger().console().get_visible_cpu()->debug()->go_vblank();
return true;
case ID_RUN_IRQ:
- machine().debugger().cpu().get_visible_cpu()->debug()->go_interrupt();
+ machine().debugger().console().get_visible_cpu()->debug()->go_interrupt();
return true;
case ID_STEP:
- machine().debugger().cpu().get_visible_cpu()->debug()->single_step();
+ machine().debugger().console().get_visible_cpu()->debug()->single_step();
return true;
case ID_STEP_OVER:
- machine().debugger().cpu().get_visible_cpu()->debug()->single_step_over();
+ machine().debugger().console().get_visible_cpu()->debug()->single_step_over();
return true;
case ID_STEP_OUT:
- machine().debugger().cpu().get_visible_cpu()->debug()->single_step_out();
+ machine().debugger().console().get_visible_cpu()->debug()->single_step_out();
return true;
case ID_REWIND_STEP:
@@ -348,7 +349,7 @@ bool debugwin_info::handle_command(WPARAM wparam, LPARAM lparam)
case ID_SOFT_RESET:
machine().schedule_soft_reset();
- machine().debugger().cpu().get_visible_cpu()->debug()->go();
+ machine().debugger().console().get_visible_cpu()->debug()->go();
return true;
case ID_EXIT:
@@ -507,7 +508,7 @@ LRESULT debugwin_info::window_proc(UINT message, WPARAM wparam, LPARAM lparam)
if (m_is_main_console)
{
debugger().hide_all();
- machine().debugger().cpu().get_visible_cpu()->debug()->go();
+ machine().debugger().console().get_visible_cpu()->debug()->go();
}
else
{
diff --git a/src/osd/modules/debugger/win/disasmbasewininfo.cpp b/src/osd/modules/debugger/win/disasmbasewininfo.cpp
index 0d22b7b8d39..800443b47c1 100644
--- a/src/osd/modules/debugger/win/disasmbasewininfo.cpp
+++ b/src/osd/modules/debugger/win/disasmbasewininfo.cpp
@@ -15,6 +15,7 @@
#include "debugger.h"
#include "debug/debugcon.h"
#include "debug/debugcpu.h"
+#include "debug/points.h"
//#include "winutf8.h"
@@ -115,7 +116,7 @@ void disasmbasewin_info::update_menu()
device_debug *const debug = dasmview->source_device()->debug();
// first find an existing breakpoint at this address
- const device_debug::breakpoint *bp = debug->breakpoint_find(address);
+ const debug_breakpoint *bp = debug->breakpoint_find(address);
if (bp == nullptr)
{
@@ -166,7 +167,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
- const device_debug::breakpoint *bp = debug->breakpoint_find(address);
+ const debug_breakpoint *bp = debug->breakpoint_find(address);
// if it doesn't exist, add a new one
if (!is_main_console())
@@ -204,7 +205,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
- const device_debug::breakpoint *bp = debug->breakpoint_find(address);
+ const debug_breakpoint *bp = debug->breakpoint_find(address);
// if it doesn't exist, add a new one
if (bp != nullptr)