Added option to display address Fix#113

This commit is contained in:
xarkes 2017-09-01 15:03:35 +02:00
parent 2fa55ffda5
commit c07f486920
6 changed files with 70 additions and 38 deletions

View File

@ -161,14 +161,14 @@ void MainWindow::initUI()
this->omnibar = new Omnibar(this); this->omnibar = new Omnibar(this);
ui->mainToolBar->insertWidget(ui->actionShow_Hide_mainsidebar, this->omnibar); ui->mainToolBar->insertWidget(ui->actionShow_Hide_mainsidebar, this->omnibar);
// Add special sepparators to the toolbar that expand to separate groups of elements // Add special separators to the toolbar that expand to separate groups of elements
QWidget *spacer2 = new QWidget(); QWidget *spacer2 = new QWidget();
spacer2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); spacer2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
spacer2->setMinimumSize(10, 10); spacer2->setMinimumSize(10, 10);
spacer2->setMaximumWidth(300); spacer2->setMaximumWidth(300);
ui->mainToolBar->insertWidget(ui->actionShow_Hide_mainsidebar, spacer2); ui->mainToolBar->insertWidget(ui->actionShow_Hide_mainsidebar, spacer2);
// Sepparator between back/forward and undo/redo buttons // Separator between back/forward and undo/redo buttons
QWidget *spacer = new QWidget(); QWidget *spacer = new QWidget();
spacer->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); spacer->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
spacer->setMinimumSize(20, 20); spacer->setMinimumSize(20, 20);
@ -183,7 +183,6 @@ void MainWindow::initUI()
/* /*
* Dock Widgets * Dock Widgets
*/ */
dockWidgets.reserve(11); dockWidgets.reserve(11);
// Add Memory DockWidget // Add Memory DockWidget
@ -1076,19 +1075,26 @@ void MainWindow::refreshVisibleDockWidgets()
void MainWindow::on_actionRefresh_contents_triggered() void MainWindow::on_actionRefresh_contents_triggered()
{ {
this->refreshVisibleDockWidgets(); refreshVisibleDockWidgets();
} }
void MainWindow::on_actionDisplay_Esil_triggered() void MainWindow::on_actionDisplay_Esil_triggered()
{ {
int esil = this->core->getConfig("asm.esil"); int esil = this->core->getConfig("asm.esil");
this->core->config("asm.esil", !esil); core->config("asm.esil", !esil);
this->refreshVisibleDockWidgets(); refreshVisibleDockWidgets();
} }
void MainWindow::on_actionDisplay_Pseudocode_triggered() void MainWindow::on_actionDisplay_Pseudocode_triggered()
{ {
int pseudo = this->core->getConfig("asm.pseudo"); int pseudo = this->core->getConfig("asm.pseudo");
this->core->config("asm.pseudo", !pseudo); core->config("asm.pseudo", !pseudo);
this->refreshVisibleDockWidgets(); refreshVisibleDockWidgets();
}
void MainWindow::on_actionDisplay_Offsets_triggered()
{
bool checked = ui->actionDisplay_Offsets->isChecked();
memoryDock->showOffsets(checked);
refreshVisibleDockWidgets();
} }

View File

@ -178,6 +178,8 @@ private slots:
void on_actionDisplay_Pseudocode_triggered(); void on_actionDisplay_Pseudocode_triggered();
void on_actionDisplay_Offsets_triggered();
private: private:
QDockWidget *asmDock; QDockWidget *asmDock;
QDockWidget *calcDock; QDockWidget *calcDock;

View File

