From aa9920ed11dbfdb376eec075ee120f7748af9c69 Mon Sep 17 00:00:00 2001 From: Anton Kochkov Date: Thu, 10 Aug 2023 11:40:01 +0800 Subject: [PATCH 01/38] Update translations --- src/translations | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/translations b/src/translations index 53b42f08..d44e9fb6 160000 --- a/src/translations +++ b/src/translations @@ -1 +1 @@ -Subproject commit 53b42f0854479f36170356c13d5eec4be3182444 +Subproject commit d44e9fb62c60f899d965d4b85aab1c83939a2cc2 From 215ab373d40f1c6461dddc4394e71213a1d50e71 Mon Sep 17 00:00:00 2001 From: Giovanni <561184+wargio@users.noreply.github.com> Date: Fri, 11 Aug 2023 09:52:05 +0800 Subject: [PATCH 02/38] Translation fixes (#3227) --- src/widgets/ColorPicker.ui | 2 +- src/widgets/FunctionsWidget.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/ColorPicker.ui b/src/widgets/ColorPicker.ui index d4b83a2b..ce8797d2 100644 --- a/src/widgets/ColorPicker.ui +++ b/src/widgets/ColorPicker.ui @@ -11,7 +11,7 @@ - Form + Color Picker diff --git a/src/widgets/FunctionsWidget.cpp b/src/widgets/FunctionsWidget.cpp index 24d0d129..10d325fc 100644 --- a/src/widgets/FunctionsWidget.cpp +++ b/src/widgets/FunctionsWidget.cpp @@ -310,7 +310,7 @@ QVariant FunctionModel::headerData(int section, Qt::Orientation orientation, int case SizeColumn: return tr("Size"); case ImportColumn: - return tr("Imp."); + return tr("Import"); case OffsetColumn: return tr("Offset"); case NargsColumn: From 28e7ca567c8dec68242713d469d4857eb4add042 Mon Sep 17 00:00:00 2001 From: Giovanni <561184+wargio@users.noreply.github.com> Date: Fri, 18 Aug 2023 10:57:05 +0800 Subject: [PATCH 03/38] Use tags for jsdec instead of master. (#3231) --- dist/bundle_jsdec.ps1 | 2 +- scripts/jsdec.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/bundle_jsdec.ps1 b/dist/bundle_jsdec.ps1 index d6162346..a25d6ae6 100644 --- a/dist/bundle_jsdec.ps1 +++ b/dist/bundle_jsdec.ps1 @@ -2,7 +2,7 @@ $dist = $args[0] $python = Split-Path((Get-Command python.exe).Path) if (-not (Test-Path -Path 'jsdec' -PathType Container)) { - git clone https://github.com/rizinorg/jsdec.git --depth 1 --branch master + git clone https://github.com/rizinorg/jsdec.git --depth 1 --branch "v0.6.0" } cd jsdec & meson.exe --buildtype=release -Dc_args=-DDUK_USE_DATE_NOW_WINDOWS -Djsc_folder=".." --prefix="$dist" p build diff --git a/scripts/jsdec.sh b/scripts/jsdec.sh index caee0759..966c605a 100755 --- a/scripts/jsdec.sh +++ b/scripts/jsdec.sh @@ -7,7 +7,7 @@ SCRIPTPATH=$(realpath "$(dirname "${BASH_SOURCE[0]}")") cd "$SCRIPTPATH/.." if [[ ! -d jsdec ]]; then - git clone https://github.com/rizinorg/jsdec.git --depth 2 --branch master + git clone https://github.com/rizinorg/jsdec.git --depth 1 --branch "v0.6.0" fi cd jsdec From 4fec17bf05df89eb02bebff4532e62f4e46ac7d1 Mon Sep 17 00:00:00 2001 From: Anton Kochkov Date: Fri, 18 Aug 2023 11:42:58 +0800 Subject: [PATCH 04/38] Update translations (#3230) --- src/translations | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/translations b/src/translations index d44e9fb6..5c7c3bb6 160000 --- a/src/translations +++ b/src/translations @@ -1 +1 @@ -Subproject commit d44e9fb62c60f899d965d4b85aab1c83939a2cc2 +Subproject commit 5c7c3bb645e3d9dfc6e93ddfa1355be3bc76acb5 From 238dd62165e54d6d1e8dd992a6d404e14978ea01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?8dcc=C2=AD?= <29655971+8dcc@users.noreply.github.com> Date: Mon, 28 Aug 2023 05:30:13 +0200 Subject: [PATCH 05/38] Add optional arch packages to building.rst (#3234) Add packages for KSyntaxHighlighter and graphviz --- docs/source/building.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/source/building.rst b/docs/source/building.rst index 762cdd31..7520fd96 100644 --- a/docs/source/building.rst +++ b/docs/source/building.rst @@ -85,8 +85,14 @@ On Arch-based Linux distributions: :: + # When building with CUTTER_ENABLE_KSYNTAXHIGHLIGHTING (Default) + sudo pacman -Syu --needed syntax-highlighting + # When building with CUTTER_ENABLE_GRAPHVIZ (Default) + sudo pacman -Syu --needed graphviz + sudo pacman -Syu --needed base-devel cmake meson qt5-base qt5-svg qt5-tools + On dnf/yum based distributions: :: From 8f707e4a697afd5893d22129a205b4c0d8c95d89 Mon Sep 17 00:00:00 2001 From: Lion Date: Wed, 30 Aug 2023 08:25:42 +0200 Subject: [PATCH 06/38] append rizin results in plaintext to include tabs etc (fixes #3193) (#3236) the output of rizin was formatted as html, which caused \n to become
, making it impossible to just use appendPlainText() as-is. We have to tell rizin not to give us html, so that we can use \t in the output. Simply replacing \t with spaces, ` ` or similar doesn't work, as the appendHtml() replaces multiple spaces with one. --- src/widgets/ConsoleWidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/ConsoleWidget.cpp b/src/widgets/ConsoleWidget.cpp index de0e6892..63f0ab65 100644 --- a/src/widgets/ConsoleWidget.cpp +++ b/src/widgets/ConsoleWidget.cpp @@ -229,10 +229,10 @@ void ConsoleWidget::executeCommand(const QString &command) RVA oldOffset = Core()->getOffset(); commandTask = QSharedPointer( - new CommandTask(command, CommandTask::ColorMode::MODE_256, true)); + new CommandTask(command, CommandTask::ColorMode::MODE_256, false)); connect(commandTask.data(), &CommandTask::finished, this, [this, cmd_line, command, oldOffset](const QString &result) { - ui->outputTextEdit->appendHtml(result); + ui->outputTextEdit->appendPlainText(result); scrollOutputToEnd(); historyAdd(command); commandTask.clear(); From f3e35a160f49a70806514879ab859a64821ab0ad Mon Sep 17 00:00:00 2001 From: Anton Kochkov Date: Sat, 2 Sep 2023 13:16:18 +0800 Subject: [PATCH 07/38] Update translations (#3241) --- src/translations | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/translations b/src/translations index 5c7c3bb6..48c78b3b 160000 --- a/src/translations +++ b/src/translations @@ -1 +1 @@ -Subproject commit 5c7c3bb645e3d9dfc6e93ddfa1355be3bc76acb5 +Subproject commit 48c78b3b8139f211d2474d31bb005f33c0924966 From 2730244ec1d6a983cec2d3be6be53f0c144dcf3e Mon Sep 17 00:00:00 2001 From: frmdstryr Date: Mon, 4 Sep 2023 10:52:07 -0400 Subject: [PATCH 08/38] Seek to first call if multiple references (#3240) --- src/common/CutterSeekable.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/common/CutterSeekable.cpp b/src/common/CutterSeekable.cpp index 12ef7b7b..bba7c317 100644 --- a/src/common/CutterSeekable.cpp +++ b/src/common/CutterSeekable.cpp @@ -65,7 +65,6 @@ void CutterSeekable::seekToReference(RVA offset) return; } - RVA target; QList refs = Core()->getXRefs(offset, false, false); if (refs.length()) { @@ -73,10 +72,19 @@ void CutterSeekable::seekToReference(RVA offset) qWarning() << tr("More than one (%1) references here. Weird behaviour expected.") .arg(refs.length()); } - - target = refs.at(0).to; - if (target != RVA_INVALID) { - seek(target); + // Try first call + for (auto &ref : refs) { + if (ref.to != RVA_INVALID && ref.type == "CALL") { + seek(ref.to); + return; + } + } + // Fallback to first valid, if any + for (auto &ref : refs) { + if (ref.to != RVA_INVALID) { + seek(ref.to); + return; + } } } } From fc3e7c6378854c0b4c885ae9a10faf7f66e0d74a Mon Sep 17 00:00:00 2001 From: Anton Kochkov Date: Tue, 5 Sep 2023 17:25:38 +0800 Subject: [PATCH 09/38] Update translations (#3243) --- src/translations | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/translations b/src/translations index 48c78b3b..950447ab 160000 --- a/src/translations +++ b/src/translations @@ -1 +1 @@ -Subproject commit 48c78b3b8139f211d2474d31bb005f33c0924966 +Subproject commit 950447ab78198fea67fed3a305da299e4f1f82dd From 1e1c93d9d1c2b2bdf8ad5f633f78143d50cad252 Mon Sep 17 00:00:00 2001 From: frmdstryr Date: Tue, 5 Sep 2023 20:51:32 -0400 Subject: [PATCH 10/38] Add 'Copy instruction bytes' to disassembly context menu (#3242) --- src/menus/DisassemblyContextMenu.cpp | 16 ++++++++++++++++ src/menus/DisassemblyContextMenu.h | 3 +++ 2 files changed, 19 insertions(+) diff --git a/src/menus/DisassemblyContextMenu.cpp b/src/menus/DisassemblyContextMenu.cpp index b2cb760d..9879a16e 100644 --- a/src/menus/DisassemblyContextMenu.cpp +++ b/src/menus/DisassemblyContextMenu.cpp @@ -31,6 +31,7 @@ DisassemblyContextMenu::DisassemblyContextMenu(QWidget *parent, MainWindow *main actionEditBytes(this), actionCopy(this), actionCopyAddr(this), + actionCopyInstrBytes(this), actionAddComment(this), actionAnalyzeFunction(this), actionEditFunction(this), @@ -76,6 +77,10 @@ DisassemblyContextMenu::DisassemblyContextMenu(QWidget *parent, MainWindow *main getCopyAddressSequence()); addAction(&actionCopyAddr); + initAction(&actionCopyInstrBytes, tr("Copy instruction bytes"), + SLOT(on_actionCopyInstrBytes_triggered()), getCopyInstrBytesSequence()); + addAction(&actionCopyInstrBytes); + initAction(&showInSubmenu, tr("Show in"), nullptr); addAction(&showInSubmenu); @@ -643,6 +648,11 @@ QKeySequence DisassemblyContextMenu::getCopyAddressSequence() const return { Qt::CTRL | Qt::SHIFT | Qt::Key_C }; } +QKeySequence DisassemblyContextMenu::getCopyInstrBytesSequence() const +{ + return { Qt::CTRL | Qt::ALT | Qt::Key_C }; +} + QKeySequence DisassemblyContextMenu::getSetToCodeSequence() const { return { Qt::Key_C }; @@ -793,6 +803,12 @@ void DisassemblyContextMenu::on_actionCopyAddr_triggered() clipboard->setText(RzAddressString(offset)); } +void DisassemblyContextMenu::on_actionCopyInstrBytes_triggered() +{ + QClipboard *clipboard = QApplication::clipboard(); + clipboard->setText(Core()->getInstructionBytes(offset)); +} + void DisassemblyContextMenu::on_actionAddBreakpoint_triggered() { Core()->toggleBreakpoint(offset); diff --git a/src/menus/DisassemblyContextMenu.h b/src/menus/DisassemblyContextMenu.h index e6c0773d..0cf91556 100644 --- a/src/menus/DisassemblyContextMenu.h +++ b/src/menus/DisassemblyContextMenu.h @@ -42,6 +42,7 @@ private slots: void on_actionCopy_triggered(); void on_actionCopyAddr_triggered(); + void on_actionCopyInstrBytes_triggered(); void on_actionAddComment_triggered(); void on_actionAnalyzeFunction_triggered(); void on_actionRename_triggered(); @@ -79,6 +80,7 @@ private: QKeySequence getCopySequence() const; QKeySequence getCommentSequence() const; QKeySequence getCopyAddressSequence() const; + QKeySequence getCopyInstrBytesSequence() const; QKeySequence getGlobalVarSequence() const; QKeySequence getSetToCodeSequence() const; QKeySequence getSetAsStringSequence() const; @@ -111,6 +113,7 @@ private: QAction actionCopy; QAction *copySeparator; QAction actionCopyAddr; + QAction actionCopyInstrBytes; QAction actionAddComment; QAction actionAnalyzeFunction; From c8c625a8303af6300e199d1023abd0844a52cea9 Mon Sep 17 00:00:00 2001 From: Dhruv Maroo Date: Wed, 20 Sep 2023 06:41:52 +0530 Subject: [PATCH 11/38] Fix build failures when compiling Cutter with Rizin's dev * `rz_debug_stop` returns an `int`, so we cannot cast it to `RxConsBreak`, which is a typedef of a function signature returning `void` * `rz_debug_bp_add` siggnatue was recently modified, and thus Cutter couldn't build with the new signature * `rz_bin_object_get_imports` was also modified recently to return a `RzPVector`, thus it also needed to be updated in Cutter --- src/core/Cutter.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/Cutter.cpp b/src/core/Cutter.cpp index c1ce9d21..edd78682 100644 --- a/src/core/Cutter.cpp +++ b/src/core/Cutter.cpp @@ -2372,7 +2372,9 @@ void CutterCore::continueUntilSyscall() } else { if (!asyncTask( [](RzCore *core) { - rz_cons_break_push(reinterpret_cast(rz_debug_stop), core->dbg); + rz_cons_break_push( + [](void *x) { rz_debug_stop(reinterpret_cast(x)); }, + core->dbg); rz_reg_arena_swap(core->dbg->reg, true); rz_debug_continue_syscalls(core->dbg, NULL, 0); rz_cons_break_pop(); @@ -2681,8 +2683,8 @@ void CutterCore::addBreakpoint(const BreakpointDescription &config) moduleNameData = config.positionExpression.toUtf8(); module = moduleNameData.data(); } - breakpoint = rz_debug_bp_add(core->dbg, address, (config.hw && watchpoint_prot == 0), - watchpoint_prot, watchpoint_prot, module, config.moduleDelta); + breakpoint = rz_debug_bp_add(core->dbg, address, config.size, config.hw, (watchpoint_prot != 0), + watchpoint_prot, module, config.moduleDelta); if (!breakpoint) { QMessageBox::critical(nullptr, tr("Breakpoint error"), tr("Failed to create breakpoint")); return; @@ -3107,16 +3109,14 @@ QList CutterCore::getAllImports() if (!bf) { return {}; } - const RzList *imports = rz_bin_object_get_imports(bf->o); + const auto *imports = new CutterPVector(rz_bin_object_get_imports(bf->o)); if (!imports) { return {}; } QList qList; - RzBinImport *import; - RzListIter *iter; bool va = core->io->va || core->bin->is_debugger; - CutterRzListForeach (imports, iter, RzBinImport, import) { + for (auto import : *imports) { if (RZ_STR_ISEMPTY(import->name)) { continue; } From de15212bb438a6c8e7e96c2cac9adc0526e48335 Mon Sep 17 00:00:00 2001 From: Dhruv Maroo Date: Wed, 20 Sep 2023 06:51:57 +0530 Subject: [PATCH 12/38] Update Rizin submodule to current dev --- rizin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rizin b/rizin index 48b08805..71679b08 160000 --- a/rizin +++ b/rizin @@ -1 +1 @@ -Subproject commit 48b088056236254356fdde46f28d1cbe8bc28316 +Subproject commit 71679b0800c657ad03fa374e989b2cd87433bd29 From 3c682b04587fad362e5609bafcabd9288f86649d Mon Sep 17 00:00:00 2001 From: Anton Kochkov Date: Wed, 20 Sep 2023 12:02:40 +0800 Subject: [PATCH 13/38] Update translations --- src/translations | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/translations b/src/translations index 950447ab..0c92dc93 160000 --- a/src/translations +++ b/src/translations @@ -1 +1 @@ -Subproject commit 950447ab78198fea67fed3a305da299e4f1f82dd +Subproject commit 0c92dc939a0aa74e6b5c8770bf50aa5719e4de2b From 83391396b9361776e3ec06270aa39b64c0a9b17a Mon Sep 17 00:00:00 2001 From: Dhruv Maroo Date: Wed, 20 Sep 2023 07:36:38 +0530 Subject: [PATCH 14/38] Start using `RzPVector` and `CutterPVector` instead of `RzList` --- src/core/Cutter.cpp | 11 +++++------ src/widgets/Dashboard.cpp | 30 +++++++++++++++--------------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/core/Cutter.cpp b/src/core/Cutter.cpp index edd78682..b70b1585 100644 --- a/src/core/Cutter.cpp +++ b/src/core/Cutter.cpp @@ -3109,14 +3109,14 @@ QList CutterCore::getAllImports() if (!bf) { return {}; } - const auto *imports = new CutterPVector(rz_bin_object_get_imports(bf->o)); + const RzPVector *imports = rz_bin_object_get_imports(bf->o); if (!imports) { return {}; } QList qList; bool va = core->io->va || core->bin->is_debugger; - for (auto import : *imports) { + for (const auto &import : CutterPVector(imports)) { if (RZ_STR_ISEMPTY(import->name)) { continue; } @@ -3557,17 +3557,16 @@ QList CutterCore::getAllClassesFromBin() return {}; } - const RzList *cs = rz_bin_object_get_classes(bf->o); + const RzPVector *cs = rz_bin_object_get_classes(bf->o); if (!cs) { return {}; } QList qList; - RzListIter *iter, *iter2, *iter3; - RzBinClass *c; + RzListIter *iter2, *iter3; RzBinSymbol *sym; RzBinClassField *f; - CutterRzListForeach (cs, iter, RzBinClass, c) { + for (const auto &c : CutterPVector(cs)) { BinClassDescription classDescription; classDescription.name = c->name; classDescription.addr = c->addr; diff --git a/src/widgets/Dashboard.cpp b/src/widgets/Dashboard.cpp index 3636492b..aeb156c3 100644 --- a/src/widgets/Dashboard.cpp +++ b/src/widgets/Dashboard.cpp @@ -80,7 +80,7 @@ void Dashboard::updateContents() int static_value = rz_bin_is_static(core->bin); setPlainText(ui->staticEdit, tr(setBoolText(static_value))); - RzList *hashes = bf ? rz_bin_file_compute_hashes(core->bin, bf, UT64_MAX) : nullptr; + const RzPVector *hashes = bf ? rz_bin_file_compute_hashes(core->bin, bf, UT64_MAX) : nullptr; // Delete hashesWidget if it isn't null to avoid duplicate components if (hashesWidget) { @@ -94,23 +94,23 @@ void Dashboard::updateContents() ui->hashesVerticalLayout->addWidget(hashesWidget); // Add hashes as a pair of Hash Name : Hash Value. - RzListIter *iter; - RzBinFileHash *hash; - CutterRzListForeach (hashes, iter, RzBinFileHash, hash) { - // Create a bold QString with the hash name uppercased - QString label = QString("%1:").arg(QString(hash->type).toUpper()); + if (hashes != nullptr) { + for (const auto &hash : CutterPVector(hashes)) { + // Create a bold QString with the hash name uppercased + QString label = QString("%1:").arg(QString(hash->type).toUpper()); - // Define a Read-Only line edit to display the hash value - QLineEdit *hashLineEdit = new QLineEdit(); - hashLineEdit->setReadOnly(true); - hashLineEdit->setText(hash->hex); + // Define a Read-Only line edit to display the hash value + QLineEdit *hashLineEdit = new QLineEdit(); + hashLineEdit->setReadOnly(true); + hashLineEdit->setText(hash->hex); - // Set cursor position to begining to avoid long hashes (e.g sha256) - // to look truncated at the begining - hashLineEdit->setCursorPosition(0); + // Set cursor position to begining to avoid long hashes (e.g sha256) + // to look truncated at the begining + hashLineEdit->setCursorPosition(0); - // Add both controls to a form layout in a single row - hashesLayout->addRow(new QLabel(label), hashLineEdit); + // Add both controls to a form layout in a single row + hashesLayout->addRow(new QLabel(label), hashLineEdit); + } } st64 fcns = rz_list_length(core->analysis->fcns); From bb5fe076594e5b57c025a6dcc1fae8c412e107dd Mon Sep 17 00:00:00 2001 From: Anton Kochkov Date: Tue, 26 Sep 2023 10:20:26 +0800 Subject: [PATCH 15/38] Bump bundled Rizin version to 0.7 --- cmake/BundledRizin.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BundledRizin.cmake b/cmake/BundledRizin.cmake index 10816039..1c030690 100644 --- a/cmake/BundledRizin.cmake +++ b/cmake/BundledRizin.cmake @@ -57,7 +57,7 @@ endif() # TODO: This version number should be fetched automatically # instead of being hardcoded. -set (Rizin_VERSION 0.6) +set (Rizin_VERSION 0.7) set (RZ_LIBS rz_core rz_config rz_cons rz_io rz_util rz_flag rz_asm rz_debug rz_hash rz_bin rz_lang rz_il rz_analysis rz_parse rz_bp rz_egg rz_reg From 13953d213accb52b87f84ce3fc042a27a699f110 Mon Sep 17 00:00:00 2001 From: Anton Kochkov Date: Wed, 1 Nov 2023 00:28:43 +0800 Subject: [PATCH 16/38] Update translations --- src/translations | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/translations b/src/translations index 0c92dc93..2403de5d 160000 --- a/src/translations +++ b/src/translations @@ -1 +1 @@ -Subproject commit 0c92dc939a0aa74e6b5c8770bf50aa5719e4de2b +Subproject commit 2403de5d6aaa9979f8ad3af085c891e327194bcc From 900b1a3e14b69d8c74f5a584d9e9ae4f829909b6 Mon Sep 17 00:00:00 2001 From: Karliss Date: Fri, 3 Nov 2023 20:46:44 +0200 Subject: [PATCH 17/38] Fix decompiler widget crash when starting unsynced --- src/widgets/DecompilerWidget.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/widgets/DecompilerWidget.cpp b/src/widgets/DecompilerWidget.cpp index c54ad6f9..b00c0ccd 100644 --- a/src/widgets/DecompilerWidget.cpp +++ b/src/widgets/DecompilerWidget.cpp @@ -347,8 +347,10 @@ void DecompilerWidget::decompilationFinished(RzAnnotatedCode *codeDecompiled) } } - ui->textEdit->horizontalScrollBar()->setSliderPosition(scrollHistory[historyPos].first); - ui->textEdit->verticalScrollBar()->setSliderPosition(scrollHistory[historyPos].second); + if (!scrollHistory.empty()) { + ui->textEdit->horizontalScrollBar()->setSliderPosition(scrollHistory[historyPos].first); + ui->textEdit->verticalScrollBar()->setSliderPosition(scrollHistory[historyPos].second); + } } void DecompilerWidget::setAnnotationsAtCursor(size_t pos) From 91f40f2f7148d2e67e3d8cb94f862b039024de4d Mon Sep 17 00:00:00 2001 From: Anton Kochkov Date: Wed, 8 Nov 2023 07:32:12 +0800 Subject: [PATCH 18/38] Update Rizin to latest dev (#3262) * Update rizin to latest dev * Update used RzBin resources API --- rizin | 2 +- src/core/Cutter.cpp | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/rizin b/rizin index 71679b08..44400041 160000 --- a/rizin +++ b/rizin @@ -1 +1 @@ -Subproject commit 71679b0800c657ad03fa374e989b2cd87433bd29 +Subproject commit 444000416cc929d4ce67116a46eaeee1d8a5b4fd diff --git a/src/core/Cutter.cpp b/src/core/Cutter.cpp index b70b1585..bd9983c3 100644 --- a/src/core/Cutter.cpp +++ b/src/core/Cutter.cpp @@ -3805,19 +3805,22 @@ QList CutterCore::getAllResources() if (!bf) { return {}; } - const RzList *resources = rz_bin_object_get_resources(bf->o); + const RzPVector *resources = rz_bin_object_get_resources(bf->o); + if (!resources) { + return {}; + } + QList resourcesDescriptions; - RzBinResource *r; - RzListIter *it; - CutterRzListForeach (resources, it, RzBinResource, r) { + for (const auto &resource : CutterPVector(resources)) { ResourcesDescription description; - description.name = r->name; - description.vaddr = r->vaddr; - description.index = r->index; - description.type = r->type; - description.size = r->size; - description.lang = r->language; + description.name = resource->name; + description.vaddr = resource->vaddr; + description.index = resource->index; + description.type = resource->type; + description.size = resource->size; + description.lang = resource->language; + resourcesDescriptions << description; } From fe85af256092e3b839323fa14633e77c7f1e3161 Mon Sep 17 00:00:00 2001 From: Karliss Date: Thu, 9 Nov 2023 21:55:52 +0200 Subject: [PATCH 19/38] Remove unnessary mouse grab. * Causes warning spam with Qt wayland backend * Can sometimes cause crash on wayland * According to docs shouldn't be necesarry --- src/widgets/ColorPicker.cpp | 2 -- src/widgets/GraphView.cpp | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/widgets/ColorPicker.cpp b/src/widgets/ColorPicker.cpp index e35f1c5f..1733a74a 100644 --- a/src/widgets/ColorPicker.cpp +++ b/src/widgets/ColorPicker.cpp @@ -286,7 +286,6 @@ void ColorPicker::startPickingFromScreen() { if (!pickingFromScreen) { setMouseTracking(true); - grabMouse(Qt::CursorShape::CrossCursor); pickingFromScreen = true; bufferColor = currColor; } @@ -298,7 +297,6 @@ void ColorPicker::mouseReleaseEvent(QMouseEvent *event) setColor(getColorAtMouse()); pickingFromScreen = false; setMouseTracking(false); - releaseMouse(); } QWidget::mouseReleaseEvent(event); } diff --git a/src/widgets/GraphView.cpp b/src/widgets/GraphView.cpp index 9fcca211..a5e276ed 100644 --- a/src/widgets/GraphView.cpp +++ b/src/widgets/GraphView.cpp @@ -159,7 +159,6 @@ void GraphView::beginMouseDrag(QMouseEvent *event) scrollBase = event->pos(); scroll_mode = true; setCursor(Qt::ClosedHandCursor); - viewport()->grabMouse(); } void GraphView::setViewOffset(QPoint offset) @@ -741,7 +740,6 @@ void GraphView::mouseReleaseEvent(QMouseEvent *event) if (scroll_mode && (event->buttons() & (Qt::LeftButton | Qt::MiddleButton)) == 0) { scroll_mode = false; setCursor(Qt::ArrowCursor); - viewport()->releaseMouse(); } } From 7256fbb00e92ab12a24d14a92364db482ed295cb Mon Sep 17 00:00:00 2001 From: Karliss Date: Sat, 11 Nov 2023 16:34:47 +0200 Subject: [PATCH 20/38] Temporary fix for command output to console widget. * partially revert #3193 - printing the terminal escape sequences directly to text widget causes more issues than the tab problem it tried to fix * move the conversation to html from command task to the console widget * add hack converting tab to multiple spaces --- src/common/CommandTask.cpp | 6 +----- src/common/CommandTask.h | 4 +--- src/core/Cutter.cpp | 6 ++++-- src/widgets/ConsoleWidget.cpp | 6 +++--- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/common/CommandTask.cpp b/src/common/CommandTask.cpp index c027cab1..0366aaf2 100644 --- a/src/common/CommandTask.cpp +++ b/src/common/CommandTask.cpp @@ -2,8 +2,7 @@ #include "CommandTask.h" #include "TempConfig.h" -CommandTask::CommandTask(const QString &cmd, ColorMode colorMode, bool outFormatHtml) - : cmd(cmd), colorMode(colorMode), outFormatHtml(outFormatHtml) +CommandTask::CommandTask(const QString &cmd, ColorMode colorMode) : cmd(cmd), colorMode(colorMode) { } @@ -12,8 +11,5 @@ void CommandTask::runTask() TempConfig tempConfig; tempConfig.set("scr.color", colorMode); auto res = Core()->cmdTask(cmd); - if (outFormatHtml) { - res = CutterCore::ansiEscapeToHtml(res); - } emit finished(res); } diff --git a/src/common/CommandTask.h b/src/common/CommandTask.h index 24a74a5b..15136699 100644 --- a/src/common/CommandTask.h +++ b/src/common/CommandTask.h @@ -17,8 +17,7 @@ public: MODE_16M = COLOR_MODE_16M }; - CommandTask(const QString &cmd, ColorMode colorMode = ColorMode::DISABLED, - bool outFormatHtml = false); + CommandTask(const QString &cmd, ColorMode colorMode = ColorMode::DISABLED); QString getTitle() override { return tr("Running Command"); } @@ -31,7 +30,6 @@ protected: private: QString cmd; ColorMode colorMode; - bool outFormatHtml; }; #endif // COMMANDTASK_H diff --git a/src/core/Cutter.cpp b/src/core/Cutter.cpp index bd9983c3..f9f8570c 100644 --- a/src/core/Cutter.cpp +++ b/src/core/Cutter.cpp @@ -4451,11 +4451,13 @@ bool CutterCore::setColor(const QString &key, const QString &color) QString CutterCore::ansiEscapeToHtml(const QString &text) { int len; - char *html = rz_cons_html_filter(text.toUtf8().constData(), &len); + QString r = text; + r.replace("\t", " "); + char *html = rz_cons_html_filter(r.toUtf8().constData(), &len); if (!html) { return {}; } - QString r = QString::fromUtf8(html, len); + r = QString::fromUtf8(html, len); rz_mem_free(html); return r; } diff --git a/src/widgets/ConsoleWidget.cpp b/src/widgets/ConsoleWidget.cpp index 63f0ab65..cf1b6aaa 100644 --- a/src/widgets/ConsoleWidget.cpp +++ b/src/widgets/ConsoleWidget.cpp @@ -228,11 +228,11 @@ void ConsoleWidget::executeCommand(const QString &command) addOutput(cmd_line); RVA oldOffset = Core()->getOffset(); - commandTask = QSharedPointer( - new CommandTask(command, CommandTask::ColorMode::MODE_256, false)); + commandTask = + QSharedPointer(new CommandTask(command, CommandTask::ColorMode::MODE_16M)); connect(commandTask.data(), &CommandTask::finished, this, [this, cmd_line, command, oldOffset](const QString &result) { - ui->outputTextEdit->appendPlainText(result); + ui->outputTextEdit->appendHtml(CutterCore::ansiEscapeToHtml(result)); scrollOutputToEnd(); historyAdd(command); commandTask.clear(); From 653435cb14875abebe20f7a725b0cf03d12b2aa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Sun, 19 Nov 2023 12:15:42 +0100 Subject: [PATCH 21/38] Update rizin to latest dev (#3266) Some fields were changed from RzList to RzPVector in Rizin. --- rizin | 2 +- src/core/Cutter.cpp | 8 ++------ src/widgets/Dashboard.cpp | 4 ++-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/rizin b/rizin index 44400041..b9851b7c 160000 --- a/rizin +++ b/rizin @@ -1 +1 @@ -Subproject commit 444000416cc929d4ce67116a46eaeee1d8a5b4fd +Subproject commit b9851b7c24ab5d3cc2d0192d4b8f8859cad2999c diff --git a/src/core/Cutter.cpp b/src/core/Cutter.cpp index f9f8570c..4a1ae79c 100644 --- a/src/core/Cutter.cpp +++ b/src/core/Cutter.cpp @@ -3226,15 +3226,12 @@ QList CutterCore::getAllHeaders() if (!bf) { return {}; } - const RzList *fields = rz_bin_object_get_fields(bf->o); + const RzPVector *fields = rz_bin_object_get_fields(bf->o); if (!fields) { return {}; } - RzListIter *iter; - RzBinField *field; QList ret; - - CutterRzListForeach (fields, iter, RzBinField, field) { + for (auto field : CutterPVector(fields)) { HeaderDescription header; header.vaddr = field->vaddr; header.paddr = field->paddr; @@ -3242,7 +3239,6 @@ QList CutterCore::getAllHeaders() header.name = field->name; ret << header; } - return ret; } diff --git a/src/widgets/Dashboard.cpp b/src/widgets/Dashboard.cpp index aeb156c3..192aab30 100644 --- a/src/widgets/Dashboard.cpp +++ b/src/widgets/Dashboard.cpp @@ -134,11 +134,11 @@ void Dashboard::updateContents() setPlainText(ui->percentageLineEdit, QString::number(precentage) + "%"); ui->libraryList->setPlainText(""); - const RzList *libs = bf ? rz_bin_object_get_libs(bf->o) : nullptr; + const RzPVector *libs = bf ? rz_bin_object_get_libs(bf->o) : nullptr; if (libs) { QString libText; bool first = true; - for (const auto &lib : CutterRzList(libs)) { + for (const auto &lib : CutterPVector(libs)) { if (!first) { libText.append("\n"); } From a6af2911dc7e2447863ad1ef0906ea924b566410 Mon Sep 17 00:00:00 2001 From: karliss Date: Wed, 29 Nov 2023 10:34:23 +0200 Subject: [PATCH 22/38] Simplify python binding include handling (#3268) * Simplify python binding include handling * remove duplicate code introduced in #2952 * specify include path using multiple include-path lines instead instead of single line with with directories separated by ; or : * Fix macoS qt6 python bindings build --- src/CMakeLists.txt | 50 ++++++++++++------------------------ src/bindings/bindings.txt.in | 2 +- 2 files changed, 17 insertions(+), 35 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1a753548..ad69522e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -429,33 +429,7 @@ if(CUTTER_ENABLE_PYTHON_BINDINGS) include_directories("${BINDINGS_BUILD_DIR}/CutterBindings") - set(SHIBOKEN_INCLUDE_DIRS "") - if(APPLE AND _qt6Core_install_prefix) - list(APPEND BINDINGS_INCLUDE_DIRS "${_qt6Core_install_prefix}/include") - list(APPEND BINDINGS_INCLUDE_DIRS "${_qt6Core_install_prefix}/include/QtCore") - list(APPEND BINDINGS_INCLUDE_DIRS "${_qt6Core_install_prefix}/include/QtGui") - list(APPEND BINDINGS_INCLUDE_DIRS "${_qt6Core_install_prefix}/include/QtWidgets") - endif() - - if (CUTTER_QT6) - list(APPEND SHIBOKEN_INCLUDE_DIRS ${Qt6Core_INCLUDE_DIRS} ${Qt6Widgets_INCLUDE_DIRS} ${Qt6Gui_INCLUDE_DIRS}) - else() - list(APPEND SHIBOKEN_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS}) - endif() - - foreach(_dir ${CUTTER_INCLUDE_DIRECTORIES}) - list(APPEND SHIBOKEN_INCLUDE_DIRS - $ - $ - ) - endforeach() - list(APPEND SHIBOKEN_INCLUDE_DIRS ${Rizin_INCLUDE_DIRS}) - if (NOT WIN32) - string(REPLACE ";" ":" SHIBOKEN_INCLUDE_DIRS "${SHIBOKEN_INCLUDE_DIRS}") - endif() - set(SHIBOKEN_OPTIONS) - list(APPEND SHIBOKEN_OPTIONS --include-paths="${SHIBOKEN_INCLUDE_DIRS}") if (WIN32) list(APPEND SHIBOKEN_OPTIONS --avoid-protected-hack) endif() @@ -558,11 +532,16 @@ if(CUTTER_ENABLE_PYTHON) endif() endforeach() - if(APPLE AND _qt5Core_install_prefix) - list(APPEND BINDINGS_INCLUDE_DIRS "${_qt5Core_install_prefix}/include") - list(APPEND BINDINGS_INCLUDE_DIRS "${_qt5Core_install_prefix}/include/QtCore") - list(APPEND BINDINGS_INCLUDE_DIRS "${_qt5Core_install_prefix}/include/QtGui") - list(APPEND BINDINGS_INCLUDE_DIRS "${_qt5Core_install_prefix}/include/QtWidgets") + set(BINDINGS_INCLUDE_DIR_LINES "") + if(APPLE) + if (_qt5Core_install_prefix) + list(APPEND BINDINGS_INCLUDE_DIRS "${_qt5Core_install_prefix}/include") + list(APPEND BINDINGS_INCLUDE_DIRS "${_qt5Core_install_prefix}/include/QtCore") + list(APPEND BINDINGS_INCLUDE_DIRS "${_qt5Core_install_prefix}/include/QtGui") + list(APPEND BINDINGS_INCLUDE_DIRS "${_qt5Core_install_prefix}/include/QtWidgets") + elseif(CUTTER_QT6) + string(APPEND BINDINGS_INCLUDE_DIR_LINES "framework-include-path=${QT6_INSTALL_PREFIX}/${QT6_INSTALL_LIBS}\n") + endif() endif() if (CUTTER_QT6) list(APPEND BINDINGS_INCLUDE_DIRS ${Qt6Core_INCLUDE_DIRS} ${Qt6Widgets_INCLUDE_DIRS} ${Qt6Gui_INCLUDE_DIRS}) @@ -571,9 +550,12 @@ if(CUTTER_ENABLE_PYTHON) endif() list(APPEND BINDINGS_INCLUDE_DIRS ${Rizin_INCLUDE_DIRS}) list(APPEND BINDINGS_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}") - if (NOT WIN32) - string(REPLACE ";" ":" BINDINGS_INCLUDE_DIRS "${BINDINGS_INCLUDE_DIRS}") - endif() + + foreach(_dir ${BINDINGS_INCLUDE_DIRS}) + if (NOT "${_dir}" STREQUAL "") + string(APPEND BINDINGS_INCLUDE_DIR_LINES "include-path = ${_dir}\n") + endif() + endforeach() configure_file("${BINDINGS_SRC_DIR}/bindings.txt.in" "${BINDINGS_BUILD_DIR}/bindings.txt") add_definitions(-DWIN32_LEAN_AND_MEAN) diff --git a/src/bindings/bindings.txt.in b/src/bindings/bindings.txt.in index 5eb103ee..57ee1c4a 100644 --- a/src/bindings/bindings.txt.in +++ b/src/bindings/bindings.txt.in @@ -7,7 +7,7 @@ typesystem-file = ${BINDINGS_BUILD_DIR}/bindings.xml output-directory = ${BINDINGS_BUILD_DIR} -include-path = ${BINDINGS_INCLUDE_DIRS} +${BINDINGS_INCLUDE_DIR_LINES} typesystem-paths = ${PYSIDE_TYPESYSTEMS} From 9fd65308fd72a4b397f857a6a00c7769f67aa3cd Mon Sep 17 00:00:00 2001 From: Anton Kochkov Date: Tue, 5 Dec 2023 07:28:35 +0800 Subject: [PATCH 23/38] Add Korean and Vietnamese translations (#3271) --- cmake/Translations.cmake | 3 ++- src/translations | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/Translations.cmake b/cmake/Translations.cmake index c8e5dfce..47c0babe 100644 --- a/cmake/Translations.cmake +++ b/cmake/Translations.cmake @@ -8,6 +8,7 @@ set(TS_FILES translations/he/cutter_he.ts translations/hi/cutter_hi.ts translations/it/cutter_it.ts + translations/ko/cutter_ko.ts translations/ja/cutter_ja.ts translations/nl/cutter_nl.ts translations/pt-PT/cutter_pt.ts @@ -16,8 +17,8 @@ set(TS_FILES translations/tr/cutter_tr.ts translations/uk/cutter_uk.ts translations/zh-CN/cutter_zh.ts + translations/vi/cutter_vi.ts ) -# translations/ko/cutter_ko.ts problems with fonts # translations/pt-BR/cutter_pt.ts #2321 handling multiple versions of a language set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/translations) diff --git a/src/translations b/src/translations index 2403de5d..4fcbd3b5 160000 --- a/src/translations +++ b/src/translations @@ -1 +1 @@ -Subproject commit 2403de5d6aaa9979f8ad3af085c891e327194bcc +Subproject commit 4fcbd3b50533e6707c3c974a31020d3755162804 From a7246f9532fbf549be4dd668e1dac37ed45fff18 Mon Sep 17 00:00:00 2001 From: Anton Kochkov Date: Tue, 19 Dec 2023 00:22:58 +0800 Subject: [PATCH 24/38] Add Bengali and Urdu translations (#3274) --- cmake/Translations.cmake | 2 ++ src/translations | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/Translations.cmake b/cmake/Translations.cmake index 47c0babe..a57a8797 100644 --- a/cmake/Translations.cmake +++ b/cmake/Translations.cmake @@ -1,5 +1,6 @@ set(TS_FILES translations/ar/cutter_ar.ts + translations/bn/cutter_bn.ts translations/ca/cutter_ca.ts translations/de/cutter_de.ts translations/es-ES/cutter_es.ts @@ -16,6 +17,7 @@ set(TS_FILES translations/ru/cutter_ru.ts translations/tr/cutter_tr.ts translations/uk/cutter_uk.ts + translations/ur-PK/cutter_ur.ts translations/zh-CN/cutter_zh.ts translations/vi/cutter_vi.ts ) diff --git a/src/translations b/src/translations index 4fcbd3b5..10528baf 160000 --- a/src/translations +++ b/src/translations @@ -1 +1 @@ -Subproject commit 4fcbd3b50533e6707c3c974a31020d3755162804 +Subproject commit 10528baf7920bfa39c5aeb06a433e4d60814e53f From 8c03b14290ff8779e7c48b035a33cf7589a69e35 Mon Sep 17 00:00:00 2001 From: Anton Kochkov Date: Mon, 25 Dec 2023 21:22:06 +0800 Subject: [PATCH 25/38] Update Rizin to the latest dev (#3278) --- rizin | 2 +- src/core/Cutter.cpp | 2 +- src/core/RizinCpp.h | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rizin b/rizin index b9851b7c..286d9bd8 160000 --- a/rizin +++ b/rizin @@ -1 +1 @@ -Subproject commit b9851b7c24ab5d3cc2d0192d4b8f8859cad2999c +Subproject commit 286d9bd874bfbe1e782cba901e59984d708d10af diff --git a/src/core/Cutter.cpp b/src/core/Cutter.cpp index 4a1ae79c..43ba9bab 100644 --- a/src/core/Cutter.cpp +++ b/src/core/Cutter.cpp @@ -1666,7 +1666,7 @@ QVector CutterCore::getHeapChunks(RVA arena_addr) rz_list_free(arenas); return chunks_vector; } - m_arena = ((RzArenaListItem *)arenas->head->data)->addr; + m_arena = ((RzArenaListItem *)arenas->head->elem)->addr; rz_list_free(arenas); } else { m_arena = arena_addr; diff --git a/src/core/RizinCpp.h b/src/core/RizinCpp.h index 85381717..6399e145 100644 --- a/src/core/RizinCpp.h +++ b/src/core/RizinCpp.h @@ -55,7 +55,7 @@ static inline auto fromOwned(RZ_OWN RzList *data) -> UniquePtrCPhead; it && ((x = static_cast(it->data))); it = it->n) + for (it = list->head; it && ((x = static_cast(it->elem))); it = it->next) #define CutterRzVectorForeach(vec, it, type) \ if ((vec) && (vec)->a) \ @@ -133,7 +133,7 @@ public: if (!iter) { return *this; } - iter = iter->n; + iter = iter->next; return *this; } iterator operator++(int) @@ -149,7 +149,7 @@ public: if (!iter) { return nullptr; } - return reinterpret_cast(iter->data); + return reinterpret_cast(iter->elem); } }; From c4dd2eda7d7a219415bb5e090b845c8bfdeb69e5 Mon Sep 17 00:00:00 2001 From: Giovanni <561184+wargio@users.noreply.github.com> Date: Fri, 29 Dec 2023 15:17:36 +0800 Subject: [PATCH 26/38] Update rizin, translation to latest dev and fix deadlock (#3279) --- rizin | 2 +- src/core/Cutter.cpp | 10 +++++----- src/translations | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/rizin b/rizin index 286d9bd8..ccbfe57b 160000 --- a/rizin +++ b/rizin @@ -1 +1 @@ -Subproject commit 286d9bd874bfbe1e782cba901e59984d708d10af +Subproject commit ccbfe57b683f247f9b73835a1c46f50627ba4edd diff --git a/src/core/Cutter.cpp b/src/core/Cutter.cpp index 43ba9bab..be3f8f7a 100644 --- a/src/core/Cutter.cpp +++ b/src/core/Cutter.cpp @@ -722,7 +722,7 @@ PRzAnalysisBytes CutterCore::getRzAnalysisBytesSingle(RVA addr) rz_io_read_at(core->io, addr, buf, sizeof(buf)); auto seek = seekTemp(addr); - auto vec = fromOwned(rz_core_analysis_bytes(core, buf, sizeof(buf), 1)); + auto vec = fromOwned(rz_core_analysis_bytes(core, addr, buf, sizeof(buf), 1)); auto ab = vec && rz_pvector_len(vec.get()) > 0 ? reinterpret_cast(rz_pvector_pop_front(vec.get())) @@ -1027,8 +1027,8 @@ RVA CutterCore::nextOpAddr(RVA startAddr, int count) { CORE_LOCK(); auto seek = seekTemp(startAddr); - auto vec = - fromOwned(rz_core_analysis_bytes(core, core->block, (int)core->blocksize, count + 1)); + auto vec = fromOwned(rz_core_analysis_bytes(core, core->offset, core->block, + (int)core->blocksize, count + 1)); RVA addr = startAddr + 1; if (!vec) { @@ -1666,7 +1666,7 @@ QVector CutterCore::getHeapChunks(RVA arena_addr) rz_list_free(arenas); return chunks_vector; } - m_arena = ((RzArenaListItem *)arenas->head->elem)->addr; + m_arena = ((RzArenaListItem *)rz_list_get_head_data(arenas))->addr; rz_list_free(arenas); } else { m_arena = arena_addr; @@ -2793,7 +2793,7 @@ int CutterCore::breakpointIndexAt(RVA addr) BreakpointDescription CutterCore::getBreakpointAt(RVA addr) { CORE_LOCK(); - int index = breakpointIndexAt(addr); + int index = rz_bp_get_index_at(core->dbg->bp, addr); auto bp = rz_bp_get_index(core->dbg->bp, index); if (bp) { return breakpointDescriptionFromRizin(index, bp); diff --git a/src/translations b/src/translations index 10528baf..30267d0a 160000 --- a/src/translations +++ b/src/translations @@ -1 +1 @@ -Subproject commit 10528baf7920bfa39c5aeb06a433e4d60814e53f +Subproject commit 30267d0acd528cbdbe2911e562085f7385e5ac47 From 4f004a2442cb5f726a3db2f961f0a2834eabd643 Mon Sep 17 00:00:00 2001 From: wargio Date: Sun, 7 Jan 2024 19:41:36 +0800 Subject: [PATCH 27/38] Update Rizin Dev --- rizin | 2 +- src/core/Cutter.cpp | 30 ++++++++++++++++++------------ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/rizin b/rizin index ccbfe57b..f5ca4b96 160000 --- a/rizin +++ b/rizin @@ -1 +1 @@ -Subproject commit ccbfe57b683f247f9b73835a1c46f50627ba4edd +Subproject commit f5ca4b96310efb7e38100076580d854b5aaf3248 diff --git a/src/core/Cutter.cpp b/src/core/Cutter.cpp index be3f8f7a..c87404f0 100644 --- a/src/core/Cutter.cpp +++ b/src/core/Cutter.cpp @@ -3153,7 +3153,8 @@ QList CutterCore::getAllExports() if (!bf) { return {}; } - const RzList *symbols = rz_bin_object_get_symbols(bf->o); + + const RzPVector *symbols = rz_bin_object_get_symbols(bf->o); if (!symbols) { return {}; } @@ -3162,7 +3163,7 @@ QList CutterCore::getAllExports() bool demangle = rz_config_get_b(core->config, "bin.demangle"); QList ret; - for (const auto &symbol : CutterRzList(symbols)) { + for (const auto &symbol : CutterPVector(symbols)) { if (!(symbol->name && rz_core_sym_is_export(symbol))) { continue; } @@ -3187,13 +3188,15 @@ QList CutterCore::getAllExports() QList CutterCore::getAllSymbols() { CORE_LOCK(); - RzListIter *it; - QList ret; - RzBinSymbol *bs; - if (core && core->bin && core->bin->cur && core->bin->cur->o) { - CutterRzListForeach (core->bin->cur->o->symbols, it, RzBinSymbol, bs) { + if (!(core && core->bin && core->bin->cur && core->bin->cur->o)) { + return {}; + } + + const RzPVector *symbols = rz_bin_object_get_symbols(core->bin->cur->o); + if (symbols) { + for (const auto &bs : CutterPVector(symbols)) { QString type = QString(bs->bind) + " " + QString(bs->type); SymbolDescription symbol; symbol.vaddr = bs->vaddr; @@ -3202,11 +3205,13 @@ QList CutterCore::getAllSymbols() symbol.type = QString(bs->type); ret << symbol; } + } + const RzList *entries = rz_bin_object_get_entries(core->bin->cur->o); + if (entries) { /* list entrypoints as symbols too */ int n = 0; - RzBinAddr *entry; - CutterRzListForeach (core->bin->cur->o->entries, it, RzBinAddr, entry) { + for (const auto &entry : CutterRzList(entries)) { SymbolDescription symbol; symbol.vaddr = entry->vaddr; symbol.name = QString("entry") + QString::number(n++); @@ -3341,8 +3346,9 @@ QList CutterCore::getAllStrings() if (!obj) { return {}; } - RzList *l = rz_core_bin_whole_strings(core, bf); - if (!l) { + + RzPVector *strings = rz_core_bin_whole_strings(core, bf); + if (!strings) { return {}; } @@ -3353,7 +3359,7 @@ QList CutterCore::getAllStrings() opt.esc_double_quotes = true; QList ret; - for (const auto &str : CutterRzList(l)) { + for (const auto &str : CutterPVector(strings)) { auto section = obj ? rz_bin_get_section_at(obj, str->paddr, 0) : NULL; StringDescription string; From 33882a2e159b45f6a38d265a7d8c91ee5b6a3e49 Mon Sep 17 00:00:00 2001 From: wargio Date: Sun, 7 Jan 2024 20:04:06 +0800 Subject: [PATCH 28/38] small refactoring --- src/core/Cutter.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/Cutter.cpp b/src/core/Cutter.cpp index c87404f0..cab4f2e5 100644 --- a/src/core/Cutter.cpp +++ b/src/core/Cutter.cpp @@ -3188,13 +3188,13 @@ QList CutterCore::getAllExports() QList CutterCore::getAllSymbols() { CORE_LOCK(); - QList ret; - - if (!(core && core->bin && core->bin->cur && core->bin->cur->o)) { + RzBinFile *bf = rz_bin_cur(core->bin); + if (!bf) { return {}; } - const RzPVector *symbols = rz_bin_object_get_symbols(core->bin->cur->o); + QList ret; + const RzPVector *symbols = rz_bin_object_get_symbols(bf->o); if (symbols) { for (const auto &bs : CutterPVector(symbols)) { QString type = QString(bs->bind) + " " + QString(bs->type); @@ -3207,7 +3207,7 @@ QList CutterCore::getAllSymbols() } } - const RzList *entries = rz_bin_object_get_entries(core->bin->cur->o); + const RzList *entries = rz_bin_object_get_entries(bf->o); if (entries) { /* list entrypoints as symbols too */ int n = 0; From aabf4423482c2b9f7893eea217c0bbba3c845fa7 Mon Sep 17 00:00:00 2001 From: Khairul Azhar Kasmiran Date: Sat, 13 Jan 2024 18:39:13 +0800 Subject: [PATCH 29/38] Use `RzPVector` for `rz_bin_object_get_sections`/`segments` (#3281) * Use `RzPVector` for `rz_bin_object_get_sections`/`segments` * Bump rizin submodule to latest --- rizin | 2 +- src/core/Cutter.cpp | 23 +++++++++-------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/rizin b/rizin index f5ca4b96..ce88bbed 160000 --- a/rizin +++ b/rizin @@ -1 +1 @@ -Subproject commit f5ca4b96310efb7e38100076580d854b5aaf3248 +Subproject commit ce88bbed49d1142fa33a57afee2ccfa62694f23b diff --git a/src/core/Cutter.cpp b/src/core/Cutter.cpp index cab4f2e5..baaa8410 100644 --- a/src/core/Cutter.cpp +++ b/src/core/Cutter.cpp @@ -3422,7 +3422,7 @@ QList CutterCore::getAllSections() return sections; } - RzList *sects = rz_bin_object_get_sections(o); + RzPVector *sects = rz_bin_object_get_sections(o); if (!sects) { return sections; } @@ -3431,9 +3431,7 @@ QList CutterCore::getAllSections() return sections; } rz_list_push(hashnames, rz_str_new("entropy")); - RzListIter *it; - RzBinSection *sect; - CutterRzListForeach (sects, it, RzBinSection, sect) { + for (const auto § : CutterPVector(sects)) { if (RZ_STR_ISEMPTY(sect->name)) continue; @@ -3456,7 +3454,7 @@ QList CutterCore::getAllSections() sections << section; } - rz_list_free(sects); + rz_pvector_free(sects); return sections; } @@ -3470,15 +3468,14 @@ QStringList CutterCore::getSectionList() return ret; } - RzList *sects = rz_bin_object_get_sections(o); + RzPVector *sects = rz_bin_object_get_sections(o); if (!sects) { return ret; } - RzListIter *it; - RzBinSection *sect; - CutterRzListForeach (sects, it, RzBinSection, sect) { + for (const auto § : CutterPVector(sects)) { ret << sect->name; } + rz_pvector_free(sects); return ret; } @@ -3494,15 +3491,13 @@ QList CutterCore::getAllSegments() if (!bf) { return {}; } - RzList *segments = rz_bin_object_get_segments(bf->o); + RzPVector *segments = rz_bin_object_get_segments(bf->o); if (!segments) { return {}; } - RzBinSection *segment; - RzListIter *iter; QList ret; - CutterRzListForeach (segments, iter, RzBinSection, segment) { + for (const auto &segment : CutterPVector(segments)) { SegmentDescription segDesc; segDesc.name = segment->name; segDesc.vaddr = segment->vaddr; @@ -3512,7 +3507,7 @@ QList CutterCore::getAllSegments() segDesc.perm = perms_str(segment->perm); ret << segDesc; } - rz_list_free(segments); + rz_pvector_free(segments); return ret; } From e3087e727af1c4b1362407476faeda6a3d2c2e08 Mon Sep 17 00:00:00 2001 From: Karthik Prakash <116057817+skoriop@users.noreply.github.com> Date: Sat, 27 Jan 2024 22:08:34 +0530 Subject: [PATCH 30/38] Highlight matching braces in decompiler view (#3285) --- src/common/SelectionHighlight.cpp | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/common/SelectionHighlight.cpp b/src/common/SelectionHighlight.cpp index e7c2ee72..9906e2d7 100644 --- a/src/common/SelectionHighlight.cpp +++ b/src/common/SelectionHighlight.cpp @@ -7,6 +7,7 @@ #include #include #include +#include QList createSameWordsSelections(QPlainTextEdit *textEdit, const QString &word) @@ -21,6 +22,42 @@ QList createSameWordsSelections(QPlainTextEdit *textE } highlightSelection.cursor = textEdit->textCursor(); + + if (word == "{" || word == "}") { + int val; + if (word == "{") { + val = 0; + } else { + val = 1; + } + selections.append(highlightSelection); + + while (!highlightSelection.cursor.isNull() && !highlightSelection.cursor.atEnd()) { + if (word == "{") { + highlightSelection.cursor = + document->find(QRegularExpression("{|}"), highlightSelection.cursor); + } else { + highlightSelection.cursor = + document->find(QRegularExpression("{|}"), highlightSelection.cursor, + QTextDocument::FindBackward); + } + + if (!highlightSelection.cursor.isNull()) { + if (highlightSelection.cursor.selectedText() == word) { + val++; + } else { + val--; + } + if (val == 0) { + highlightSelection.format.setBackground(highlightWordColor); + selections.append(highlightSelection); + break; + } + } + } + return selections; + } + highlightSelection.cursor.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor); while (!highlightSelection.cursor.isNull() && !highlightSelection.cursor.atEnd()) { From 7a812a11ecfba78c421f223f3b79bb282c29aa68 Mon Sep 17 00:00:00 2001 From: Herman Semenov Date: Mon, 29 Jan 2024 12:38:35 +0000 Subject: [PATCH 31/38] 'this' is not used in lambda function --- src/dialogs/preferences/AnalysisOptionsWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dialogs/preferences/AnalysisOptionsWidget.cpp b/src/dialogs/preferences/AnalysisOptionsWidget.cpp index 53d00f2f..539ea968 100644 --- a/src/dialogs/preferences/AnalysisOptionsWidget.cpp +++ b/src/dialogs/preferences/AnalysisOptionsWidget.cpp @@ -38,7 +38,7 @@ AnalysisOptionsWidget::AnalysisOptionsWidget(PreferencesDialog *dialog) QString val = confCheckbox.config; QCheckBox &cb = *confCheckbox.checkBox; connect(confCheckbox.checkBox, &QCheckBox::stateChanged, this, - [this, val, &cb]() { checkboxEnabler(&cb, val); }); + [val, &cb]() { checkboxEnabler(&cb, val); }); } ui->analyzePushButton->setToolTip("Analyze the program using Rizin's \"aaa\" command"); From e7a5931c767a90d950dbc3aed65826d4b0345443 Mon Sep 17 00:00:00 2001 From: karliss Date: Mon, 12 Feb 2024 06:32:51 +0200 Subject: [PATCH 32/38] Include instruction highlighter in python bindings. (#3291) --- src/bindings/bindings.xml.in | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bindings/bindings.xml.in b/src/bindings/bindings.xml.in index 0fa194a9..c20aea67 100644 --- a/src/bindings/bindings.xml.in +++ b/src/bindings/bindings.xml.in @@ -14,6 +14,7 @@ + From f97ab440727a849e5c5a1792006d3c6f0a37ddb9 Mon Sep 17 00:00:00 2001 From: Anton Kochkov Date: Tue, 13 Feb 2024 22:54:02 +0800 Subject: [PATCH 33/38] Update rizin to latest dev & update jsdec to v0.7.0 (#3292) * Update rizin to latest dev * Use jsdec for rizin 0.7.0 --------- Co-authored-by: wargio --- dist/bundle_jsdec.ps1 | 4 ++-- rizin | 2 +- scripts/jsdec.sh | 15 ++++++++------- src/common/Decompiler.cpp | 2 +- src/core/Cutter.cpp | 6 +++--- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/dist/bundle_jsdec.ps1 b/dist/bundle_jsdec.ps1 index a25d6ae6..64466a7c 100644 --- a/dist/bundle_jsdec.ps1 +++ b/dist/bundle_jsdec.ps1 @@ -2,10 +2,10 @@ $dist = $args[0] $python = Split-Path((Get-Command python.exe).Path) if (-not (Test-Path -Path 'jsdec' -PathType Container)) { - git clone https://github.com/rizinorg/jsdec.git --depth 1 --branch "v0.6.0" + git clone https://github.com/rizinorg/jsdec.git --depth 1 --branch "v0.7.0" } cd jsdec -& meson.exe --buildtype=release -Dc_args=-DDUK_USE_DATE_NOW_WINDOWS -Djsc_folder=".." --prefix="$dist" p build +& meson.exe --buildtype=release --prefix="$dist" build ninja -C build install $ErrorActionPreference = 'Stop' $pathdll = "$dist\lib\rizin\plugins\core_pdd.dll" diff --git a/rizin b/rizin index ce88bbed..fa455f8b 160000 --- a/rizin +++ b/rizin @@ -1 +1 @@ -Subproject commit ce88bbed49d1142fa33a57afee2ccfa62694f23b +Subproject commit fa455f8b5244ad0cebe2fa8aca1c71096f55dfa1 diff --git a/scripts/jsdec.sh b/scripts/jsdec.sh index 966c605a..c084133c 100755 --- a/scripts/jsdec.sh +++ b/scripts/jsdec.sh @@ -6,14 +6,15 @@ SCRIPTPATH=$(realpath "$(dirname "${BASH_SOURCE[0]}")") cd "$SCRIPTPATH/.." -if [[ ! -d jsdec ]]; then - git clone https://github.com/rizinorg/jsdec.git --depth 1 --branch "v0.6.0" +if [ ! -d jsdec ]; then + git clone https://github.com/rizinorg/jsdec.git --depth 1 --branch "v0.7.0" fi cd jsdec -rm -rf build -mkdir build && cd build -meson --buildtype=release -Djsc_folder="../" "$@" ../p -ninja -ninja install +if [ -d build ]; then + rm -rf build +fi +meson --buildtype=release "$@" build +ninja -C build +ninja -C build install diff --git a/src/common/Decompiler.cpp b/src/common/Decompiler.cpp index 1868e4e4..2d9478e5 100644 --- a/src/common/Decompiler.cpp +++ b/src/common/Decompiler.cpp @@ -16,7 +16,7 @@ static char *jsonToStrdup(const CutterJson &str) if (!j || j->type != RZ_JSON_STRING) { return NULL; } - return rz_str_new(j->str_value); + return rz_str_dup(j->str_value); } static RzAnnotatedCode *parseJsonCode(CutterJson &json) diff --git a/src/core/Cutter.cpp b/src/core/Cutter.cpp index baaa8410..47fc607d 100644 --- a/src/core/Cutter.cpp +++ b/src/core/Cutter.cpp @@ -3430,7 +3430,7 @@ QList CutterCore::getAllSections() if (!hashnames) { return sections; } - rz_list_push(hashnames, rz_str_new("entropy")); + rz_list_push(hashnames, rz_str_dup("entropy")); for (const auto § : CutterPVector(sects)) { if (RZ_STR_ISEMPTY(sect->name)) continue; @@ -3778,8 +3778,8 @@ void CutterCore::setAnalysisMethod(const QString &className, const AnalysisMetho { CORE_LOCK(); RzAnalysisMethod analysisMeth; - analysisMeth.name = rz_str_new(meth.name.toUtf8().constData()); - analysisMeth.real_name = rz_str_new(meth.realName.toUtf8().constData()); + analysisMeth.name = rz_str_dup(meth.name.toUtf8().constData()); + analysisMeth.real_name = rz_str_dup(meth.realName.toUtf8().constData()); analysisMeth.addr = meth.addr; analysisMeth.vtable_offset = meth.vtableOffset; rz_analysis_class_method_set(core->analysis, className.toUtf8().constData(), &analysisMeth); From acbb418447a8b18ceddf754abb18a71e991aa59e Mon Sep 17 00:00:00 2001 From: Anton Kochkov Date: Thu, 15 Feb 2024 16:41:02 +0800 Subject: [PATCH 34/38] Update translations (#3295) --- src/translations | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/translations b/src/translations index 30267d0a..8358f174 160000 --- a/src/translations +++ b/src/translations @@ -1 +1 @@ -Subproject commit 30267d0acd528cbdbe2911e562085f7385e5ac47 +Subproject commit 8358f174d519bbf0d6cf4e1ccbe586308c009f85 From 0c9687850027784b27b053e9d1f883fe0e66d831 Mon Sep 17 00:00:00 2001 From: Anton Kochkov Date: Mon, 19 Feb 2024 20:17:05 +0800 Subject: [PATCH 35/38] Update Rizin to the latest dev --- rizin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rizin b/rizin index fa455f8b..9719961b 160000 --- a/rizin +++ b/rizin @@ -1 +1 @@ -Subproject commit fa455f8b5244ad0cebe2fa8aca1c71096f55dfa1 +Subproject commit 9719961b8217a97ec9327236519b0bc500a480c5 From 8574f0b0e42a1f0d12599548d9907a56dd236182 Mon Sep 17 00:00:00 2001 From: Anton Kochkov Date: Mon, 19 Feb 2024 20:36:28 +0800 Subject: [PATCH 36/38] Fix rz_core_analysis_bytes() API use --- src/core/Cutter.cpp | 21 ++++++--------------- src/core/RizinCpp.h | 6 ++++++ 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/core/Cutter.cpp b/src/core/Cutter.cpp index 47fc607d..2a0db993 100644 --- a/src/core/Cutter.cpp +++ b/src/core/Cutter.cpp @@ -722,11 +722,10 @@ PRzAnalysisBytes CutterCore::getRzAnalysisBytesSingle(RVA addr) rz_io_read_at(core->io, addr, buf, sizeof(buf)); auto seek = seekTemp(addr); - auto vec = fromOwned(rz_core_analysis_bytes(core, addr, buf, sizeof(buf), 1)); + auto abiter = fromOwned(rz_core_analysis_bytes(core, addr, buf, sizeof(buf), 1)); + auto ab = + abiter ? reinterpret_cast(rz_iterator_next(abiter.get())) : nullptr; - auto ab = vec && rz_pvector_len(vec.get()) > 0 - ? reinterpret_cast(rz_pvector_pop_front(vec.get())) - : nullptr; return { ab, rz_analysis_bytes_free }; } @@ -1027,18 +1026,10 @@ RVA CutterCore::nextOpAddr(RVA startAddr, int count) { CORE_LOCK(); auto seek = seekTemp(startAddr); - auto vec = fromOwned(rz_core_analysis_bytes(core, core->offset, core->block, - (int)core->blocksize, count + 1)); + auto consumed = + rz_core_analysis_ops_size(core, core->offset, core->block, (int)core->blocksize, count); - RVA addr = startAddr + 1; - if (!vec) { - return addr; - } - auto ab = reinterpret_cast(rz_pvector_tail(vec.get())); - if (!(ab && ab->op)) { - return addr; - } - addr = ab->op->addr; + RVA addr = startAddr + consumed; return addr; } diff --git a/src/core/RizinCpp.h b/src/core/RizinCpp.h index 6399e145..65fd95b6 100644 --- a/src/core/RizinCpp.h +++ b/src/core/RizinCpp.h @@ -51,6 +51,12 @@ static inline auto fromOwned(RZ_OWN RzList *data) -> UniquePtrCP UniquePtrCP +{ + return { data, {} }; +} + // Rizin list iteration macros // deprecated, prefer using CutterPVector and CutterRzList instead #define CutterRzListForeach(list, it, type, x) \ From 1a52a7eea43e2d3d3c429b4826b39b3e31b9026d Mon Sep 17 00:00:00 2001 From: Anton Kochkov Date: Mon, 19 Feb 2024 23:08:32 +0800 Subject: [PATCH 37/38] Fix compilation error of undefined TRUE --- src/widgets/GraphvizLayout.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/GraphvizLayout.cpp b/src/widgets/GraphvizLayout.cpp index f2a53b3c..eb1fe4e3 100644 --- a/src/widgets/GraphvizLayout.cpp +++ b/src/widgets/GraphvizLayout.cpp @@ -94,7 +94,7 @@ void GraphvizLayout::CalculateLayout(std::unordered_map &block std::unordered_map nodes; for (const auto &block : blocks) { - nodes[block.first] = agnode(g, nullptr, TRUE); + nodes[block.first] = agnode(g, nullptr, true); } std::vector strc; @@ -143,7 +143,7 @@ void GraphvizLayout::CalculateLayout(std::unordered_map &block if (v == nodes.end()) { continue; } - auto e = agedge(g, u, v->second, nullptr, TRUE); + auto e = agedge(g, u, v->second, nullptr, true); edges[{ blockIt.first, edge.target }] = e; if (loopEdges.find({ blockIt.first, edge.target }) != loopEdges.end()) { agxset(e, constraintAttr, STR("0")); From 372b45c8b9a8b90b9c025e2b47afa0090452d982 Mon Sep 17 00:00:00 2001 From: Anton Kochkov Date: Sat, 24 Feb 2024 00:02:53 +0800 Subject: [PATCH 38/38] Update Rizin to the latest dev --- rizin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rizin b/rizin index 9719961b..78d4043a 160000 --- a/rizin +++ b/rizin @@ -1 +1 @@ -Subproject commit 9719961b8217a97ec9327236519b0bc500a480c5 +Subproject commit 78d4043afb39a56fe91ea7ab03c83da613319cc3