Skip to content

Commit

Permalink
Added option to display address Fix#113
Browse files Browse the repository at this point in the history
  • Loading branch information
xarkes committed Sep 1, 2017
1 parent 2fa55ff commit c07f486
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 38 deletions.
22 changes: 14 additions & 8 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,14 @@ void MainWindow::initUI()
this->omnibar = new Omnibar(this);
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();
spacer2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
spacer2->setMinimumSize(10, 10);
spacer2->setMaximumWidth(300);
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();
spacer->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
spacer->setMinimumSize(20, 20);
Expand All @@ -183,7 +183,6 @@ void MainWindow::initUI()
/*
* Dock Widgets
*/

dockWidgets.reserve(11);

// Add Memory DockWidget
Expand Down Expand Up @@ -1076,19 +1075,26 @@ void MainWindow::refreshVisibleDockWidgets()

void MainWindow::on_actionRefresh_contents_triggered()
{
this->refreshVisibleDockWidgets();
refreshVisibleDockWidgets();
}

void MainWindow::on_actionDisplay_Esil_triggered()
{
int esil = this->core->getConfig("asm.esil");
this->core->config("asm.esil", !esil);
this->refreshVisibleDockWidgets();
core->config("asm.esil", !esil);
refreshVisibleDockWidgets();
}

void MainWindow::on_actionDisplay_Pseudocode_triggered()
{
int pseudo = this->core->getConfig("asm.pseudo");
this->core->config("asm.pseudo", !pseudo);
this->refreshVisibleDockWidgets();
core->config("asm.pseudo", !pseudo);
refreshVisibleDockWidgets();
}

void MainWindow::on_actionDisplay_Offsets_triggered()
{
bool checked = ui->actionDisplay_Offsets->isChecked();
memoryDock->showOffsets(checked);
refreshVisibleDockWidgets();
}
2 changes: 2 additions & 0 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ private slots:

void on_actionDisplay_Pseudocode_triggered();

void on_actionDisplay_Offsets_triggered();

private:
QDockWidget *asmDock;
QDockWidget *calcDock;
Expand Down
50 changes: 31 additions & 19 deletions src/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ border-top: 0px;
<x>0</x>
<y>0</y>
<width>1013</width>
<height>25</height>
<height>20</height>
</rect>
</property>
<property name="defaultUp">
Expand All @@ -173,8 +173,8 @@ border-top: 0px;
<rect>
<x>273</x>
<y>136</y>
<width>156</width>
<height>182</height>
<width>148</width>
<height>167</height>
</rect>
</property>
<property name="title">
Expand All @@ -197,7 +197,7 @@ border-top: 0px;
<addaction name="actionAssembler"/>
<addaction name="actionSDB_browser"/>
</widget>
<widget class="QMenu" name="menuWorkspace">
<widget class="QMenu" name="menuView">
<property name="title">
<string>View</string>
</property>
Expand All @@ -217,6 +217,7 @@ border-top: 0px;
<addaction name="separator"/>
<addaction name="actionDisplay_Esil"/>
<addaction name="actionDisplay_Pseudocode"/>
<addaction name="actionDisplay_Offsets"/>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
Expand Down Expand Up @@ -245,7 +246,7 @@ border-top: 0px;
<addaction name="actionFind_next"/>
<addaction name="actionFind_previous"/>
</widget>
<widget class="QMenu" name="menuView">
<widget class="QMenu" name="menuWindows">
<property name="title">
<string>Windows</string>
</property>
Expand All @@ -267,9 +268,9 @@ border-top: 0px;
</widget>
<addaction name="menuFile"/>
<addaction name="menuEdit"/>
<addaction name="menuWorkspace"/>
<addaction name="menuTools"/>
<addaction name="menuView"/>
<addaction name="menuTools"/>
<addaction name="menuWindows"/>
<addaction name="menuHelp"/>
</widget>
<widget class="QToolBar" name="sideToolBar">
Expand Down Expand Up @@ -921,26 +922,37 @@ QToolButton .svg-icon path {
</property>
</action>
<action name="actionDisplay_Esil">
<property name="text">
<string>Show ESIL rather than assembly</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Show ESIL rather than assembly</string>
</property>
</action>
<action name="actionDisplay_Pseudocode">
<property name="text">
<string>Show pseudocode rather than assembly</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Show pseudocode rather than assembly</string>
</property>
</action>
<action name="actionEntry_points">
<property name="text">
<string>Entry points</string>
</property>
</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>
<layoutdefault spacing="6" margin="11"/>
<resources>
Expand Down
12 changes: 11 additions & 1 deletion src/widgets/memorywidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ void MemoryWidget::replaceTextDisasm(QString txt)
bool MemoryWidget::loadMoreDisassembly()
{
/*
* Add more disasm as the user scrolls
z * Add more disasm as the user scrolls
* Not working properly when scrolling upwards
* r2 doesn't handle properly 'pd-' for archs with variable instruction size
*/
Expand Down Expand Up @@ -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);
}
}
2 changes: 2 additions & 0 deletions src/widgets/memorywidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ public slots:

void updateViews(RVA offset = RVA_INVALID);

void showOffsets(bool show);

protected:
void resizeEvent(QResizeEvent *event) override;
bool eventFilter(QObject *obj, QEvent *event) override;
Expand Down
20 changes: 10 additions & 10 deletions src/widgets/memorywidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ QToolTip {
<number>0</number>
</property>
<item>
<widget class="QWebEngineView" name="webSimpleGraph">
<widget class="QWebEngineView" name="webSimpleGraph" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
Expand All @@ -958,7 +958,7 @@ QToolTip {
font: 11pt &quot;Monaco&quot;;
}</string>
</property>
<property name="url">
<property name="url" stdset="0">
<url>
<string>about:blank</string>
</url>
Expand Down Expand Up @@ -1233,16 +1233,16 @@ p, li { white-space: pre-wrap; }
<number>0</number>
</property>
<item>
<widget class="QWebEngineView" name="graphWebView">
<widget class="QWebEngineView" name="graphWebView" native="true">
<property name="contextMenuPolicy">
<enum>Qt::DefaultContextMenu</enum>
</property>
<property name="url">
<property name="url" stdset="0">
<url>
<string>about:blank</string>
</url>
</property>
<property name="zoomFactor">
<property name="zoomFactor" stdset="0">
<double>1.000000000000000</double>
</property>
</widget>
Expand Down Expand Up @@ -1331,7 +1331,7 @@ border-top: 0px;
<x>0</x>
<y>0</y>
<width>256</width>
<height>887</height>
<height>868</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -1635,7 +1635,7 @@ QToolTip {
<number>0</number>
</property>
<item>
<widget class="QWebEngineView" name="fcnWebView">
<widget class="QWebEngineView" name="fcnWebView" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand All @@ -1654,7 +1654,7 @@ QToolTip {
<height>250</height>
</size>
</property>
<property name="url">
<property name="url" stdset="0">
<url>
<string>qrc:/html/fcn_graph.html</string>
</url>
Expand Down Expand Up @@ -1684,7 +1684,7 @@ QToolTip {
<number>0</number>
</property>
<item>
<widget class="QWebEngineView" name="radarGraphWebView">
<widget class="QWebEngineView" name="radarGraphWebView" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand All @@ -1703,7 +1703,7 @@ QToolTip {
<height>250</height>
</size>
</property>
<property name="url">
<property name="url" stdset="0">
<url>
<string>qrc:/html/fcn_radar.html</string>
</url>
Expand Down

0 comments on commit c07f486

Please sign in to comment.