@ -159,7 +159,7 @@ border-top: 0px;
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1013</width> <width>1013</width>
<height>25</height> <height>20</height>
</rect> </rect>
</property> </property>
<property name="defaultUp"> <property name="defaultUp">
@ -173,8 +173,8 @@ border-top: 0px;
<rect> <rect>
<x>273</x> <x>273</x>
<y>136</y> <y>136</y>
<width>156</width> <width>148</width>
<height>182</height> <height>167</height>
</rect> </rect>
</property> </property>
<property name="title"> <property name="title">
@ -197,7 +197,7 @@ border-top: 0px;
<addaction name="actionAssembler"/> <addaction name="actionAssembler"/>
<addaction name="actionSDB_browser"/> <addaction name="actionSDB_browser"/>
</widget> </widget>
<widget class="QMenu" name="menuWorkspace"> <widget class="QMenu" name="menuView">
<property name="title"> <property name="title">
<string>View</string> <string>View</string>
</property> </property>
@ -217,6 +217,7 @@ border-top: 0px;
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionDisplay_Esil"/> <addaction name="actionDisplay_Esil"/>
<addaction name="actionDisplay_Pseudocode"/> <addaction name="actionDisplay_Pseudocode"/>
<addaction name="actionDisplay_Offsets"/>
</widget> </widget>
<widget class="QMenu" name="menuHelp"> <widget class="QMenu" name="menuHelp">
<property name="title"> <property name="title">
@ -245,7 +246,7 @@ border-top: 0px;
<addaction name="actionFind_next"/> <addaction name="actionFind_next"/>
<addaction name="actionFind_previous"/> <addaction name="actionFind_previous"/>
</widget> </widget>
<widget class="QMenu" name="menuView"> <widget class="QMenu" name="menuWindows">
<property name="title"> <property name="title">
<string>Windows</string> <string>Windows</string>
</property> </property>
@ -267,9 +268,9 @@ border-top: 0px;
</widget> </widget>
<addaction name="menuFile"/> <addaction name="menuFile"/>
<addaction name="menuEdit"/> <addaction name="menuEdit"/>
<addaction name="menuWorkspace"/>
<addaction name="menuTools"/>
<addaction name="menuView"/> <addaction name="menuView"/>
<addaction name="menuTools"/>
<addaction name="menuWindows"/>
<addaction name="menuHelp"/> <addaction name="menuHelp"/>
</widget> </widget>
<widget class="QToolBar" name="sideToolBar"> <widget class="QToolBar" name="sideToolBar">
@ -921,26 +922,37 @@ QToolButton .svg-icon path {
</property> </property>
</action> </action>
<action name="actionDisplay_Esil"> <action name="actionDisplay_Esil">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text"> <property name="text">
<string>Show ESIL rather than assembly</string> <string>Show ESIL rather than assembly</string>
</property> </property>
<property name="checkable">
<bool>true</bool>
</property>
</action> </action>
<action name="actionDisplay_Pseudocode"> <action name="actionDisplay_Pseudocode">
<property name="text">
<string>Show pseudocode rather than assembly</string>
</property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="text">
<string>Show pseudocode rather than assembly</string>
</property>
</action> </action>
<action name="actionEntry_points"> <action name="actionEntry_points">
<property name="text"> <property name="text">
<string>Entry points</string> <string>Entry points</string>
</property> </property>
</action> </action>
<action name="actionDisplay_Offsets">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Display offsets</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources> <resources>

View File

@ -470,7 +470,7 @@ void MemoryWidget::replaceTextDisasm(QString txt)
bool MemoryWidget::loadMoreDisassembly() bool MemoryWidget::loadMoreDisassembly()
{ {
/* /*
* Add more disasm as the user scrolls z * Add more disasm as the user scrolls
* Not working properly when scrolling upwards * Not working properly when scrolling upwards
* r2 doesn't handle properly 'pd-' for archs with variable instruction size * r2 doesn't handle properly 'pd-' for archs with variable instruction size
*/ */
@ -2020,3 +2020,13 @@ void MemoryWidget::updateViews(RVA offset)
} }
} }
} }
void MemoryWidget::showOffsets(bool show) {
if (show) {
this->hexOffsetText->show();
main->core->config("asm.offset", 1);
} else {
this->hexOffsetText->hide();
main->core->config("asm.offset", 0);
}
}

View File

@ -94,6 +94,8 @@ public slots:
void updateViews(RVA offset = RVA_INVALID); void updateViews(RVA offset = RVA_INVALID);
void showOffsets(bool show);
protected: protected:
void resizeEvent(QResizeEvent *event) override; void resizeEvent(QResizeEvent *event) override;
bool eventFilter(QObject *obj, QEvent *event) override; bool eventFilter(QObject *obj, QEvent *event) override;

View File

@ -937,7 +937,7 @@ QToolTip {
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QWebEngineView" name="webSimpleGraph"> <widget class="QWebEngineView" name="webSimpleGraph" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding"> <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -958,7 +958,7 @@ QToolTip {
font: 11pt &quot;Monaco&quot;; font: 11pt &quot;Monaco&quot;;
}</string> }</string>
</property> </property>
<property name="url"> <property name="url" stdset="0">
<url> <url>
<string>about:blank</string> <string>about:blank</string>
</url> </url>
@ -1233,16 +1233,16 @@ p, li { white-space: pre-wrap; }
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QWebEngineView" name="graphWebView"> <widget class="QWebEngineView" name="graphWebView" native="true">
<property name="contextMenuPolicy"> <property name="contextMenuPolicy">
<enum>Qt::DefaultContextMenu</enum> <enum>Qt::DefaultContextMenu</enum>
</property> </property>
<property name="url"> <property name="url" stdset="0">
<url> <url>
<string>about:blank</string> <string>about:blank</string>
</url> </url>
</property> </property>
<property name="zoomFactor"> <property name="zoomFactor" stdset="0">
<double>1.000000000000000</double> <double>1.000000000000000</double>
</property> </property>
</widget> </widget>
@ -1331,7 +1331,7 @@ border-top: 0px;
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>256</width> <width>256</width>
<height>887</height> <height>868</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -1635,7 +1635,7 @@ QToolTip {
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QWebEngineView" name="fcnWebView"> <widget class="QWebEngineView" name="fcnWebView" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -1654,7 +1654,7 @@ QToolTip {
<height>250</height> <height>250</height>
</size> </size>
</property> </property>
<property name="url"> <property name="url" stdset="0">
<url> <url>
<string>qrc:/html/fcn_graph.html</string> <string>qrc:/html/fcn_graph.html</string>
</url> </url>
@ -1684,7 +1684,7 @@ QToolTip {
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QWebEngineView" name="radarGraphWebView"> <widget class="QWebEngineView" name="radarGraphWebView" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -1703,7 +1703,7 @@ QToolTip {
<height>250</height> <height>250</height>
</size> </size>
</property> </property>
<property name="url"> <property name="url" stdset="0">
<url> <url>
<string>qrc:/html/fcn_radar.html</string> <string>qrc:/html/fcn_radar.html</string>
</url> </url>