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);
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);
@ -183,7 +183,6 @@ void MainWindow::initUI()
/*
* Dock Widgets
*/
dockWidgets.reserve(11);
// Add Memory DockWidget
@ -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();
}

View File

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

View File

@ -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">
@ -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">
@ -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>
@ -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">
@ -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>
@ -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">
@ -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>

View File

@ -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
*/
@ -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 showOffsets(bool show);
protected:
void resizeEvent(QResizeEvent *event) override;
bool eventFilter(QObject *obj, QEvent *event) override;

View File

@ -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>
@ -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>
@ -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>
@ -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">
@ -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>
@ -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>
@ -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>
@ -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>