GUI: changed text of InfoBox + added copy address + rva + offset to info box
This commit is contained in:
parent
339a27aec7
commit
63ed769b67
|
@ -1520,7 +1520,7 @@ QString Disassembly::getAddrText(dsint cur_addr, char label[MAX_LABEL_SIZE])
|
|||
#endif //_WIN64
|
||||
}
|
||||
}
|
||||
addrText += AddressToString(cur_addr);
|
||||
addrText += ToPtrString(cur_addr);
|
||||
char label_[MAX_LABEL_SIZE] = "";
|
||||
if(DbgGetLabelAt(cur_addr, SEG_DEFAULT, label_)) //has label
|
||||
{
|
||||
|
|
|
@ -388,7 +388,7 @@ void StdTable::setupCopyMenu(QMenu* copyMenu)
|
|||
QAction* mCopyTable = new QAction("Whole &Table", this);
|
||||
connect(mCopyTable, SIGNAL(triggered()), this, SLOT(copyTableSlot()));
|
||||
copyMenu->addAction(mCopyTable);
|
||||
//Copy->Separatoe
|
||||
//Copy->Separator
|
||||
copyMenu->addSeparator();
|
||||
//Copy->ColName
|
||||
for(int i = 0; i < getColumnCount(); i++)
|
||||
|
|
|
@ -24,6 +24,15 @@ CPUInfoBox::CPUInfoBox(StdTable* parent) : StdTable(parent)
|
|||
|
||||
// Deselect any row (visual reasons only)
|
||||
setSingleSelection(-1);
|
||||
|
||||
setupContextMenu();
|
||||
}
|
||||
|
||||
void CPUInfoBox::setupContextMenu()
|
||||
{
|
||||
mCopyAddressAction = makeAction("Address", SLOT(copyAddress()));
|
||||
mCopyRvaAction = makeAction("RVA", SLOT(copyRva()));
|
||||
mCopyOffsetAction = makeAction("File Offset", SLOT(copyOffset()));
|
||||
}
|
||||
|
||||
int CPUInfoBox::getHeight()
|
||||
|
@ -97,6 +106,9 @@ QString CPUInfoBox::getSymbolicName(dsint addr)
|
|||
void CPUInfoBox::disasmSelectionChanged(dsint parVA)
|
||||
{
|
||||
curAddr = parVA;
|
||||
curRva = -1;
|
||||
curOffset = -1;
|
||||
|
||||
if(!DbgIsDebugging() || !DbgMemIsValidReadPtr(parVA))
|
||||
return;
|
||||
|
||||
|
@ -182,7 +194,7 @@ void CPUInfoBox::disasmSelectionChanged(dsint parVA)
|
|||
|
||||
// Set last line
|
||||
//
|
||||
// Format: SECTION:VA MODULE+RVA FILE_OFFSET FUNCTION
|
||||
// Format: SECTION:VA MODULE:$RVA :#FILE_OFFSET FUNCTION
|
||||
QString info;
|
||||
|
||||
// Section
|
||||
|
@ -191,7 +203,7 @@ void CPUInfoBox::disasmSelectionChanged(dsint parVA)
|
|||
info += QString(section) + ":";
|
||||
|
||||
// VA
|
||||
info += AddressToString(parVA) + " ";
|
||||
info += ToPtrString(parVA) + " ";
|
||||
|
||||
// Module name, RVA, and file offset
|
||||
char mod[MAX_MODULE_SIZE];
|
||||
|
@ -202,14 +214,14 @@ void CPUInfoBox::disasmSelectionChanged(dsint parVA)
|
|||
// Append modname
|
||||
info += mod;
|
||||
|
||||
// Module RVA
|
||||
curRva = parVA - modbase;
|
||||
if(modbase)
|
||||
info += ":" + QString("%1").arg(parVA - modbase, 0, 16, QChar('0')).toUpper();
|
||||
|
||||
// Append space afterwards
|
||||
info += " ";
|
||||
info += QString(":$%1 ").arg(curRva, 0, 16, QChar('0')).toUpper();
|
||||
|
||||
// File offset
|
||||
info += QString("%1").arg(DbgFunctions()->VaToFileOffset(parVA), 0, 16, QChar('0')).toUpper() + " ";
|
||||
curOffset = DbgFunctions()->VaToFileOffset(parVA);
|
||||
info += QString("#%1 ").arg(curOffset, 0, 16, QChar('0')).toUpper() + " ";
|
||||
}
|
||||
|
||||
// Function/label name
|
||||
|
@ -248,7 +260,7 @@ void CPUInfoBox::addFollowMenuItem(QMenu* menu, QString name, dsint value)
|
|||
void CPUInfoBox::setupFollowMenu(QMenu* menu, dsint wVA)
|
||||
{
|
||||
//most basic follow action
|
||||
addFollowMenuItem(menu, "&Selection", wVA);
|
||||
addFollowMenuItem(menu, "&Selected Address", wVA);
|
||||
|
||||
//add follow actions
|
||||
DISASM_INSTR instr;
|
||||
|
@ -286,6 +298,14 @@ void CPUInfoBox::contextMenuSlot(QPoint pos)
|
|||
wMenu->addMenu(wFollowMenu);
|
||||
QMenu wCopyMenu("&Copy", this);
|
||||
setupCopyMenu(&wCopyMenu);
|
||||
if(DbgIsDebugging())
|
||||
{
|
||||
wCopyMenu.addAction(mCopyAddressAction);
|
||||
if(curRva != -1)
|
||||
wCopyMenu.addAction(mCopyRvaAction);
|
||||
if(curOffset != -1)
|
||||
wCopyMenu.addAction(mCopyOffsetAction);
|
||||
}
|
||||
if(wCopyMenu.actions().length())
|
||||
{
|
||||
wMenu->addSeparator();
|
||||
|
@ -293,3 +313,18 @@ void CPUInfoBox::contextMenuSlot(QPoint pos)
|
|||
}
|
||||
wMenu->exec(mapToGlobal(pos)); //execute context menu
|
||||
}
|
||||
|
||||
void CPUInfoBox::copyAddress()
|
||||
{
|
||||
Bridge::CopyToClipboard(ToPtrString(curAddr));
|
||||
}
|
||||
|
||||
void CPUInfoBox::copyRva()
|
||||
{
|
||||
Bridge::CopyToClipboard(ToHexString(curRva));
|
||||
}
|
||||
|
||||
void CPUInfoBox::copyOffset()
|
||||
{
|
||||
Bridge::CopyToClipboard(ToHexString(curOffset));
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define INFOBOX_H
|
||||
|
||||
#include "StdTable.h"
|
||||
#include <QAction>
|
||||
|
||||
class CPUInfoBox : public StdTable
|
||||
{
|
||||
|
@ -17,13 +18,23 @@ public slots:
|
|||
void dbgStateChanged(DBGSTATE state);
|
||||
void contextMenuSlot(QPoint pos);
|
||||
void followActionSlot();
|
||||
void copyAddress();
|
||||
void copyRva();
|
||||
void copyOffset();
|
||||
|
||||
private:
|
||||
dsint curAddr;
|
||||
dsint curRva;
|
||||
dsint curOffset;
|
||||
QString getSymbolicName(dsint addr);
|
||||
void setInfoLine(int line, QString text);
|
||||
QString getInfoLine(int line);
|
||||
void clear();
|
||||
void setupContextMenu();
|
||||
|
||||
QAction* mCopyAddressAction;
|
||||
QAction* mCopyRvaAction;
|
||||
QAction* mCopyOffsetAction;
|
||||
};
|
||||
|
||||
#endif // INFOBOX_H
|
||||
|
|
|
@ -223,7 +223,7 @@ QString CPUStack::paintContent(QPainter* painter, dsint rowBase, int rowOffset,
|
|||
#endif //_WIN64
|
||||
}
|
||||
}
|
||||
addrText += AddressToString(cur_addr);
|
||||
addrText += ToPtrString(cur_addr);
|
||||
if(DbgGetLabelAt(cur_addr, SEG_DEFAULT, label)) //has label
|
||||
{
|
||||
char module[MAX_MODULE_SIZE] = "";
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <QString>
|
||||
#include "Imports.h"
|
||||
|
||||
static QString AddressToString(dsint Address)
|
||||
static QString ToPtrString(duint Address)
|
||||
{
|
||||
//
|
||||
// This function exists because of how QT handles
|
||||
|
@ -24,4 +24,17 @@ static QString AddressToString(dsint Address)
|
|||
return QString(temp);
|
||||
}
|
||||
|
||||
static QString ToHexString(duint Address)
|
||||
{
|
||||
char temp[32];
|
||||
|
||||
#ifdef _WIN64
|
||||
sprintf_s(temp, "%llX", Address);
|
||||
#else
|
||||
sprintf_s(temp, "%X", Address);
|
||||
#endif // _WIN64
|
||||
|
||||
return QString(temp);
|
||||
}
|
||||
|
||||
#endif // STRINGUTIL_H
|
||||
|
|
Loading…
Reference in New Issue