1
0
Fork 0

Add symbolic name of the breakpoint to be edited, resolves #1326 (#1346)

* Add symbolic name of the breakpoint to be edited

* Extend Follow in Disassembler button, extend Calculator window resolves #1347

* Created a distinct getSymbolicName function, resolves #1326
This commit is contained in:
Cornel Punga 2016-12-05 22:48:53 +02:00 committed by Duncan Ogilvie
parent 1a1d4e8bce
commit d55494b53f
4 changed files with 30 additions and 8 deletions

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>502</width>
<height>254</height>
<height>270</height>
</rect>
</property>
<property name="sizePolicy">
@ -27,8 +27,8 @@
<property name="geometry">
<rect>
<x>10</x>
<y>220</y>
<width>121</width>
<y>240</y>
<width>141</width>
<height>23</height>
</rect>
</property>
@ -42,7 +42,7 @@
<x>11</x>
<y>8</y>
<width>481</width>
<height>211</height>
<height>225</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
@ -211,7 +211,7 @@
<property name="geometry">
<rect>
<x>417</x>
<y>220</y>
<y>240</y>
<width>75</width>
<height>23</height>
</rect>
@ -223,8 +223,8 @@
<widget class="QPushButton" name="btnGotoDump">
<property name="geometry">
<rect>
<x>140</x>
<y>220</y>
<x>160</x>
<y>240</y>
<width>141</width>
<height>23</height>
</rect>

View File

@ -1,6 +1,7 @@
#include "EditBreakpointDialog.h"
#include "ui_EditBreakpointDialog.h"
#include "StringUtil.h"
#include "MiscUtil.h"
EditBreakpointDialog::EditBreakpointDialog(QWidget* parent, const BRIDGEBP & bp)
: QDialog(parent),
@ -15,7 +16,7 @@ EditBreakpointDialog::EditBreakpointDialog(QWidget* parent, const BRIDGEBP & bp)
}
else
{
setWindowTitle(QString(tr("Edit Breakpoint %1")).arg(ToHexString(bp.addr)));
setWindowTitle(QString(tr("Edit Breakpoint %1")).arg(getSymbolicName(bp.addr)));
}
setWindowIcon(DIcon("breakpoint.png"));
loadFromBp();

View File

@ -2,6 +2,7 @@
#include <windows.h>
#include "LineEditDialog.h"
#include <QMessageBox>
#include "StringUtil.h"
void SetApplicationIcon(WId winId)
{
@ -56,3 +57,21 @@ void SimpleWarningBox(QWidget* parent, const QString & title, const QString & te
msg.setWindowFlags(msg.windowFlags() & (~Qt::WindowContextHelpButtonHint));
msg.exec();
}
QString getSymbolicName(duint addr)
{
char labelText[MAX_LABEL_SIZE] = "";
char moduleText[MAX_MODULE_SIZE] = "";
bool bHasLabel = DbgGetLabelAt(addr, SEG_DEFAULT, labelText);
bool bHasModule = (DbgGetModuleAt(addr, moduleText) && !QString(labelText).startsWith("JMP.&"));
QString addrText = ToPtrString(addr);
if(bHasLabel && bHasModule) // <module.label>
return QString("%1 <%2.%3>").arg(addrText).arg(moduleText).arg(labelText);
else if(bHasModule) // module.addr
return QString("%1.%2").arg(moduleText).arg(addrText);
else if(bHasLabel) // <label>
return QString("<%1>").arg(labelText);
else
return addrText;
}

View File

@ -2,6 +2,7 @@
#define MISCUTIL_H
#include <QIcon>
#include "bridge/bridgemain.h"
class QWidget;
class QByteArray;
@ -11,6 +12,7 @@ QByteArray & ByteReverse(QByteArray & array);
bool SimpleInputBox(QWidget* parent, const QString & title, QString defaultValue, QString & output, const QString & placeholderText, QIcon* icon = nullptr);
void SimpleErrorBox(QWidget* parent, const QString & title, const QString & text);
void SimpleWarningBox(QWidget* parent, const QString & title, const QString & text);
QString getSymbolicName(duint addr);
#define DIcon(file) QIcon(QString(":/icons/images/").append(file))
#endif // MISCUTIL_H