1
0
Fork 0

GUI: added 'Search For -> Intermodular calls' (resolved issue #89)

This commit is contained in:
Mr. eXoDia 2014-06-24 04:52:52 +02:00
parent 43eb27258e
commit 6f38a0c5e5
13 changed files with 43 additions and 7 deletions

View File

@ -121,7 +121,7 @@ QString Disassembly::paintContent(QPainter* painter, int_t rowBase, int rowOffse
if(DbgGetLabelAt(cur_addr, SEG_DEFAULT, label)) //has label if(DbgGetLabelAt(cur_addr, SEG_DEFAULT, label)) //has label
{ {
char module[MAX_MODULE_SIZE]=""; char module[MAX_MODULE_SIZE]="";
if(DbgGetModuleAt(cur_addr, module)) if(DbgGetModuleAt(cur_addr, module) && !QString(label).startsWith("JMP.&"))
addrText+=" <"+QString(module)+"."+QString(label)+">"; addrText+=" <"+QString(module)+"."+QString(label)+">";
else else
addrText+=" <"+QString(label)+">"; addrText+=" <"+QString(label)+">";

View File

@ -156,7 +156,7 @@ QString BeaTokenizer::PrintValue(const BeaTokenValue* value, bool module)
char moduleText[MAX_MODULE_SIZE]=""; char moduleText[MAX_MODULE_SIZE]="";
int_t addr=value->value; int_t addr=value->value;
bool bHasLabel=DbgGetLabelAt(addr, SEG_DEFAULT, labelText); bool bHasLabel=DbgGetLabelAt(addr, SEG_DEFAULT, labelText);
bool bHasModule=(module && DbgGetModuleAt(addr, moduleText)); bool bHasModule=(module && DbgGetModuleAt(addr, moduleText) && !QString(labelText).startsWith("JMP.&"));
QString addrText; QString addrText;
addrText=QString("%1").arg(addr&(uint_t)-1, 0, 16, QChar('0')).toUpper(); addrText=QString("%1").arg(addr&(uint_t)-1, 0, 16, QChar('0')).toUpper();
QString finalText; QString finalText;

View File

@ -210,6 +210,7 @@ void CPUDisassembly::contextMenuEvent(QContextMenuEvent* event)
mSearchMenu->addAction(mSearchConstant); mSearchMenu->addAction(mSearchConstant);
mSearchMenu->addAction(mSearchStrings); mSearchMenu->addAction(mSearchStrings);
mSearchMenu->addAction(mSearchCalls);
wMenu->addMenu(mSearchMenu); wMenu->addMenu(mSearchMenu);
mReferencesMenu->addAction(mReferenceSelectedAddress); mReferencesMenu->addAction(mReferenceSelectedAddress);
@ -363,6 +364,10 @@ void CPUDisassembly::setupRightClickContextMenu()
mSearchStrings = new QAction("&String references", this); mSearchStrings = new QAction("&String references", this);
connect(mSearchStrings, SIGNAL(triggered()), this, SLOT(findStrings())); connect(mSearchStrings, SIGNAL(triggered()), this, SLOT(findStrings()));
// Intermodular Calls
mSearchCalls = new QAction("&Intermodular calls", this);
connect(mSearchCalls, SIGNAL(triggered()), this, SLOT(findCalls()));
// Highlighting mode // Highlighting mode
mEnableHighlightingMode = new QAction("&Highlighting mode", this); mEnableHighlightingMode = new QAction("&Highlighting mode", this);
mEnableHighlightingMode->setShortcutContext(Qt::WidgetShortcut); mEnableHighlightingMode->setShortcutContext(Qt::WidgetShortcut);
@ -715,6 +720,13 @@ void CPUDisassembly::findStrings()
emit displayReferencesWidget(); emit displayReferencesWidget();
} }
void CPUDisassembly::findCalls()
{
QString addrText=QString("%1").arg(rvaToVa(getInitialSelection()), sizeof(int_t)*2, 16, QChar('0')).toUpper();
DbgCmdExec(QString("modcallfind " + addrText).toUtf8().constData());
emit displayReferencesWidget();
}
void CPUDisassembly::selectionGet(SELECTIONDATA* selection) void CPUDisassembly::selectionGet(SELECTIONDATA* selection)
{ {
selection->start=rvaToVa(getSelectionStart()); selection->start=rvaToVa(getSelectionStart());

View File

@ -54,6 +54,7 @@ public slots:
void findReferences(); void findReferences();
void findConstant(); void findConstant();
void findStrings(); void findStrings();
void findCalls();
void selectionGet(SELECTIONDATA* selection); void selectionGet(SELECTIONDATA* selection);
void selectionSet(const SELECTIONDATA* selection); void selectionSet(const SELECTIONDATA* selection);
void enableHighlightingMode(); void enableHighlightingMode();
@ -88,6 +89,7 @@ private:
QAction* mReferenceSelectedAddress; QAction* mReferenceSelectedAddress;
QAction* mSearchConstant; QAction* mSearchConstant;
QAction* mSearchStrings; QAction* mSearchStrings;
QAction* mSearchCalls;
QAction* mEnableHighlightingMode; QAction* mEnableHighlightingMode;
GotoDialog* mGoto; GotoDialog* mGoto;

View File

@ -153,7 +153,7 @@ QString CPUDump::paintContent(QPainter* painter, int_t rowBase, int rowOffset, i
if(DbgGetLabelAt(curAddr, SEG_DEFAULT, label)) //has label if(DbgGetLabelAt(curAddr, SEG_DEFAULT, label)) //has label
{ {
char module[MAX_MODULE_SIZE]=""; char module[MAX_MODULE_SIZE]="";
if(DbgGetModuleAt(curAddr, module)) if(DbgGetModuleAt(curAddr, module) && !QString(label).startsWith("JMP.&"))
addrText+=" <"+QString(module)+"."+QString(label)+">"; addrText+=" <"+QString(module)+"."+QString(label)+">";
else else
addrText+=" <"+QString(label)+">"; addrText+=" <"+QString(label)+">";

View File

@ -36,7 +36,7 @@ void CPUInfoBox::disasmSelectionChanged(int_t parVA)
{ {
QString fullLabel="<"+QString(label)+">"; QString fullLabel="<"+QString(label)+">";
char mod[MAX_MODULE_SIZE]=""; char mod[MAX_MODULE_SIZE]="";
if(DbgGetModuleAt(parVA, mod)) if(DbgGetModuleAt(parVA, mod) && !QString(label).startsWith("JMP.&"))
fullLabel="<"+QString(mod)+"."+QString(label)+">"; fullLabel="<"+QString(mod)+"."+QString(label)+">";
info=QString("%1").arg(parVA, sizeof(int_t) * 2, 16, QChar('0')).toUpper() + " " + fullLabel; info=QString("%1").arg(parVA, sizeof(int_t) * 2, 16, QChar('0')).toUpper() + " " + fullLabel;
} }

View File

@ -106,7 +106,7 @@ QString CPUStack::paintContent(QPainter* painter, int_t rowBase, int rowOffset,
if(DbgGetLabelAt(curAddr, SEG_DEFAULT, label)) //has label if(DbgGetLabelAt(curAddr, SEG_DEFAULT, label)) //has label
{ {
char module[MAX_MODULE_SIZE]=""; char module[MAX_MODULE_SIZE]="";
if(DbgGetModuleAt(curAddr, module)) if(DbgGetModuleAt(curAddr, module) && !QString(label).startsWith("JMP.&"))
addrText+=" <"+QString(module)+"."+QString(label)+">"; addrText+=" <"+QString(module)+"."+QString(label)+">";
else else
addrText+=" <"+QString(label)+">"; addrText+=" <"+QString(label)+">";

View File

@ -62,12 +62,12 @@ void GotoDialog::on_editExpression_textChanged(const QString &arg1)
char label[MAX_LABEL_SIZE]=""; char label[MAX_LABEL_SIZE]="";
if(DbgGetLabelAt(addr, SEG_DEFAULT, label)) //has label if(DbgGetLabelAt(addr, SEG_DEFAULT, label)) //has label
{ {
if(DbgGetModuleAt(addr, module)) if(DbgGetModuleAt(addr, module) && !QString(label).startsWith("JMP.&"))
addrText=QString(module)+"."+QString(label); addrText=QString(module)+"."+QString(label);
else else
addrText=QString(label); addrText=QString(label);
} }
else if(DbgGetModuleAt(addr, module)) else if(DbgGetModuleAt(addr, module) && !QString(label).startsWith("JMP.&"))
addrText=QString(module)+"."+QString("%1").arg(addr, sizeof(int_t)*2, 16, QChar('0')).toUpper(); addrText=QString(module)+"."+QString("%1").arg(addr, sizeof(int_t)*2, 16, QChar('0')).toUpper();
else else
addrText=QString("%1").arg(addr, sizeof(int_t)*2, 16, QChar('0')).toUpper(); addrText=QString("%1").arg(addr, sizeof(int_t)*2, 16, QChar('0')).toUpper();

View File

@ -133,6 +133,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
connect(ui->actionThreads,SIGNAL(triggered()),this,SLOT(displayThreadsWidget())); connect(ui->actionThreads,SIGNAL(triggered()),this,SLOT(displayThreadsWidget()));
connect(ui->actionSettings,SIGNAL(triggered()),this,SLOT(openSettings())); connect(ui->actionSettings,SIGNAL(triggered()),this,SLOT(openSettings()));
connect(ui->actionStrings,SIGNAL(triggered()),this,SLOT(findStrings())); connect(ui->actionStrings,SIGNAL(triggered()),this,SLOT(findStrings()));
connect(ui->actionCalls,SIGNAL(triggered()),this,SLOT(findModularCalls()));
connect(ui->actionAppearance,SIGNAL(triggered()),this,SLOT(openAppearance())); connect(ui->actionAppearance,SIGNAL(triggered()),this,SLOT(openAppearance()));
connect(Bridge::getBridge(), SIGNAL(updateWindowTitle(QString)), this, SLOT(updateWindowTitleSlot(QString))); connect(Bridge::getBridge(), SIGNAL(updateWindowTitle(QString)), this, SLOT(updateWindowTitleSlot(QString)));
@ -575,6 +576,12 @@ void MainWindow::findStrings()
displayReferencesWidget(); displayReferencesWidget();
} }
void MainWindow::findModularCalls()
{
DbgCmdExec(QString("modcallfind " + QString("%1").arg(mCpuWidget->mDisas->rvaToVa(mCpuWidget->mDisas->getInitialSelection()), sizeof(int_t)*2, 16, QChar('0')).toUpper()).toUtf8().constData());
displayReferencesWidget();
}
void MainWindow::addMenu(int hMenu, QString title) void MainWindow::addMenu(int hMenu, QString title)
{ {
int nFound=-1; int nFound=-1;

View File

@ -70,6 +70,7 @@ public slots:
void addRecentFile(QString file); void addRecentFile(QString file);
void setLastException(unsigned int exceptionCode); void setLastException(unsigned int exceptionCode);
void findStrings(); void findStrings();
void findModularCalls();
void addMenu(int hMenu, QString title); void addMenu(int hMenu, QString title);
void addMenuEntry(int hMenu, QString title); void addMenuEntry(int hMenu, QString title);
void addSeparator(int hMenu); void addSeparator(int hMenu);

View File

@ -140,6 +140,7 @@
<addaction name="actionScylla"/> <addaction name="actionScylla"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionStrings"/> <addaction name="actionStrings"/>
<addaction name="actionCalls"/>
</widget> </widget>
<widget class="QStatusBar" name="statusBar"/> <widget class="QStatusBar" name="statusBar"/>
<widget class="QToolBar" name="cmdBar"> <widget class="QToolBar" name="cmdBar">
@ -507,6 +508,18 @@
<string>&amp;Appearance</string> <string>&amp;Appearance</string>
</property> </property>
</action> </action>
<action name="actionCalls">
<property name="icon">
<iconset resource="../../resource.qrc">
<normaloff>:/icons/images/call.png</normaloff>:/icons/images/call.png</iconset>
</property>
<property name="text">
<string>Find Intermodular Calls</string>
</property>
<property name="toolTip">
<string>Find Intermodular Calls</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources> <resources>

Binary file not shown.

After

Width:  |  Height:  |  Size: 668 B

View File

@ -31,5 +31,6 @@
<file>images/settings.png</file> <file>images/settings.png</file>
<file>images/strings.png</file> <file>images/strings.png</file>
<file>images/color-swatches.png</file> <file>images/color-swatches.png</file>
<file>images/call.png</file>
</qresource> </qresource>
</RCC> </RCC>