From 1085a913530e70055ac65353ba35f71302e500a1 Mon Sep 17 00:00:00 2001 From: r3yc0n1c Date: Fri, 12 Apr 2024 01:16:16 +0530 Subject: [PATCH] Rizin update --- .gitmodules | 3 +-- cmake/BundledRizin.cmake | 7 +++--- rizin | 2 +- src/core/Cutter.cpp | 10 ++++----- src/widgets/DisassemblerGraphView.cpp | 2 +- src/widgets/ProcessesWidget.cpp | 31 ++++++++++++--------------- src/widgets/ProcessesWidget.h | 7 ++++++ src/widgets/ThreadsWidget.cpp | 24 +++++++++------------ src/widgets/ThreadsWidget.h | 6 ++++++ 9 files changed, 47 insertions(+), 45 deletions(-) diff --git a/.gitmodules b/.gitmodules index 2325aee9ac..8dfdd99a4c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,6 @@ [submodule "rizin"] path = rizin url = https://github.com/rizinorg/rizin - branch = dev [submodule "src/translations"] path = src/translations - url = https://github.com/rizinorg/cutter-translations + url = https://github.com/rizinorg/cutter-translations \ No newline at end of file diff --git a/cmake/BundledRizin.cmake b/cmake/BundledRizin.cmake index 1d6208b9a1..3e05b26304 100644 --- a/cmake/BundledRizin.cmake +++ b/cmake/BundledRizin.cmake @@ -59,10 +59,9 @@ endif() # instead of being hardcoded. set (Rizin_VERSION 0.8) -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 - rz_search rz_syscall rz_socket rz_magic rz_crypto rz_type rz_diff rz_sign - rz_demangler) +set (RZ_LIBS rz_core rz_config rz_cons rz_io rz_util rz_flag rz_arch rz_debug + rz_hash rz_bin rz_lang rz_il rz_bp rz_egg rz_reg rz_search rz_syscall + rz_socket rz_magic rz_crypto rz_type rz_diff rz_sign rz_demangler) set (RZ_EXTRA_LIBS rz_main) set (RZ_BIN rz-bin rizin rz-diff rz-find rz-gg rz-hash rz-run rz-asm rz-ax) diff --git a/rizin b/rizin index eeda6b1b59..3d93397dd8 160000 --- a/rizin +++ b/rizin @@ -1 +1 @@ -Subproject commit eeda6b1b59da83886cafdf06100188f906500dda +Subproject commit 3d93397dd8b96ce1e8683a21ab86d94812f0b23f diff --git a/src/core/Cutter.cpp b/src/core/Cutter.cpp index 6951e01a02..0f646b810e 100644 --- a/src/core/Cutter.cpp +++ b/src/core/Cutter.cpp @@ -1295,7 +1295,7 @@ RVA CutterCore::getLastFunctionInstruction(RVA addr) if (!fcn) { return RVA_INVALID; } - RzAnalysisBlock *lastBB = (RzAnalysisBlock *)rz_list_last(fcn->bbs); + RzAnalysisBlock *lastBB = (RzAnalysisBlock *)rz_pvector_tail(fcn->bbs); return lastBB ? rz_analysis_block_get_op_addr(lastBB, lastBB->ninstr - 1) : RVA_INVALID; } @@ -1641,7 +1641,7 @@ QVector CutterCore::getHeapChunks(RVA arena_addr) rz_list_free(arenas); return chunks_vector; } - m_arena = ((RzArenaListItem *)rz_list_get_head_data(arenas))->addr; + m_arena = ((RzArenaListItem *)rz_list_first(arenas))->addr; rz_list_free(arenas); } else { m_arena = arena_addr; @@ -3061,7 +3061,7 @@ QList CutterCore::getAllFunctions() function.linearSize = rz_analysis_function_linear_size(fcn); function.nargs = rz_analysis_arg_count(fcn); function.nlocals = rz_analysis_var_local_count(fcn); - function.nbbs = rz_list_length(fcn->bbs); + function.nbbs = rz_pvector_len(fcn->bbs); function.calltype = fcn->cc ? QString::fromUtf8(fcn->cc) : QString(); function.name = fcn->name ? QString::fromUtf8(fcn->name) : QString(); function.edges = rz_analysis_function_count_edges(fcn, nullptr); @@ -4334,10 +4334,9 @@ QString CutterCore::getVersionInformation() const char *name; const char *(*callback)(); } vcs[] = { - { "rz_analysis", &rz_analysis_version }, + { "rz_arch", &rz_arch_version }, { "rz_lib", &rz_lib_version }, { "rz_egg", &rz_egg_version }, - { "rz_asm", &rz_asm_version }, { "rz_bin", &rz_bin_version }, { "rz_cons", &rz_cons_version }, { "rz_flag", &rz_flag_version }, @@ -4350,7 +4349,6 @@ QString CutterCore::getVersionInformation() #if !USE_LIB_MAGIC { "rz_magic", &rz_magic_version }, #endif - { "rz_parse", &rz_parse_version }, { "rz_reg", &rz_reg_version }, { "rz_sign", &rz_sign_version }, { "rz_search", &rz_search_version }, diff --git a/src/widgets/DisassemblerGraphView.cpp b/src/widgets/DisassemblerGraphView.cpp index 82da086613..a220188f61 100644 --- a/src/widgets/DisassemblerGraphView.cpp +++ b/src/widgets/DisassemblerGraphView.cpp @@ -225,7 +225,7 @@ void DisassemblerGraphView::loadCurrentGraph() return; } - for (const auto &bbi : CutterRzList(fcn->bbs)) { + for (const auto &bbi : CutterPVector(fcn->bbs)) { RVA bbiFail = bbi->fail; RVA bbiJump = bbi->jump; diff --git a/src/widgets/ProcessesWidget.cpp b/src/widgets/ProcessesWidget.cpp index 2a9477f8f4..0a45a98e55 100644 --- a/src/widgets/ProcessesWidget.cpp +++ b/src/widgets/ProcessesWidget.cpp @@ -9,13 +9,6 @@ #define DEBUGGED_PID (-1) -enum ColumnIndex { - COLUMN_PID = 0, - COLUMN_UID, - COLUMN_STATUS, - COLUMN_PATH, -}; - ProcessesWidget::ProcessesWidget(MainWindow *main) : CutterDockWidget(main), ui(new Ui::ProcessesWidget) { @@ -23,10 +16,14 @@ ProcessesWidget::ProcessesWidget(MainWindow *main) // Setup processes model modelProcesses = new QStandardItemModel(1, 4, this); - modelProcesses->setHorizontalHeaderItem(COLUMN_PID, new QStandardItem(tr("PID"))); - modelProcesses->setHorizontalHeaderItem(COLUMN_UID, new QStandardItem(tr("UID"))); - modelProcesses->setHorizontalHeaderItem(COLUMN_STATUS, new QStandardItem(tr("Status"))); - modelProcesses->setHorizontalHeaderItem(COLUMN_PATH, new QStandardItem(tr("Path"))); + modelProcesses->setHorizontalHeaderItem(ProcessesWidget::COLUMN_PID, + new QStandardItem(tr("PID"))); + modelProcesses->setHorizontalHeaderItem(ProcessesWidget::COLUMN_UID, + new QStandardItem(tr("UID"))); + modelProcesses->setHorizontalHeaderItem(ProcessesWidget::COLUMN_STATUS, + new QStandardItem(tr("Status"))); + modelProcesses->setHorizontalHeaderItem(ProcessesWidget::COLUMN_PATH, + new QStandardItem(tr("Path"))); ui->viewProcesses->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter); ui->viewProcesses->verticalHeader()->setVisible(false); ui->viewProcesses->setFont(Config()->getFont()); @@ -129,10 +126,10 @@ void ProcessesWidget::setProcessesGrid() rowStatus->setFont(font); rowPath->setFont(font); - modelProcesses->setItem(i, COLUMN_PID, rowPid); - modelProcesses->setItem(i, COLUMN_UID, rowUid); - modelProcesses->setItem(i, COLUMN_STATUS, rowStatus); - modelProcesses->setItem(i, COLUMN_PATH, rowPath); + modelProcesses->setItem(i, ProcessesWidget::COLUMN_PID, rowPid); + modelProcesses->setItem(i, ProcessesWidget::COLUMN_UID, rowUid); + modelProcesses->setItem(i, ProcessesWidget::COLUMN_STATUS, rowStatus); + modelProcesses->setItem(i, ProcessesWidget::COLUMN_PATH, rowPath); i++; } @@ -155,7 +152,7 @@ void ProcessesWidget::onActivated(const QModelIndex &index) if (!index.isValid()) return; - int pid = modelFilter->data(index.sibling(index.row(), COLUMN_PID)).toInt(); + int pid = modelFilter->data(index.sibling(index.row(), ProcessesWidget::COLUMN_PID)).toInt(); // Verify that the selected pid is still in the processes list since dp= will // attach to any given id. If it isn't found simply update the UI. for (const auto &value : Core()->getAllProcesses()) { @@ -185,7 +182,7 @@ ProcessesFilterModel::ProcessesFilterModel(QObject *parent) : QSortFilterProxyMo bool ProcessesFilterModel::filterAcceptsRow(int row, const QModelIndex &parent) const { // All columns are checked for a match - for (int i = COLUMN_PID; i <= COLUMN_PATH; ++i) { + for (int i = ProcessesWidget::COLUMN_PID; i <= ProcessesWidget::COLUMN_PATH; ++i) { QModelIndex index = sourceModel()->index(row, i, parent); if (qhelpers::filterStringContains(sourceModel()->data(index).toString(), this)) { return true; diff --git a/src/widgets/ProcessesWidget.h b/src/widgets/ProcessesWidget.h index fcc9db8008..40f2f0f657 100644 --- a/src/widgets/ProcessesWidget.h +++ b/src/widgets/ProcessesWidget.h @@ -31,6 +31,13 @@ class ProcessesWidget : public CutterDockWidget Q_OBJECT public: + enum ColumnIndex { + COLUMN_PID = 0, + COLUMN_UID, + COLUMN_STATUS, + COLUMN_PATH, + }; + explicit ProcessesWidget(MainWindow *main); ~ProcessesWidget(); diff --git a/src/widgets/ThreadsWidget.cpp b/src/widgets/ThreadsWidget.cpp index d9149108f9..8d47412888 100644 --- a/src/widgets/ThreadsWidget.cpp +++ b/src/widgets/ThreadsWidget.cpp @@ -9,21 +9,17 @@ #define DEBUGGED_PID (-1) -enum ColumnIndex { - COLUMN_PID = 0, - COLUMN_STATUS, - COLUMN_PATH, -}; - ThreadsWidget::ThreadsWidget(MainWindow *main) : CutterDockWidget(main), ui(new Ui::ThreadsWidget) { ui->setupUi(this); // Setup threads model modelThreads = new QStandardItemModel(1, 3, this); - modelThreads->setHorizontalHeaderItem(COLUMN_PID, new QStandardItem(tr("PID"))); - modelThreads->setHorizontalHeaderItem(COLUMN_STATUS, new QStandardItem(tr("Status"))); - modelThreads->setHorizontalHeaderItem(COLUMN_PATH, new QStandardItem(tr("Path"))); + modelThreads->setHorizontalHeaderItem(ThreadsWidget::COLUMN_PID, new QStandardItem(tr("PID"))); + modelThreads->setHorizontalHeaderItem(ThreadsWidget::COLUMN_STATUS, + new QStandardItem(tr("Status"))); + modelThreads->setHorizontalHeaderItem(ThreadsWidget::COLUMN_PATH, + new QStandardItem(tr("Path"))); ui->viewThreads->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter); ui->viewThreads->verticalHeader()->setVisible(false); ui->viewThreads->setFont(Config()->getFont()); @@ -120,9 +116,9 @@ void ThreadsWidget::setThreadsGrid() rowStatus->setFont(font); QStandardItem *rowPath = new QStandardItem(path); rowPath->setFont(font); - modelThreads->setItem(i, COLUMN_PID, rowPid); - modelThreads->setItem(i, COLUMN_STATUS, rowStatus); - modelThreads->setItem(i, COLUMN_PATH, rowPath); + modelThreads->setItem(i, ThreadsWidget::COLUMN_PID, rowPid); + modelThreads->setItem(i, ThreadsWidget::COLUMN_STATUS, rowStatus); + modelThreads->setItem(i, ThreadsWidget::COLUMN_PATH, rowPath); i++; } @@ -146,7 +142,7 @@ void ThreadsWidget::onActivated(const QModelIndex &index) if (!index.isValid()) return; - int tid = modelFilter->data(index.sibling(index.row(), COLUMN_PID)).toInt(); + int tid = modelFilter->data(index.sibling(index.row(), ThreadsWidget::COLUMN_PID)).toInt(); // Verify that the selected tid is still in the threads list since dpt= will // attach to any given id. If it isn't found simply update the UI. @@ -169,7 +165,7 @@ ThreadsFilterModel::ThreadsFilterModel(QObject *parent) : QSortFilterProxyModel( bool ThreadsFilterModel::filterAcceptsRow(int row, const QModelIndex &parent) const { // All columns are checked for a match - for (int i = COLUMN_PID; i <= COLUMN_PATH; ++i) { + for (int i = ThreadsWidget::COLUMN_PID; i <= ThreadsWidget::COLUMN_PATH; ++i) { QModelIndex index = sourceModel()->index(row, i, parent); if (qhelpers::filterStringContains(sourceModel()->data(index).toString(), this)) { return true; diff --git a/src/widgets/ThreadsWidget.h b/src/widgets/ThreadsWidget.h index 259c919de2..fd452d1e19 100644 --- a/src/widgets/ThreadsWidget.h +++ b/src/widgets/ThreadsWidget.h @@ -31,6 +31,12 @@ class ThreadsWidget : public CutterDockWidget Q_OBJECT public: + enum ColumnIndex { + COLUMN_PID = 0, + COLUMN_STATUS, + COLUMN_PATH, + }; + explicit ThreadsWidget(MainWindow *main); ~ThreadsWidget();