diff --git a/src/Cutter.cpp b/src/Cutter.cpp index 75b198ae..dd4aa47b 100644 --- a/src/Cutter.cpp +++ b/src/Cutter.cpp @@ -671,6 +671,11 @@ QString CutterCore::getOffsetInfo(QString addr) return cmd("ao @ " + addr); } +QJsonDocument CutterCore::getRegistersInfo() +{ + return cmdj("aeafj"); +} + RVA CutterCore::getOffsetJump(RVA addr) { bool ok; diff --git a/src/Cutter.h b/src/Cutter.h index ca03bbb2..e96209db 100644 --- a/src/Cutter.h +++ b/src/Cutter.h @@ -385,6 +385,7 @@ public: ulong get_baddr(); QList> get_exec_sections(); QString getOffsetInfo(QString addr); + QJsonDocument getRegistersInfo(); RVA getOffsetJump(RVA addr); QString getDecompiledCode(RVA addr); QString getDecompiledCode(QString addr); diff --git a/src/widgets/SidebarWidget.cpp b/src/widgets/SidebarWidget.cpp index a5a2ceee..3d6fbba5 100644 --- a/src/widgets/SidebarWidget.cpp +++ b/src/widgets/SidebarWidget.cpp @@ -14,7 +14,8 @@ #include #include #include - +#include +#include SidebarWidget::SidebarWidget(MainWindow *main, QAction *action) : CutterDockWidget(main, action), @@ -52,6 +53,7 @@ void SidebarWidget::refresh(RVA addr) updateRefs(addr); setFcnName(addr); fillOffsetInfo(RAddressString(addr)); + fillRegistersInfo(); } void SidebarWidget::on_xrefFromTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int /*column*/) @@ -110,6 +112,17 @@ void SidebarWidget::on_xrefToToolButton_clicked() } } +void SidebarWidget::on_regInfoToolButton_clicked() +{ + if (ui->regInfoToolButton->isChecked()) { + ui->regInfoTreeWidget->hide(); + ui->regInfoToolButton->setArrowType(Qt::RightArrow); + } else { + ui->regInfoTreeWidget->show(); + ui->regInfoToolButton->setArrowType(Qt::DownArrow); + } +} + void SidebarWidget::updateRefs(RVA addr) { // refs = calls q hace esa funcion @@ -211,3 +224,27 @@ void SidebarWidget::setScrollMode() qhelpers::setVerticalScrollMode(ui->xrefFromTreeWidget); qhelpers::setVerticalScrollMode(ui->xrefToTreeWidget); } + +void SidebarWidget::fillRegistersInfo() +{ + TempConfig tempConfig; + tempConfig.set("scr.html", false) + .set("scr.color", COLOR_MODE_DISABLED); + + ui->regInfoTreeWidget->clear(); + + QJsonObject jsonRoot = Core()->getRegistersInfo().object(); + foreach (QString key, jsonRoot.keys()) { + QTreeWidgetItem *tempItem = new QTreeWidgetItem(); + QString tempString; + tempItem->setText(0, key.toUpper()); + foreach (QJsonValue value, jsonRoot[key].toArray()) { + tempString.append(value.toString() + " "); + } + tempItem->setText(1, tempString); + ui->regInfoTreeWidget->addTopLevelItem(tempItem); + } + + // Adjust columns to content + qhelpers::adjustColumns(ui->regInfoTreeWidget, 0); +} diff --git a/src/widgets/SidebarWidget.h b/src/widgets/SidebarWidget.h index 70ced723..4835898b 100644 --- a/src/widgets/SidebarWidget.h +++ b/src/widgets/SidebarWidget.h @@ -39,6 +39,7 @@ private: void updateRefs(RVA addr); void fillRefs(QList refs, QList xrefs); void fillOffsetInfo(QString off); + void fillRegistersInfo(); void setScrollMode(); @@ -54,6 +55,7 @@ private slots: void on_opcodeDescToolButton_clicked(); void on_xrefFromToolButton_clicked(); void on_xrefToToolButton_clicked(); + void on_regInfoToolButton_clicked(); }; #endif // SIDEBARWIDGET_H diff --git a/src/widgets/SidebarWidget.ui b/src/widgets/SidebarWidget.ui index 6cd89974..f9ddf09c 100644 --- a/src/widgets/SidebarWidget.ui +++ b/src/widgets/SidebarWidget.ui @@ -317,6 +317,92 @@ + + + + 5 + + + 0 + + + + + + + + + 8 + 8 + + + + true + + + true + + + Qt::DownArrow + + + + + + + + 75 + true + + + + true + + + Function registers info: + + + + + + + + + + 0 + 0 + + + + + 0 + 100 + + + + QFrame::NoFrame + + + Qt::ScrollBarAlwaysOff + + + 10 + + + true + + + + Info + + + + + Value + + + +