summaryrefslogtreecommitdiffstats
path: root/src/osd/modules/debugger/qt/memorywindow.cpp
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/modules/debugger/qt/memorywindow.cpp
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/modules/debugger/qt/memorywindow.cpp')
-rw-r--r--src/osd/modules/debugger/qt/memorywindow.cpp60
1 files changed, 42 insertions, 18 deletions
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);
+ }
}
}