From 330803db999ee67670b826f86007b462c0930697 Mon Sep 17 00:00:00 2001 From: Rohan-Sagar Date: Wed, 14 Feb 2024 12:41:06 -0500 Subject: [PATCH 1/9] Added hex flag --- src/dialogs/CommentsDialog.cpp | 3 +- src/dialogs/FlagDialog.cpp | 8 +++++ src/menus/DisassemblyContextMenu.cpp | 2 +- src/widgets/HexWidget.cpp | 49 +++++++++++++++++++++++++++- src/widgets/HexWidget.h | 5 +++ src/widgets/HexdumpWidget.h | 1 + 6 files changed, 65 insertions(+), 3 deletions(-) diff --git a/src/dialogs/CommentsDialog.cpp b/src/dialogs/CommentsDialog.cpp index 4d362d4fe9..5eb7344564 100644 --- a/src/dialogs/CommentsDialog.cpp +++ b/src/dialogs/CommentsDialog.cpp @@ -1,12 +1,13 @@ #include "CommentsDialog.h" #include "ui_CommentsDialog.h" - +#include #include #include "core/Cutter.h" CommentsDialog::CommentsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::CommentsDialog) { + std::cout << "Comments dialog parent object name" << " " << parent->objectName().toStdString() << std::endl; ui->setupUi(this); setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint)); diff --git a/src/dialogs/FlagDialog.cpp b/src/dialogs/FlagDialog.cpp index 4e7742e232..dc9be919a2 100644 --- a/src/dialogs/FlagDialog.cpp +++ b/src/dialogs/FlagDialog.cpp @@ -2,15 +2,20 @@ #include "ui_FlagDialog.h" #include +#include #include "core/Cutter.h" FlagDialog::FlagDialog(RVA offset, QWidget *parent) : QDialog(parent), ui(new Ui::FlagDialog), offset(offset), flagName(""), flagOffset(RVA_INVALID) { + std::cout << "offset" << " " << offset << std::endl; + std::cout << "parent" << " " << parent << std::endl; + std::cout << "parentObjectName" << " " << parent->objectName().toStdString() << std::endl; // Setup UI ui->setupUi(this); setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint)); RzFlagItem *flag = rz_flag_get_i(Core()->core()->flags, offset); + std::cout << "flag" << " " << flag << std::endl; if (flag) { flagName = QString(flag->name); flagOffset = flag->offset; @@ -23,6 +28,7 @@ FlagDialog::FlagDialog(RVA offset, QWidget *parent) ui->nameEdit->setText(flag->name); ui->labelAction->setText(tr("Edit flag at %1").arg(RzAddressString(offset))); } else { + std::cout << "offset in if condition" << " " << offset << std::endl; ui->labelAction->setText(tr("Add flag at %1").arg(RzAddressString(offset))); } @@ -37,6 +43,7 @@ void FlagDialog::buttonBoxAccepted() { RVA size = ui->sizeEdit->text().toULongLong(); QString name = ui->nameEdit->text(); + std::cout << "name" << " " << name.toStdString() << std::endl; if (name.isEmpty()) { if (flagOffset != RVA_INVALID) { @@ -52,6 +59,7 @@ void FlagDialog::buttonBoxAccepted() } else { // Name provided and flag does not exist -> create the flag Core()->addFlag(offset, name, size); + std::cout << "Adding flag" << std::endl; } } close(); diff --git a/src/menus/DisassemblyContextMenu.cpp b/src/menus/DisassemblyContextMenu.cpp index 9879a16edc..bcb124bd72 100644 --- a/src/menus/DisassemblyContextMenu.cpp +++ b/src/menus/DisassemblyContextMenu.cpp @@ -11,7 +11,7 @@ #include "dialogs/EditStringDialog.h" #include "dialogs/BreakpointsDialog.h" #include "MainWindow.h" - +#include #include #include #include diff --git a/src/widgets/HexWidget.cpp b/src/widgets/HexWidget.cpp index c89337c69b..444e000bec 100644 --- a/src/widgets/HexWidget.cpp +++ b/src/widgets/HexWidget.cpp @@ -3,6 +3,8 @@ #include "Configuration.h" #include "dialogs/WriteCommandsDialogs.h" #include "dialogs/CommentsDialog.h" +#include "dialogs/FlagDialog.h" +#include #include #include @@ -50,7 +52,6 @@ HexWidget::HexWidget(QWidget *parent) setFocusPolicy(Qt::FocusPolicy::StrongFocus); connect(horizontalScrollBar(), &QScrollBar::valueChanged, this, [this]() { viewport()->update(); }); - connect(Config(), &Configuration::colorsUpdated, this, &HexWidget::updateColors); connect(Config(), &Configuration::fontsUpdated, this, [this]() { setMonospaceFont(Config()->getFont()); }); @@ -137,6 +138,21 @@ HexWidget::HexWidget(QWidget *parent) &HexWidget::onActionDeleteCommentTriggered); addAction(actionDeleteComment); + // Flag Option - Rohan + // Add flag option + actionFlag = new QAction(tr("Add Flag"), this); + actionFlag->setShortcutContext(Qt::ShortcutContext::WidgetWithChildrenShortcut); + actionFlag->setShortcut(Qt::Key_N); + connect(actionFlag, &QAction::triggered, this, &HexWidget::onActionAddFlagTriggered); + addAction(actionFlag); + + // Delete flag option + actionDeleteFlag = new QAction(tr("Delete Flag"), this); + actionDeleteFlag->setShortcutContext(Qt::ShortcutContext::WidgetWithChildrenShortcut); + connect(actionDeleteFlag, &QAction::triggered, this, + &HexWidget::onActionDeleteFlagTriggered); + addAction(actionDeleteFlag); + actionSelectRange = new QAction(tr("Select range"), this); connect(actionSelectRange, &QAction::triggered, this, [this]() { rangeDialog.open(cursor.address); }); @@ -214,6 +230,11 @@ HexWidget::HexWidget(QWidget *parent) connect(&warningTimer, &QTimer::timeout, this, &HexWidget::hideWarningRect); } +QWidget *HexWidget::parentForDialog() +{ + return parentWidget(); +} + void HexWidget::setMonospaceFont(const QFont &font) { if (!(font.styleHint() & QFont::Monospace)) { @@ -1160,6 +1181,17 @@ void HexWidget::contextMenuEvent(QContextMenuEvent *event) actionComment->setText(tr("Edit Comment")); } + QString flag = Core()->flagAt(cursor.address); + std::cout << "Flag at " << std::hex << cursor.address << " is " << flag.toStdString() << std::endl; + + if (flag.isNull() || flag.isEmpty()) { + actionDeleteFlag->setVisible(false); + actionFlag->setText(tr("Add Flag")); + } else { + actionDeleteFlag->setVisible(true); + actionFlag->setText(tr("Edit Flag")); + } + if (!ioModesController.canWrite()) { actionKeyboardEdit->setChecked(false); } @@ -1233,6 +1265,21 @@ void HexWidget::onActionAddCommentTriggered() CommentsDialog::addOrEditComment(addr, this); } +void HexWidget::onActionAddFlagTriggered() +{ + uint64_t addr = cursor.address; + std::cout << "Add flag at " << std::hex << addr << std::endl; + FlagDialog dialog(addr, this); + dialog.exec(); +} + +// slot for deleting flag action +void HexWidget::onActionDeleteFlagTriggered() +{ + uint64_t addr = cursor.address; + Core()->delFlag(addr); +} + // slot for deleting comment action void HexWidget::onActionDeleteCommentTriggered() { diff --git a/src/widgets/HexWidget.h b/src/widgets/HexWidget.h index 103040c211..9155ad3cba 100644 --- a/src/widgets/HexWidget.h +++ b/src/widgets/HexWidget.h @@ -382,6 +382,8 @@ private slots: void copyAddress(); void onRangeDialogAccepted(); void onActionAddCommentTriggered(); + void onActionAddFlagTriggered(); + void onActionDeleteFlagTriggered(); void onActionDeleteCommentTriggered(); // Write command slots @@ -424,6 +426,7 @@ private slots: QString renderItem(int offset, QColor *color = nullptr); QChar renderAscii(int offset, QColor *color = nullptr); QString getFlagsAndComment(uint64_t address); + QWidget *parentForDialog(); /** * @brief Get the location on which operations such as Writing should apply. * @return Start of selection if multiple bytes are selected. Otherwise, the curren seek of the @@ -576,6 +579,8 @@ private slots: QAction *actionCopy; QAction *actionCopyAddress; QAction *actionComment; + QAction *actionFlag; + QAction *actionDeleteFlag; QAction *actionDeleteComment; QAction *actionSelectRange; QAction *actionKeyboardEdit; diff --git a/src/widgets/HexdumpWidget.h b/src/widgets/HexdumpWidget.h index aa80fdf00e..32b0e195da 100644 --- a/src/widgets/HexdumpWidget.h +++ b/src/widgets/HexdumpWidget.h @@ -34,6 +34,7 @@ class HexdumpWidget : public MemoryDockWidget Highlighter *highlighter; static QString getWidgetType(); + QWidget *parentForDialog(); public slots: void initParsing(); From 51761961febe011b7dd2141055aacaac1451e10b Mon Sep 17 00:00:00 2001 From: Rohan-Sagar Date: Wed, 14 Feb 2024 12:44:01 -0500 Subject: [PATCH 2/9] Added hex flag option #2932 --- src/dialogs/CommentsDialog.cpp | 2 -- src/dialogs/FlagDialog.cpp | 9 --------- src/menus/DisassemblyContextMenu.cpp | 1 - src/widgets/HexWidget.cpp | 5 ----- 4 files changed, 17 deletions(-) diff --git a/src/dialogs/CommentsDialog.cpp b/src/dialogs/CommentsDialog.cpp index 5eb7344564..c0d883b385 100644 --- a/src/dialogs/CommentsDialog.cpp +++ b/src/dialogs/CommentsDialog.cpp @@ -1,13 +1,11 @@ #include "CommentsDialog.h" #include "ui_CommentsDialog.h" -#include #include #include "core/Cutter.h" CommentsDialog::CommentsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::CommentsDialog) { - std::cout << "Comments dialog parent object name" << " " << parent->objectName().toStdString() << std::endl; ui->setupUi(this); setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint)); diff --git a/src/dialogs/FlagDialog.cpp b/src/dialogs/FlagDialog.cpp index dc9be919a2..bd5d9c48ed 100644 --- a/src/dialogs/FlagDialog.cpp +++ b/src/dialogs/FlagDialog.cpp @@ -1,21 +1,15 @@ #include "FlagDialog.h" #include "ui_FlagDialog.h" - #include -#include #include "core/Cutter.h" FlagDialog::FlagDialog(RVA offset, QWidget *parent) : QDialog(parent), ui(new Ui::FlagDialog), offset(offset), flagName(""), flagOffset(RVA_INVALID) { - std::cout << "offset" << " " << offset << std::endl; - std::cout << "parent" << " " << parent << std::endl; - std::cout << "parentObjectName" << " " << parent->objectName().toStdString() << std::endl; // Setup UI ui->setupUi(this); setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint)); RzFlagItem *flag = rz_flag_get_i(Core()->core()->flags, offset); - std::cout << "flag" << " " << flag << std::endl; if (flag) { flagName = QString(flag->name); flagOffset = flag->offset; @@ -28,7 +22,6 @@ FlagDialog::FlagDialog(RVA offset, QWidget *parent) ui->nameEdit->setText(flag->name); ui->labelAction->setText(tr("Edit flag at %1").arg(RzAddressString(offset))); } else { - std::cout << "offset in if condition" << " " << offset << std::endl; ui->labelAction->setText(tr("Add flag at %1").arg(RzAddressString(offset))); } @@ -43,7 +36,6 @@ void FlagDialog::buttonBoxAccepted() { RVA size = ui->sizeEdit->text().toULongLong(); QString name = ui->nameEdit->text(); - std::cout << "name" << " " << name.toStdString() << std::endl; if (name.isEmpty()) { if (flagOffset != RVA_INVALID) { @@ -59,7 +51,6 @@ void FlagDialog::buttonBoxAccepted() } else { // Name provided and flag does not exist -> create the flag Core()->addFlag(offset, name, size); - std::cout << "Adding flag" << std::endl; } } close(); diff --git a/src/menus/DisassemblyContextMenu.cpp b/src/menus/DisassemblyContextMenu.cpp index bcb124bd72..ff0a63e70d 100644 --- a/src/menus/DisassemblyContextMenu.cpp +++ b/src/menus/DisassemblyContextMenu.cpp @@ -11,7 +11,6 @@ #include "dialogs/EditStringDialog.h" #include "dialogs/BreakpointsDialog.h" #include "MainWindow.h" -#include #include #include #include diff --git a/src/widgets/HexWidget.cpp b/src/widgets/HexWidget.cpp index 444e000bec..1ac1061b64 100644 --- a/src/widgets/HexWidget.cpp +++ b/src/widgets/HexWidget.cpp @@ -4,8 +4,6 @@ #include "dialogs/WriteCommandsDialogs.h" #include "dialogs/CommentsDialog.h" #include "dialogs/FlagDialog.h" -#include - #include #include #include @@ -1182,14 +1180,12 @@ void HexWidget::contextMenuEvent(QContextMenuEvent *event) } QString flag = Core()->flagAt(cursor.address); - std::cout << "Flag at " << std::hex << cursor.address << " is " << flag.toStdString() << std::endl; if (flag.isNull() || flag.isEmpty()) { actionDeleteFlag->setVisible(false); actionFlag->setText(tr("Add Flag")); } else { actionDeleteFlag->setVisible(true); - actionFlag->setText(tr("Edit Flag")); } if (!ioModesController.canWrite()) { @@ -1268,7 +1264,6 @@ void HexWidget::onActionAddCommentTriggered() void HexWidget::onActionAddFlagTriggered() { uint64_t addr = cursor.address; - std::cout << "Add flag at " << std::hex << addr << std::endl; FlagDialog dialog(addr, this); dialog.exec(); } From 95e6928d4664a2ddfa3011aa024d4de86caa0264 Mon Sep 17 00:00:00 2001 From: Rohan-Sagar Date: Wed, 14 Feb 2024 19:31:15 -0500 Subject: [PATCH 3/9] Update hexdump-widget-context-menu.rst --- .../menus/hexdump-widget-context-menu.rst | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/source/user-docs/menus/hexdump-widget-context-menu.rst b/docs/source/user-docs/menus/hexdump-widget-context-menu.rst index 91cab63e04..2892e235e2 100644 --- a/docs/source/user-docs/menus/hexdump-widget-context-menu.rst +++ b/docs/source/user-docs/menus/hexdump-widget-context-menu.rst @@ -17,4 +17,18 @@ Available options are: - 8 bytes - 16 bytes - 32 bytes - - Power of 2 (Auto) \ No newline at end of file + - Power of 2 (Auto) + +Add Flag +---------------------------------------- +**Description:** Add a flag to the selected item or location by bookmarking and giving it a name. + +**Steps:** Right-click an address or item and choose ``Add Flag`` + +**Shortcut:** :kbd:`N` + +Delete Flag +---------------------------------------- +**Description:** Delete a flag from the selected item or location. + +**Steps:** Right-click an address or item and choose ``Delete Flag`` From 0ff545da63255070b508d9d6557cab50d622f63b Mon Sep 17 00:00:00 2001 From: Rohan-Sagar Date: Thu, 15 Feb 2024 19:06:27 -0500 Subject: [PATCH 4/9] Fixed edit flag option --- .vscode/settings.json | 78 ++++++++++++++++++++++++++++++++++++++- src/widgets/HexWidget.cpp | 6 ++- 2 files changed, 81 insertions(+), 3 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index c745c20b32..7aadee2f10 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,79 @@ { - "cmake.sourceDirectory": "${workspaceFolder}" + "cmake.sourceDirectory": "${workspaceFolder}", + "files.associations": { + "typeinfo": "cpp", + "__bit_reference": "cpp", + "__config": "cpp", + "__debug": "cpp", + "__errc": "cpp", + "__functional_base": "cpp", + "__hash_table": "cpp", + "__locale": "cpp", + "__mutex_base": "cpp", + "__node_handle": "cpp", + "__nullptr": "cpp", + "__split_buffer": "cpp", + "__string": "cpp", + "__threading_support": "cpp", + "__tree": "cpp", + "__tuple": "cpp", + "algorithm": "cpp", + "array": "cpp", + "atomic": "cpp", + "bit": "cpp", + "bitset": "cpp", + "cctype": "cpp", + "chrono": "cpp", + "cmath": "cpp", + "compare": "cpp", + "complex": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "exception": "cpp", + "functional": "cpp", + "future": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "ios": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "iterator": "cpp", + "limits": "cpp", + "list": "cpp", + "locale": "cpp", + "map": "cpp", + "memory": "cpp", + "mutex": "cpp", + "new": "cpp", + "numeric": "cpp", + "optional": "cpp", + "ostream": "cpp", + "queue": "cpp", + "random": "cpp", + "ratio": "cpp", + "set": "cpp", + "sstream": "cpp", + "stack": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "string": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "unordered_map": "cpp", + "unordered_set": "cpp", + "utility": "cpp", + "variant": "cpp", + "vector": "cpp" + } } \ No newline at end of file diff --git a/src/widgets/HexWidget.cpp b/src/widgets/HexWidget.cpp index 1ac1061b64..f1dce2c52f 100644 --- a/src/widgets/HexWidget.cpp +++ b/src/widgets/HexWidget.cpp @@ -136,7 +136,6 @@ HexWidget::HexWidget(QWidget *parent) &HexWidget::onActionDeleteCommentTriggered); addAction(actionDeleteComment); - // Flag Option - Rohan // Add flag option actionFlag = new QAction(tr("Add Flag"), this); actionFlag->setShortcutContext(Qt::ShortcutContext::WidgetWithChildrenShortcut); @@ -1180,12 +1179,14 @@ void HexWidget::contextMenuEvent(QContextMenuEvent *event) } QString flag = Core()->flagAt(cursor.address); + RzFlagItem *flagItem = rz_flag_get_i(Core()->core()->flags, cursor.address); - if (flag.isNull() || flag.isEmpty()) { + if (flagItem == 0x0 || flag.isNull() || flag.isEmpty()) { actionDeleteFlag->setVisible(false); actionFlag->setText(tr("Add Flag")); } else { actionDeleteFlag->setVisible(true); + actionFlag->setText(tr("Edit Flag")); } if (!ioModesController.canWrite()) { @@ -1261,6 +1262,7 @@ void HexWidget::onActionAddCommentTriggered() CommentsDialog::addOrEditComment(addr, this); } +// slog for add flag action void HexWidget::onActionAddFlagTriggered() { uint64_t addr = cursor.address; From 8135faa8da711f28be0cbd283b0d10d9bb06354b Mon Sep 17 00:00:00 2001 From: Rohan-Sagar Date: Mon, 19 Feb 2024 13:20:22 -0500 Subject: [PATCH 5/9] Fixed clang-format issue --- src/widgets/HexWidget.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/widgets/HexWidget.cpp b/src/widgets/HexWidget.cpp index f1dce2c52f..6adc24325f 100644 --- a/src/widgets/HexWidget.cpp +++ b/src/widgets/HexWidget.cpp @@ -146,8 +146,7 @@ HexWidget::HexWidget(QWidget *parent) // Delete flag option actionDeleteFlag = new QAction(tr("Delete Flag"), this); actionDeleteFlag->setShortcutContext(Qt::ShortcutContext::WidgetWithChildrenShortcut); - connect(actionDeleteFlag, &QAction::triggered, this, - &HexWidget::onActionDeleteFlagTriggered); + connect(actionDeleteFlag, &QAction::triggered, this, &HexWidget::onActionDeleteFlagTriggered); addAction(actionDeleteFlag); actionSelectRange = new QAction(tr("Select range"), this); @@ -1179,7 +1178,7 @@ void HexWidget::contextMenuEvent(QContextMenuEvent *event) } QString flag = Core()->flagAt(cursor.address); - RzFlagItem *flagItem = rz_flag_get_i(Core()->core()->flags, cursor.address); + RzFlagItem *flagItem = rz_flag_get_i(Core()->core()->flags, cursor.address); if (flagItem == 0x0 || flag.isNull() || flag.isEmpty()) { actionDeleteFlag->setVisible(false); From 8ddf4c01941d01dece13dfd57cdb5a18c9061ce0 Mon Sep 17 00:00:00 2001 From: Rohan-Sagar Date: Mon, 18 Mar 2024 22:09:42 -0400 Subject: [PATCH 6/9] Fixed issues in feedback --- .vscode/settings.json | 78 +--------------------------- src/dialogs/CommentsDialog.cpp | 1 + src/dialogs/FlagDialog.cpp | 1 + src/menus/DisassemblyContextMenu.cpp | 1 + 4 files changed, 4 insertions(+), 77 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 7aadee2f10..c745c20b32 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,79 +1,3 @@ { - "cmake.sourceDirectory": "${workspaceFolder}", - "files.associations": { - "typeinfo": "cpp", - "__bit_reference": "cpp", - "__config": "cpp", - "__debug": "cpp", - "__errc": "cpp", - "__functional_base": "cpp", - "__hash_table": "cpp", - "__locale": "cpp", - "__mutex_base": "cpp", - "__node_handle": "cpp", - "__nullptr": "cpp", - "__split_buffer": "cpp", - "__string": "cpp", - "__threading_support": "cpp", - "__tree": "cpp", - "__tuple": "cpp", - "algorithm": "cpp", - "array": "cpp", - "atomic": "cpp", - "bit": "cpp", - "bitset": "cpp", - "cctype": "cpp", - "chrono": "cpp", - "cmath": "cpp", - "compare": "cpp", - "complex": "cpp", - "cstdarg": "cpp", - "cstddef": "cpp", - "cstdint": "cpp", - "cstdio": "cpp", - "cstdlib": "cpp", - "cstring": "cpp", - "ctime": "cpp", - "cwchar": "cpp", - "cwctype": "cpp", - "deque": "cpp", - "exception": "cpp", - "functional": "cpp", - "future": "cpp", - "initializer_list": "cpp", - "iomanip": "cpp", - "ios": "cpp", - "iosfwd": "cpp", - "iostream": "cpp", - "istream": "cpp", - "iterator": "cpp", - "limits": "cpp", - "list": "cpp", - "locale": "cpp", - "map": "cpp", - "memory": "cpp", - "mutex": "cpp", - "new": "cpp", - "numeric": "cpp", - "optional": "cpp", - "ostream": "cpp", - "queue": "cpp", - "random": "cpp", - "ratio": "cpp", - "set": "cpp", - "sstream": "cpp", - "stack": "cpp", - "stdexcept": "cpp", - "streambuf": "cpp", - "string": "cpp", - "string_view": "cpp", - "system_error": "cpp", - "tuple": "cpp", - "type_traits": "cpp", - "unordered_map": "cpp", - "unordered_set": "cpp", - "utility": "cpp", - "variant": "cpp", - "vector": "cpp" - } + "cmake.sourceDirectory": "${workspaceFolder}" } \ No newline at end of file diff --git a/src/dialogs/CommentsDialog.cpp b/src/dialogs/CommentsDialog.cpp index c0d883b385..4d362d4fe9 100644 --- a/src/dialogs/CommentsDialog.cpp +++ b/src/dialogs/CommentsDialog.cpp @@ -1,5 +1,6 @@ #include "CommentsDialog.h" #include "ui_CommentsDialog.h" + #include #include "core/Cutter.h" diff --git a/src/dialogs/FlagDialog.cpp b/src/dialogs/FlagDialog.cpp index bd5d9c48ed..4e7742e232 100644 --- a/src/dialogs/FlagDialog.cpp +++ b/src/dialogs/FlagDialog.cpp @@ -1,5 +1,6 @@ #include "FlagDialog.h" #include "ui_FlagDialog.h" + #include #include "core/Cutter.h" diff --git a/src/menus/DisassemblyContextMenu.cpp b/src/menus/DisassemblyContextMenu.cpp index ff0a63e70d..9879a16edc 100644 --- a/src/menus/DisassemblyContextMenu.cpp +++ b/src/menus/DisassemblyContextMenu.cpp @@ -11,6 +11,7 @@ #include "dialogs/EditStringDialog.h" #include "dialogs/BreakpointsDialog.h" #include "MainWindow.h" + #include #include #include From db4f556f42b0907ada6a4b535335342aac12a28f Mon Sep 17 00:00:00 2001 From: Rohan-Sagar Date: Mon, 18 Mar 2024 22:17:13 -0400 Subject: [PATCH 7/9] Update HexWidget.cpp --- src/widgets/HexWidget.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/widgets/HexWidget.cpp b/src/widgets/HexWidget.cpp index 6adc24325f..8775479bce 100644 --- a/src/widgets/HexWidget.cpp +++ b/src/widgets/HexWidget.cpp @@ -226,11 +226,6 @@ HexWidget::HexWidget(QWidget *parent) connect(&warningTimer, &QTimer::timeout, this, &HexWidget::hideWarningRect); } -QWidget *HexWidget::parentForDialog() -{ - return parentWidget(); -} - void HexWidget::setMonospaceFont(const QFont &font) { if (!(font.styleHint() & QFont::Monospace)) { @@ -1177,10 +1172,10 @@ void HexWidget::contextMenuEvent(QContextMenuEvent *event) actionComment->setText(tr("Edit Comment")); } - QString flag = Core()->flagAt(cursor.address); - RzFlagItem *flagItem = rz_flag_get_i(Core()->core()->flags, cursor.address); + auto coreLock = Core()->core(); + RZFlagItem *flagItem = rz_flag_get_i(coreLock->flags, cursor.address); - if (flagItem == 0x0 || flag.isNull() || flag.isEmpty()) { + if (flagItem == 0x0) { actionDeleteFlag->setVisible(false); actionFlag->setText(tr("Add Flag")); } else { From dcaedd3b9a3cc4857a435fc555db15c09f369b48 Mon Sep 17 00:00:00 2001 From: Rohan-Sagar Date: Mon, 18 Mar 2024 23:21:48 -0400 Subject: [PATCH 8/9] Fixed issue for failed build --- src/widgets/HexWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/HexWidget.cpp b/src/widgets/HexWidget.cpp index 8775479bce..9babb70de3 100644 --- a/src/widgets/HexWidget.cpp +++ b/src/widgets/HexWidget.cpp @@ -1173,7 +1173,7 @@ void HexWidget::contextMenuEvent(QContextMenuEvent *event) } auto coreLock = Core()->core(); - RZFlagItem *flagItem = rz_flag_get_i(coreLock->flags, cursor.address); + RzFlagItem *flagItem = rz_flag_get_i(coreLock->flags, cursor.address); if (flagItem == 0x0) { actionDeleteFlag->setVisible(false); From abd42fa7e17012f4521c946afc752f17e3186401 Mon Sep 17 00:00:00 2001 From: bferro373 Date: Fri, 12 Apr 2024 21:46:10 -0400 Subject: [PATCH 9/9] Added README_Contribution to main dev folder THIS FILE SHOULD BE DELETED BEFORE UPLOADING ANY PULL REQUESTS --- README_Contribution.md | 53 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 README_Contribution.md diff --git a/README_Contribution.md b/README_Contribution.md new file mode 100644 index 0000000000..12a62e721c --- /dev/null +++ b/README_Contribution.md @@ -0,0 +1,53 @@ +# Cutter Contribution: Team 21 ECE49595OSS + +Cutter is a free and open-source reverse engineering platform powered by rizin. This document details contributions made by Team 21 for ECE49595OSS + +## Base Cutter Documentation + +This section provides the documentation for Cutter itself. + +### [Cutter README](https://github.com/rizinorg/cutter/blob/dev/README.md) + +### [User Guide](https://cutter.re/docs/user-docs.html) + +### [Contribution Guidelines](https://cutter.re/docs/contributing.html) + +### [Developers Docs](https://cutter.re/docs/contributing/code.html) + +## Contributions + +This section details the issues we solved to contribute to Cutter. + +### Issue 1 + +#### [Allow adding new flags from hexdump](https://github.com/rizinorg/cutter/issues/2932) + +For this issue, we were tasked with adding a feature in the hexdump view that allows flags to be added into the hexdump view. + +This is done by right clicking or pressing the keyboard shortcut N on the line you wish to add a flag to, entering a valid flag name, then confirming that action. + +The flags added into the hexdump view are synchronized with the disassembly view. + +##### Screenshots + +Right Click shortcut for adding a new flag +![Screenshot](https://private-user-images.githubusercontent.com/90643076/305260361-e2ea623b-57c9-4929-bcce-ec374c560625.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTI5NjUzMzUsIm5iZiI6MTcxMjk2NTAzNSwicGF0aCI6Ii85MDY0MzA3Ni8zMDUyNjAzNjEtZTJlYTYyM2ItNTdjOS00OTI5LWJjY2UtZWMzNzRjNTYwNjI1LmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA0MTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNDEyVDIzMzcxNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ0OTI0YjA5MjcwZWJjNDVhZDFhNTRhOWE3ZmUyZGMzOTAxYmIxMzQzNWU5Nzk1NTk3MGJhNDUyMTI2MTAxODgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.keHDwZfUCFWq5qScsKmmkNcjF3hLa5jXB-thXNZKp6M) + +Menu for adding a flag +![Screenshot](https://private-user-images.githubusercontent.com/90643076/305260362-ca3aeeb1-c7da-48aa-a6e9-46ca9933fa9f.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTI5NjUzMzUsIm5iZiI6MTcxMjk2NTAzNSwicGF0aCI6Ii85MDY0MzA3Ni8zMDUyNjAzNjItY2EzYWVlYjEtYzdkYS00OGFhLWE2ZTktNDZjYTk5MzNmYTlmLmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA0MTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNDEyVDIzMzcxNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI1ZDcxNGY3YTYwYzE1MGZjZThhNThiZmVmMjExZTFkNWRmNDk5MjcxMmU5MDhhOGQzYjAzZTNlM2FkMGE1N2YmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.TMLuyPEXNxE2TpUtcRR6zSjQCPMmu5lf1eCqE_Izrvk) + +Synchronization in the disassembly view +![Screenshot](https://private-user-images.githubusercontent.com/90643076/305260366-5d3afbda-89ce-44a4-932a-b189ebc573fd.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTI5NjUzMzUsIm5iZiI6MTcxMjk2NTAzNSwicGF0aCI6Ii85MDY0MzA3Ni8zMDUyNjAzNjYtNWQzYWZiZGEtODljZS00NGE0LTkzMmEtYjE4OWViYzU3M2ZkLmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA0MTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNDEyVDIzMzcxNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU2NmUzMDEyZTM4NzJiN2Y5NGZjNTZlNmU3YjM2MzEwYzcyZTliOGMyNTQ5ZTc3NThkM2EwNjczYjQ4MmI5NWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.IH045Omdh8cE63-v0zuEX03j2-X1cIJPN48wnYzU86o) + +Showing the new flag in the hexdump view +![Screenshot](https://private-user-images.githubusercontent.com/90643076/305260370-d7e29740-3c89-44ce-bc77-908f0efd5fc2.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTI5NjUzMzUsIm5iZiI6MTcxMjk2NTAzNSwicGF0aCI6Ii85MDY0MzA3Ni8zMDUyNjAzNzAtZDdlMjk3NDAtM2M4OS00NGNlLWJjNzctOTA4ZjBlZmQ1ZmMyLmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA0MTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNDEyVDIzMzcxNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTk3ZmFmMjkxZWYyNTI0ZTQyYTgxNzlmNmVmYmU5NDcxOTYxNTI3Y2U2OTg0MTI1NjUwZDdmYjZkMWQzMWNlMTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.wVJgHz2GwfsdCnsmnZkxmnVYgfhYJ5lvjIzqnrSaBsk) + +Showing the ability to edit the new flag +![Screenshot](https://private-user-images.githubusercontent.com/90643076/305260371-22fa6817-35e4-487b-b6fb-9dcaaffc5890.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTI5NjUxMDUsIm5iZiI6MTcxMjk2NDgwNSwicGF0aCI6Ii85MDY0MzA3Ni8zMDUyNjAzNzEtMjJmYTY4MTctMzVlNC00ODdiLWI2ZmItOWRjYWFmZmM1ODkwLmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA0MTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNDEyVDIzMzMyNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg3NTZhYWIzYzgyNTRlZDE1MWQ2YmM0YjZmNWMwYzBjZTA5NDVlYTFiYzZlM2I4NDNmNzk3NThiNmFhMGYyZjkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.jGLBUGoA2mLehKcnD-Z8UOYCDDw3BgQ0SP7xWr8mNBE) + +Showing the edit menu for an existing flag in the hexdump view +![Screenshot](https://private-user-images.githubusercontent.com/90643076/305260371-22fa6817-35e4-487b-b6fb-9dcaaffc5890.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTI5NjUzMzUsIm5iZiI6MTcxMjk2NTAzNSwicGF0aCI6Ii85MDY0MzA3Ni8zMDUyNjAzNzEtMjJmYTY4MTctMzVlNC00ODdiLWI2ZmItOWRjYWFmZmM1ODkwLmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA0MTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNDEyVDIzMzcxNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThhMTIxMTUwOTMyOThiOTZlMmZmN2MzMmU0NGM2Mzc2YTM2NDEzYTVkZmYwZDdjMmQ3ODk2OTBiNWZmZTc4YzYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.TENgRqIKJerKAuwBRVmM80cRu0YLM1Q-nNGfHYbXR6k) + +### Issue 2 + +#### [Multiline Operations / Multiline Selection](https://github.com/rizinorg/cutter/issues/2601) \ No newline at end of file