diff options
Diffstat (limited to 'src/osd/modules/debugger/qt/memorywindow.cpp')
-rw-r--r-- | src/osd/modules/debugger/qt/memorywindow.cpp | 60 |
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); + } } } |