Properly restore DisassemblyPopup functionality
parent
a349f9c05f
commit
fdc97fe6d1
|
@ -6,6 +6,7 @@
|
|||
#include "Configuration.h"
|
||||
#include "Bridge.h"
|
||||
#include "MiscUtil.h"
|
||||
#include "DisassemblyPopup.h"
|
||||
|
||||
ReferenceView::ReferenceView(bool sourceView, QWidget* parent) : StdSearchListView(parent, true, false), mParent(dynamic_cast<QTabWidget*>(parent))
|
||||
{
|
||||
|
@ -53,6 +54,10 @@ ReferenceView::ReferenceView(bool sourceView, QWidget* parent) : StdSearchListVi
|
|||
connect(this, SIGNAL(enterPressedSignal()), this, SLOT(followGenericAddress()));
|
||||
|
||||
setupContextMenu();
|
||||
|
||||
// Add disassembly popups
|
||||
new DisassemblyPopup(stdList(), Bridge::getArchitecture());
|
||||
new DisassemblyPopup(stdSearchList(), Bridge::getArchitecture());
|
||||
}
|
||||
|
||||
void ReferenceView::setupContextMenu()
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <QProgressBar>
|
||||
#include <QLabel>
|
||||
#include "StdSearchListView.h"
|
||||
class DisassemblyPopup;
|
||||
|
||||
class QTabWidget;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class SearchListView : public QWidget, public ActionHelper<SearchListView>
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SearchListView(QWidget* parent, AbstractSearchList* abstractSearchList, bool enableRegex, bool enableLock);
|
||||
SearchListView(QWidget* parent, AbstractSearchList* abstractSearchList, bool enableRegex, bool enableLock);
|
||||
|
||||
AbstractStdTable* mCurList = nullptr;
|
||||
duint mSearchStartCol = 0;
|
||||
|
|
|
@ -31,6 +31,8 @@ private:
|
|||
protected:
|
||||
friend class SymbolView;
|
||||
friend class Bridge;
|
||||
friend class HandlesView;
|
||||
|
||||
StdTable* stdList();
|
||||
StdTable* stdSearchList();
|
||||
};
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "Bridge.h"
|
||||
#include "MenuBuilder.h"
|
||||
#include "Breakpoints.h"
|
||||
#include "DisassemblyPopup.h"
|
||||
|
||||
BreakpointsView::BreakpointsView(QWidget* parent)
|
||||
: StdTable(parent), mExceptionMaxLength(0)
|
||||
|
@ -37,6 +38,8 @@ BreakpointsView::BreakpointsView(QWidget* parent)
|
|||
connect(this, SIGNAL(enterPressedSignal()), this, SLOT(followBreakpointSlot()));
|
||||
|
||||
Initialize();
|
||||
|
||||
new DisassemblyPopup(this, Bridge::getArchitecture());
|
||||
}
|
||||
|
||||
void BreakpointsView::setupContextMenu()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "CallStackView.h"
|
||||
#include "CommonActions.h"
|
||||
#include "Bridge.h"
|
||||
#include "DisassemblyPopup.h"
|
||||
|
||||
CallStackView::CallStackView(StdTable* parent) : StdIconTable(parent)
|
||||
{
|
||||
|
@ -21,6 +22,8 @@ CallStackView::CallStackView(StdTable* parent) : StdIconTable(parent)
|
|||
connect(this, SIGNAL(doubleClickedSignal()), this, SLOT(followFrom()));
|
||||
|
||||
setupContextMenu();
|
||||
|
||||
new DisassemblyPopup(this, Bridge::getArchitecture());
|
||||
}
|
||||
|
||||
void CallStackView::setupContextMenu()
|
||||
|
|
|
@ -107,13 +107,12 @@ bool DisassemblyPopup::eventFilter(QObject* object, QEvent* event)
|
|||
case QEvent::KeyPress:
|
||||
{
|
||||
hide();
|
||||
stopPopupTimer();
|
||||
}
|
||||
break;
|
||||
|
||||
case QEvent::MouseMove:
|
||||
{
|
||||
hide();
|
||||
|
||||
auto mouseEvent = (QMouseEvent*)event;
|
||||
auto x = mouseEvent->x();
|
||||
auto y = mouseEvent->y();
|
||||
|
@ -121,11 +120,23 @@ bool DisassemblyPopup::eventFilter(QObject* object, QEvent* event)
|
|||
// TODO: make sure the cursor isn't on the column separators
|
||||
if(y > mParent->getHeaderHeight())
|
||||
{
|
||||
mLastX = x;
|
||||
mLastY = y;
|
||||
if(mPopupTimer != 0)
|
||||
killTimer(mPopupTimer);
|
||||
mPopupTimer = startTimer(QApplication::startDragTime());
|
||||
// Show the popup if relevant for the current position
|
||||
auto addr = mParent->getAddressForPosition(x, y);
|
||||
if(getAddress() != addr)
|
||||
{
|
||||
if(DbgFunctions()->MemIsCodePage(addr, false))
|
||||
{
|
||||
move(mParent->mapToGlobal(QPoint(x + 20, y + fontMetrics().height() * 2)));
|
||||
setAddress(addr);
|
||||
if(mPopupTimer == 0)
|
||||
mPopupTimer = startTimer(QApplication::startDragTime());
|
||||
}
|
||||
else
|
||||
{
|
||||
hide();
|
||||
stopPopupTimer();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -142,46 +153,35 @@ void DisassemblyPopup::timerEvent(QTimerEvent* event)
|
|||
{
|
||||
if(event->timerId() == mPopupTimer)
|
||||
{
|
||||
// Kill the timer
|
||||
killTimer(mPopupTimer);
|
||||
mPopupTimer = 0;
|
||||
// Show the popup
|
||||
show();
|
||||
|
||||
// Show the popup if relevant for the current position
|
||||
auto addr = mParent->getAddressForPosition(mLastX, mLastY);
|
||||
if(getAddress() != addr)
|
||||
{
|
||||
if(DbgFunctions()->MemIsCodePage(addr, false))
|
||||
{
|
||||
move(mParent->mapToGlobal(QPoint(mLastX + 20, mLastY + fontMetrics().height() * 2)));
|
||||
setAddress(addr);
|
||||
show();
|
||||
}
|
||||
else
|
||||
{
|
||||
hide();
|
||||
if(mPopupTimer != 0)
|
||||
{
|
||||
mPopupTimer = 0;
|
||||
killTimer(mPopupTimer);
|
||||
}
|
||||
}
|
||||
}
|
||||
stopPopupTimer();
|
||||
}
|
||||
|
||||
QFrame::timerEvent(event);
|
||||
}
|
||||
|
||||
void DisassemblyPopup::setAddress(duint Address)
|
||||
void DisassemblyPopup::stopPopupTimer()
|
||||
{
|
||||
mAddr = Address;
|
||||
if(mPopupTimer != 0)
|
||||
{
|
||||
killTimer(mPopupTimer);
|
||||
mPopupTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void DisassemblyPopup::setAddress(duint addr)
|
||||
{
|
||||
mAddr = addr;
|
||||
QList<Instruction_t> instBuffer;
|
||||
mDisassemblyToken.clear();
|
||||
mDisasm.UpdateArchitecture();
|
||||
|
||||
if(mAddr != 0)
|
||||
{
|
||||
mWidth = 1;
|
||||
// Get RVA
|
||||
auto addr = Address;
|
||||
duint size;
|
||||
duint base = DbgMemFindBaseAddr(addr, &size);
|
||||
// Prepare RVA of every instruction
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "Imports.h"
|
||||
#include "QZydis.h"
|
||||
#include "AbstractTableView.h"
|
||||
#include "StdSearchListView.h"
|
||||
|
||||
class CachedFontMetrics;
|
||||
|
||||
|
@ -25,6 +26,7 @@ protected:
|
|||
void paintEvent(QPaintEvent* event) override;
|
||||
bool eventFilter(QObject* object, QEvent* event) override;
|
||||
void timerEvent(QTimerEvent* event) override;
|
||||
void stopPopupTimer();
|
||||
|
||||
CachedFontMetrics* mFontMetrics = nullptr;
|
||||
duint mAddr = 0;
|
||||
|
@ -35,8 +37,6 @@ protected:
|
|||
int mCharHeight = 0;
|
||||
int mWidth = 0;
|
||||
int mPopupTimer = 0;
|
||||
int mLastX = 0;
|
||||
int mLastY = 0;
|
||||
unsigned int mMaxInstructions = 20;
|
||||
|
||||
QColor mDisassemblyBackgroundColor;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "StdIconSearchListView.h"
|
||||
#include "MainWindow.h"
|
||||
#include "MessagesBreakpoints.h"
|
||||
#include "DisassemblyPopup.h"
|
||||
#include <QVBoxLayout>
|
||||
|
||||
HandlesView::HandlesView(QWidget* parent) : QWidget(parent)
|
||||
|
@ -27,6 +28,10 @@ HandlesView::HandlesView(QWidget* parent) : QWidget(parent)
|
|||
mHandlesTable->addColumnAt(8 + charWidth * 20, tr("Name"), true);
|
||||
mHandlesTable->loadColumnFromConfig("Handle");
|
||||
|
||||
// Add disassembly popups
|
||||
new DisassemblyPopup(mHandlesTable->stdList(), Bridge::getArchitecture());
|
||||
new DisassemblyPopup(mHandlesTable->stdSearchList(), Bridge::getArchitecture());
|
||||
|
||||
// Setup windows list
|
||||
mWindowsTable = new StdIconSearchListView(this, true, true);
|
||||
mWindowsTable->setInternalTitle("Windows");
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include "BrowseDialog.h"
|
||||
#include "StdIconSearchListView.h"
|
||||
#include "ZehSymbolTable.h"
|
||||
#include "DisassemblyPopup.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QProcess>
|
||||
#include <QFileDialog>
|
||||
|
@ -174,6 +176,10 @@ SymbolView::SymbolView(QWidget* parent) : QWidget(parent), ui(new Ui::SymbolView
|
|||
mSymbolList = new SearchListView(this, mSymbolSearchList, true, true);
|
||||
mSymbolList->mSearchStartCol = 1;
|
||||
|
||||
// Add a disassembly popup
|
||||
new DisassemblyPopup(mSymbolSearchList->list(), Bridge::getArchitecture());
|
||||
new DisassemblyPopup(mSymbolSearchList->searchList(), Bridge::getArchitecture());
|
||||
|
||||
// Create module list
|
||||
mModuleList = new StdIconSearchListView(this, true, false, new StdTableSearchList(new ModuleStdTable(), new ModuleStdTable()));
|
||||
mModuleList->setSearchStartCol(ColBase);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "Bridge.h"
|
||||
#include "StringUtil.h"
|
||||
#include "LineEditDialog.h"
|
||||
#include "DisassemblyPopup.h"
|
||||
|
||||
void ThreadView::contextMenuSlot(const QPoint & pos)
|
||||
{
|
||||
|
@ -179,6 +180,8 @@ ThreadView::ThreadView(StdTable* parent) : StdTable(parent)
|
|||
connect(this, SIGNAL(contextMenuSignal(QPoint)), this, SLOT(contextMenuSlot(QPoint)));
|
||||
|
||||
setupContextMenu();
|
||||
|
||||
new DisassemblyPopup(this, Bridge::getArchitecture());
|
||||
}
|
||||
|
||||
void ThreadView::updateThreadList()
|
||||
|
|
Loading…
Reference in New Issue