mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-24 05:45:27 +00:00
Port to Rizin
This commit is contained in:
parent
0e9b0c92b9
commit
2b8ac6ecf7
15
.github/workflows/ccpp.yml
vendored
15
.github/workflows/ccpp.yml
vendored
@ -29,7 +29,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: true # 'recursive' 'true' or 'false'
|
token: ${{ secrets.RIZIN_TOKEN }} # TODO: remove when the repo is public
|
||||||
|
submodules: recursive
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- name: apt dependencies
|
- name: apt dependencies
|
||||||
if: contains(matrix.os, 'ubuntu')
|
if: contains(matrix.os, 'ubuntu')
|
||||||
@ -101,20 +102,20 @@ jobs:
|
|||||||
then
|
then
|
||||||
cmake \
|
cmake \
|
||||||
-G Ninja \
|
-G Ninja \
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
|
||||||
-DCUTTER_ENABLE_PYTHON=ON \
|
-DCUTTER_ENABLE_PYTHON=ON \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
-DPYTHON_LIBRARY="$CUTTER_DEPS_PYTHON_PREFIX/lib/libpython3.6m.so.1.0" \
|
-DPYTHON_LIBRARY="$CUTTER_DEPS_PYTHON_PREFIX/lib/libpython3.6m.so.1.0" \
|
||||||
-DPYTHON_INCLUDE_DIR="$CUTTER_DEPS_PYTHON_PREFIX/include/python3.6m" \
|
-DPYTHON_INCLUDE_DIR="$CUTTER_DEPS_PYTHON_PREFIX/include/python3.6m" \
|
||||||
-DPYTHON_EXECUTABLE="$CUTTER_DEPS_PYTHON_PREFIX/bin/python3" \
|
-DPYTHON_EXECUTABLE="$CUTTER_DEPS_PYTHON_PREFIX/bin/python3" \
|
||||||
-DCUTTER_ENABLE_PYTHON_BINDINGS=OFF \
|
-DCUTTER_ENABLE_PYTHON_BINDINGS=OFF \
|
||||||
-DCUTTER_ENABLE_CRASH_REPORTS=ON \
|
-DCUTTER_ENABLE_CRASH_REPORTS=ON \
|
||||||
-DCUTTER_USE_BUNDLED_RADARE2=ON \
|
-DCUTTER_USE_BUNDLED_RIZIN=ON \
|
||||||
../src
|
../src && \
|
||||||
else
|
else
|
||||||
cmake \
|
cmake \
|
||||||
-G Ninja \
|
-G Ninja \
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
-DCUTTER_USE_BUNDLED_RADARE2=ON \
|
-DCUTTER_USE_BUNDLED_RIZIN=ON \
|
||||||
../src
|
../src
|
||||||
fi
|
fi
|
||||||
ninja
|
ninja
|
||||||
@ -137,7 +138,7 @@ jobs:
|
|||||||
-DCUTTER_ENABLE_PYTHON=ON \
|
-DCUTTER_ENABLE_PYTHON=ON \
|
||||||
-DCUTTER_ENABLE_PYTHON_BINDINGS=ON \
|
-DCUTTER_ENABLE_PYTHON_BINDINGS=ON \
|
||||||
-DCUTTER_ENABLE_CRASH_REPORTS=ON \
|
-DCUTTER_ENABLE_CRASH_REPORTS=ON \
|
||||||
-DCUTTER_USE_BUNDLED_RADARE2=ON \
|
-DCUTTER_USE_BUNDLED_RIZIN=ON \
|
||||||
-DBREAKPAD_FRAMEWORK_DIR="$BREAKPAD_FRAMEWORK_DIR" \
|
-DBREAKPAD_FRAMEWORK_DIR="$BREAKPAD_FRAMEWORK_DIR" \
|
||||||
../src && \
|
../src && \
|
||||||
make -j4;
|
make -j4;
|
||||||
@ -163,7 +164,7 @@ jobs:
|
|||||||
set PACKAGE_NAME=cutter-git-x64.Windows
|
set PACKAGE_NAME=cutter-git-x64.Windows
|
||||||
cmake ^
|
cmake ^
|
||||||
-DCMAKE_BUILD_TYPE=Release ^
|
-DCMAKE_BUILD_TYPE=Release ^
|
||||||
-DCUTTER_USE_BUNDLED_RADARE2=ON ^
|
-DCUTTER_USE_BUNDLED_RIZIN=ON ^
|
||||||
-DCUTTER_ENABLE_PYTHON=ON ^
|
-DCUTTER_ENABLE_PYTHON=ON ^
|
||||||
-DCUTTER_ENABLE_PYTHON_BINDINGS=ON ^
|
-DCUTTER_ENABLE_PYTHON_BINDINGS=ON ^
|
||||||
-DCUTTER_PACKAGE_DEPENDENCIES=ON ^
|
-DCUTTER_PACKAGE_DEPENDENCIES=ON ^
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -94,3 +94,6 @@ src/out
|
|||||||
|
|
||||||
# astyle backup .orig files
|
# astyle backup .orig files
|
||||||
*.orig
|
*.orig
|
||||||
|
|
||||||
|
# Gdb's history
|
||||||
|
.gdb_history
|
||||||
|
8
.gitmodules
vendored
8
.gitmodules
vendored
@ -1,6 +1,6 @@
|
|||||||
[submodule "radare2"]
|
[submodule "rizin"]
|
||||||
path = radare2
|
path = rizin
|
||||||
url = https://github.com/radareorg/radare2
|
url = git@github.com:rizinorg/rizin
|
||||||
[submodule "src/translations"]
|
[submodule "src/translations"]
|
||||||
path = src/translations
|
path = src/translations
|
||||||
url = https://github.com/radareorg/cutter-translations
|
url = git@github.com:rizinorg/cutter-translations
|
||||||
|
1
radare2
1
radare2
@ -1 +0,0 @@
|
|||||||
Subproject commit 293cf5ae65ba4e28828095dcae212955593ba255
|
|
1
rizin
Submodule
1
rizin
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 8b30c4f0d7282009e52099764e15b686c4d08654
|
@ -10,9 +10,9 @@ include(Utils)
|
|||||||
|
|
||||||
set(CUTTER_PYTHON_MIN 3.5)
|
set(CUTTER_PYTHON_MIN 3.5)
|
||||||
|
|
||||||
option(CUTTER_USE_BUNDLED_RADARE2 "Use radare2 from src/radare2 submodule instead of searching for it on the system" OFF)
|
option(CUTTER_USE_BUNDLED_RIZIN "Use rizin from src/rizin submodule instead of searching for it on the system" OFF)
|
||||||
option(CUTTER_USE_ADDITIONAL_RADARE2_PATHS "Search radare2 in additional paths which are not part of default system library paths.\
|
option(CUTTER_USE_ADDITIONAL_RIZIN_PATHS "Search rizin in additional paths which are not part of default system library paths.\
|
||||||
Disable this option if you are linking against radare2 pacakged as proper system library or in a custom path and additional are paths causing problems." ON)
|
Disable this option if you are linking against rizin pacakged as proper system library or in a custom path and additional are paths causing problems." ON)
|
||||||
option(CUTTER_ENABLE_PYTHON "Enable Python integration. Requires Python >= ${CUTTER_PYTHON_MIN}." OFF)
|
option(CUTTER_ENABLE_PYTHON "Enable Python integration. Requires Python >= ${CUTTER_PYTHON_MIN}." OFF)
|
||||||
option(CUTTER_ENABLE_PYTHON_BINDINGS "Enable generating Python bindings with Shiboken2. Unused if CUTTER_ENABLE_PYTHON=OFF." OFF)
|
option(CUTTER_ENABLE_PYTHON_BINDINGS "Enable generating Python bindings with Shiboken2. Unused if CUTTER_ENABLE_PYTHON=OFF." OFF)
|
||||||
option(CUTTER_ENABLE_CRASH_REPORTS "Enable crash report system. Unused if CUTTER_ENABLE_CRASH_REPORTS=OFF" OFF)
|
option(CUTTER_ENABLE_CRASH_REPORTS "Enable crash report system. Unused if CUTTER_ENABLE_CRASH_REPORTS=OFF" OFF)
|
||||||
@ -65,12 +65,12 @@ find_package(${QT_PREFIX} REQUIRED COMPONENTS Core Widgets Gui Svg Network)
|
|||||||
|
|
||||||
include(CutterInstallDirs)
|
include(CutterInstallDirs)
|
||||||
|
|
||||||
if(CUTTER_USE_BUNDLED_RADARE2)
|
if(CUTTER_USE_BUNDLED_RIZIN)
|
||||||
include(BundledRadare2)
|
include(BundledRizin)
|
||||||
set(RADARE2_TARGET Radare2)
|
set(RIZIN_TARGET Rizin)
|
||||||
else()
|
else()
|
||||||
find_package(Radare2 REQUIRED)
|
find_package(Rizin REQUIRED)
|
||||||
set(RADARE2_TARGET Radare2::libr)
|
set(RIZIN_TARGET Rizin::librz)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CUTTER_ENABLE_PYTHON)
|
if(CUTTER_ENABLE_PYTHON)
|
||||||
@ -129,7 +129,7 @@ endif()
|
|||||||
message(STATUS "")
|
message(STATUS "")
|
||||||
message(STATUS "Building Cutter version ${CUTTER_VERSION_FULL}")
|
message(STATUS "Building Cutter version ${CUTTER_VERSION_FULL}")
|
||||||
message(STATUS "Options:")
|
message(STATUS "Options:")
|
||||||
message(STATUS "- Bundled radare2: ${CUTTER_USE_BUNDLED_RADARE2}")
|
message(STATUS "- Bundled rizin: ${CUTTER_USE_BUNDLED_RIZIN}")
|
||||||
message(STATUS "- Python: ${CUTTER_ENABLE_PYTHON}")
|
message(STATUS "- Python: ${CUTTER_ENABLE_PYTHON}")
|
||||||
message(STATUS "- Python Bindings: ${CUTTER_ENABLE_PYTHON_BINDINGS}")
|
message(STATUS "- Python Bindings: ${CUTTER_ENABLE_PYTHON_BINDINGS}")
|
||||||
message(STATUS "- Crash Handling: ${CUTTER_ENABLE_CRASH_REPORTS}")
|
message(STATUS "- Crash Handling: ${CUTTER_ENABLE_CRASH_REPORTS}")
|
||||||
@ -226,7 +226,7 @@ if(CUTTER_ENABLE_CRASH_REPORTS)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(Cutter PUBLIC ${QT_PREFIX}::Core ${QT_PREFIX}::Widgets ${QT_PREFIX}::Gui PRIVATE ${QT_PREFIX}::Svg ${QT_PREFIX}::Network)
|
target_link_libraries(Cutter PUBLIC ${QT_PREFIX}::Core ${QT_PREFIX}::Widgets ${QT_PREFIX}::Gui PRIVATE ${QT_PREFIX}::Svg ${QT_PREFIX}::Network)
|
||||||
target_link_libraries(Cutter PUBLIC ${RADARE2_TARGET})
|
target_link_libraries(Cutter PUBLIC ${RIZIN_TARGET})
|
||||||
if(CUTTER_ENABLE_PYTHON)
|
if(CUTTER_ENABLE_PYTHON)
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
# On windows some of the Python STABLE API functions are in seperate library
|
# On windows some of the Python STABLE API functions are in seperate library
|
||||||
@ -255,7 +255,7 @@ if(CUTTER_ENABLE_PYTHON)
|
|||||||
list(APPEND BINDINGS_INCLUDE_DIRS "${_qt5Core_install_prefix}/include/QtWidgets")
|
list(APPEND BINDINGS_INCLUDE_DIRS "${_qt5Core_install_prefix}/include/QtWidgets")
|
||||||
endif()
|
endif()
|
||||||
list(APPEND BINDINGS_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS})
|
list(APPEND BINDINGS_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS})
|
||||||
list(APPEND BINDINGS_INCLUDE_DIRS ${Radare2_INCLUDE_DIRS})
|
list(APPEND BINDINGS_INCLUDE_DIRS ${Rizin_INCLUDE_DIRS})
|
||||||
list(APPEND BINDINGS_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}")
|
list(APPEND BINDINGS_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
if (NOT WIN32)
|
if (NOT WIN32)
|
||||||
string(REPLACE ";" ":" BINDINGS_INCLUDE_DIRS "${BINDINGS_INCLUDE_DIRS}")
|
string(REPLACE ";" ":" BINDINGS_INCLUDE_DIRS "${BINDINGS_INCLUDE_DIRS}")
|
||||||
|
@ -75,8 +75,8 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check r2 version
|
// Check r2 version
|
||||||
QString r2version = r_core_version();
|
QString r2version = rz_core_version();
|
||||||
QString localVersion = "" R2_GITTAP;
|
QString localVersion = "" RZ_GITTAP;
|
||||||
if (r2version != localVersion) {
|
if (r2version != localVersion) {
|
||||||
QMessageBox msg;
|
QMessageBox msg;
|
||||||
msg.setIcon(QMessageBox::Critical);
|
msg.setIcon(QMessageBox::Critical);
|
||||||
@ -99,7 +99,7 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
// Redefine r_sys_prefix() behaviour
|
// Redefine rz_sys_prefix() behaviour
|
||||||
qputenv("R_ALT_SRC_DIR", "1");
|
qputenv("R_ALT_SRC_DIR", "1");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -151,8 +151,8 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
|
|||||||
appdir.cdUp(); // appdir
|
appdir.cdUp(); // appdir
|
||||||
|
|
||||||
auto sleighHome = appdir;
|
auto sleighHome = appdir;
|
||||||
sleighHome.cd("share/radare2/plugins/r2ghidra_sleigh"); // appdir/share/radare2/plugins/r2ghidra_sleigh
|
sleighHome.cd("share/radare2/plugins/rz_ghidra_sleigh"); // appdir/share/radare2/plugins/rz_ghidra_sleigh
|
||||||
Core()->setConfig("r2ghidra.sleighhome", sleighHome.absolutePath());
|
Core()->setConfig("ghidra.sleighhome", sleighHome.absolutePath());
|
||||||
|
|
||||||
auto r2decHome = appdir;
|
auto r2decHome = appdir;
|
||||||
r2decHome.cd("share/radare2/plugins/r2dec-js"); // appdir/share/radare2/plugins/r2dec-js
|
r2decHome.cd("share/radare2/plugins/r2dec-js"); // appdir/share/radare2/plugins/r2dec-js
|
||||||
@ -162,15 +162,15 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
|
|||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
{
|
{
|
||||||
auto r2prefix = QDir(QCoreApplication::applicationDirPath()); // Contents/MacOS
|
auto rzprefix = QDir(QCoreApplication::applicationDirPath()); // Contents/MacOS
|
||||||
r2prefix.cdUp(); // Contents
|
rzprefix.cdUp(); // Contents
|
||||||
r2prefix.cd("Resources/r2"); // Contents/Resources/r2
|
rzprefix.cd("Resources/r2"); // Contents/Resources/r2
|
||||||
|
|
||||||
auto sleighHome = r2prefix;
|
auto sleighHome = rzprefix;
|
||||||
sleighHome.cd("share/radare2/plugins/r2ghidra_sleigh"); // Contents/Resources/r2/share/radare2/plugins/r2ghidra_sleigh
|
sleighHome.cd("share/radare2/plugins/rz_ghidra_sleigh"); // Contents/Resources/r2/share/radare2/plugins/rz_ghidra_sleigh
|
||||||
Core()->setConfig("r2ghidra.sleighhome", sleighHome.absolutePath());
|
Core()->setConfig("ghidra.sleighhome", sleighHome.absolutePath());
|
||||||
|
|
||||||
auto r2decHome = r2prefix;
|
auto r2decHome = rzprefix;
|
||||||
r2decHome.cd("share/radare2/plugins/r2dec-js"); // Contents/Resources/r2/share/radare2/plugins/r2dec-js
|
r2decHome.cd("share/radare2/plugins/r2dec-js"); // Contents/Resources/r2/share/radare2/plugins/r2dec-js
|
||||||
qputenv("R2DEC_HOME", r2decHome.absolutePath().toLocal8Bit());
|
qputenv("R2DEC_HOME", r2decHome.absolutePath().toLocal8Bit());
|
||||||
}
|
}
|
||||||
@ -182,8 +182,8 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
|
|||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
{
|
{
|
||||||
auto sleighHome = QDir(QCoreApplication::applicationDirPath());
|
auto sleighHome = QDir(QCoreApplication::applicationDirPath());
|
||||||
sleighHome.cd("lib/plugins/r2ghidra_sleigh");
|
sleighHome.cd("lib/plugins/rz_ghidra_sleigh");
|
||||||
Core()->setConfig("r2ghidra.sleighhome", sleighHome.absolutePath());
|
Core()->setConfig("ghidra.sleighhome", sleighHome.absolutePath());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ int main(int argc, char *argv[])
|
|||||||
qRegisterMetaType<QList<StringDescription>>();
|
qRegisterMetaType<QList<StringDescription>>();
|
||||||
qRegisterMetaType<QList<FunctionDescription>>();
|
qRegisterMetaType<QList<FunctionDescription>>();
|
||||||
|
|
||||||
QCoreApplication::setOrganizationName("RadareOrg");
|
QCoreApplication::setOrganizationName("RizinOrg");
|
||||||
QCoreApplication::setApplicationName("Cutter");
|
QCoreApplication::setApplicationName("Cutter");
|
||||||
|
|
||||||
Cutter::initializeSettings();
|
Cutter::initializeSettings();
|
||||||
|
@ -1,74 +0,0 @@
|
|||||||
|
|
||||||
include(ExternalProject)
|
|
||||||
|
|
||||||
set(RADARE2_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../radare2")
|
|
||||||
if(WIN32)
|
|
||||||
set(RADARE2_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}")
|
|
||||||
if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
|
|
||||||
set(RADARE2_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>")
|
|
||||||
endif()
|
|
||||||
set(RADARE2_INSTALL_BINPATH ".")
|
|
||||||
set(MESON_OPTIONS "--prefix=${RADARE2_INSTALL_DIR}" "--bindir=${RADARE2_INSTALL_BINPATH}" "-Dr2_incdir=include/libr")
|
|
||||||
else()
|
|
||||||
set(RADARE2_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/Radare2-prefix")
|
|
||||||
set(MESON_OPTIONS "--prefix=${RADARE2_INSTALL_DIR}" --libdir=lib)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_program(MESON meson)
|
|
||||||
if(NOT MESON)
|
|
||||||
message(FATAL_ERROR "Failed to find meson, which is required to build bundled radare2")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_program(NINJA ninja)
|
|
||||||
if(NOT NINJA)
|
|
||||||
message(FATAL_ERROR "Failed to find ninja, which is required to build bundled radare2")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
ExternalProject_Add(Radare2-Bundled
|
|
||||||
SOURCE_DIR "${RADARE2_SOURCE_DIR}"
|
|
||||||
CONFIGURE_COMMAND "${MESON}" "<SOURCE_DIR>" ${MESON_OPTIONS} && "${MESON}" configure ${MESON_OPTIONS} --buildtype "$<$<CONFIG:Debug>:debug>$<$<NOT:$<CONFIG:Debug>>:release>"
|
|
||||||
BUILD_COMMAND "${NINJA}"
|
|
||||||
INSTALL_COMMAND "${NINJA}" install)
|
|
||||||
|
|
||||||
set(Radare2_INCLUDE_DIRS "${RADARE2_INSTALL_DIR}/include/libr" "${RADARE2_INSTALL_DIR}/include/libr/sdb")
|
|
||||||
|
|
||||||
add_library(Radare2 INTERFACE)
|
|
||||||
add_dependencies(Radare2 Radare2-Bundled)
|
|
||||||
if(NOT (${CMAKE_VERSION} VERSION_LESS "3.13.0"))
|
|
||||||
target_link_directories(Radare2 INTERFACE
|
|
||||||
$<BUILD_INTERFACE:${RADARE2_INSTALL_DIR}/lib>
|
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_LIBDIR}>)
|
|
||||||
else()
|
|
||||||
link_directories("${RADARE2_INSTALL_DIR}/lib")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set (R2_LIBS r_core r_config r_cons r_io r_util r_flag r_asm r_debug
|
|
||||||
r_hash r_bin r_lang r_io r_anal r_parse r_bp r_egg r_reg
|
|
||||||
r_search r_syscall r_socket r_fs r_magic r_crypto)
|
|
||||||
set (R2_EXTRA_LIBS r_main)
|
|
||||||
set (R2_BIN r2agent rabin2 radare2 radiff2 rafind2 ragg2 rahash2 rarun2 rasm2 rax2)
|
|
||||||
|
|
||||||
target_link_libraries(Radare2 INTERFACE
|
|
||||||
${R2_LIBS})
|
|
||||||
target_include_directories(Radare2 INTERFACE
|
|
||||||
"$<BUILD_INTERFACE:${Radare2_INCLUDE_DIRS}>"
|
|
||||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/libr>")
|
|
||||||
|
|
||||||
install(TARGETS Radare2 EXPORT CutterTargets)
|
|
||||||
if (APPLE)
|
|
||||||
elseif (WIN32)
|
|
||||||
foreach(_lib ${R2_LIBS} ${R2_EXTRA_LIBS})
|
|
||||||
install(FILES "${RADARE2_INSTALL_DIR}/${R2_INSTALL_BINPATH}/${_lib}.dll" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
|
||||||
endforeach()
|
|
||||||
foreach(_exe ${R2_BIN})
|
|
||||||
install(FILES "${RADARE2_INSTALL_DIR}/${R2_INSTALL_BINPATH}/${_exe}.exe" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
|
||||||
endforeach()
|
|
||||||
install(DIRECTORY "${RADARE2_INSTALL_DIR}/share" DESTINATION ".")
|
|
||||||
install(DIRECTORY "${RADARE2_INSTALL_DIR}/include" DESTINATION "."
|
|
||||||
COMPONENT Devel)
|
|
||||||
install(DIRECTORY "${RADARE2_INSTALL_DIR}/lib" DESTINATION "."
|
|
||||||
COMPONENT Devel
|
|
||||||
PATTERN "*.pdb" EXCLUDE)
|
|
||||||
else ()
|
|
||||||
install(DIRECTORY "${RADARE2_INSTALL_DIR}/" DESTINATION ".")
|
|
||||||
endif()
|
|
74
src/cmake/BundledRizin.cmake
Normal file
74
src/cmake/BundledRizin.cmake
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
|
||||||
|
include(ExternalProject)
|
||||||
|
|
||||||
|
set(RIZIN_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../rizin")
|
||||||
|
if(WIN32)
|
||||||
|
set(RIZIN_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
|
||||||
|
set(RIZIN_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>")
|
||||||
|
endif()
|
||||||
|
set(RIZIN_INSTALL_BINPATH ".")
|
||||||
|
set(MESON_OPTIONS "--prefix=${RIZIN_INSTALL_DIR}" "--bindir=${RIZIN_INSTALL_BINPATH}" "-Dr2_incdir=include/librz")
|
||||||
|
else()
|
||||||
|
set(RIZIN_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/Rizin-prefix")
|
||||||
|
set(MESON_OPTIONS "--prefix=${RIZIN_INSTALL_DIR}" --libdir=lib)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_program(MESON meson)
|
||||||
|
if(NOT MESON)
|
||||||
|
message(FATAL_ERROR "Failed to find meson, which is required to build bundled rizin")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_program(NINJA ninja)
|
||||||
|
if(NOT NINJA)
|
||||||
|
message(FATAL_ERROR "Failed to find ninja, which is required to build bundled rizin")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
ExternalProject_Add(Rizin-Bundled
|
||||||
|
SOURCE_DIR "${RIZIN_SOURCE_DIR}"
|
||||||
|
CONFIGURE_COMMAND "${MESON}" "<SOURCE_DIR>" ${MESON_OPTIONS} && "${MESON}" configure ${MESON_OPTIONS} --buildtype "$<$<CONFIG:Debug>:debug>$<$<NOT:$<CONFIG:Debug>>:release>"
|
||||||
|
BUILD_COMMAND "${NINJA}"
|
||||||
|
INSTALL_COMMAND "${NINJA}" install)
|
||||||
|
|
||||||
|
set(Rizin_INCLUDE_DIRS "${RIZIN_INSTALL_DIR}/include/librz" "${RIZIN_INSTALL_DIR}/include/librz/sdb")
|
||||||
|
|
||||||
|
add_library(Rizin INTERFACE)
|
||||||
|
add_dependencies(Rizin Rizin-Bundled)
|
||||||
|
if(NOT (${CMAKE_VERSION} VERSION_LESS "3.13.0"))
|
||||||
|
target_link_directories(Rizin INTERFACE
|
||||||
|
$<BUILD_INTERFACE:${RIZIN_INSTALL_DIR}/lib>
|
||||||
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_LIBDIR}>)
|
||||||
|
else()
|
||||||
|
link_directories("${RIZIN_INSTALL_DIR}/lib")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set (R2_LIBS rz_core rz_config rz_cons rz_io rz_util rz_flag rz_asm rz_debug
|
||||||
|
rz_hash rz_bin rz_lang rz_io rz_anal rz_parse rz_bp rz_egg rz_reg
|
||||||
|
rz_search rz_syscall rz_socket rz_magic rz_crypto)
|
||||||
|
set (R2_EXTRA_LIBS rz_main)
|
||||||
|
set (R2_BIN r2agent rabin2 rizin radiff2 rafind2 ragg2 rahash2 rarun2 rasm2 rax2)
|
||||||
|
|
||||||
|
target_link_libraries(Rizin INTERFACE
|
||||||
|
${R2_LIBS})
|
||||||
|
target_include_directories(Rizin INTERFACE
|
||||||
|
"$<BUILD_INTERFACE:${Rizin_INCLUDE_DIRS}>"
|
||||||
|
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/librz>")
|
||||||
|
|
||||||
|
install(TARGETS Rizin EXPORT CutterTargets)
|
||||||
|
if (APPLE)
|
||||||
|
elseif (WIN32)
|
||||||
|
foreach(_lib ${R2_LIBS} ${R2_EXTRA_LIBS})
|
||||||
|
install(FILES "${RIZIN_INSTALL_DIR}/${R2_INSTALL_BINPATH}/${_lib}.dll" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||||
|
endforeach()
|
||||||
|
foreach(_exe ${R2_BIN})
|
||||||
|
install(FILES "${RIZIN_INSTALL_DIR}/${R2_INSTALL_BINPATH}/${_exe}.exe" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||||
|
endforeach()
|
||||||
|
install(DIRECTORY "${RIZIN_INSTALL_DIR}/share" DESTINATION ".")
|
||||||
|
install(DIRECTORY "${RIZIN_INSTALL_DIR}/include" DESTINATION "."
|
||||||
|
COMPONENT Devel)
|
||||||
|
install(DIRECTORY "${RIZIN_INSTALL_DIR}/lib" DESTINATION "."
|
||||||
|
COMPONENT Devel
|
||||||
|
PATTERN "*.pdb" EXCLUDE)
|
||||||
|
else ()
|
||||||
|
install(DIRECTORY "${RIZIN_INSTALL_DIR}/" DESTINATION ".")
|
||||||
|
endif()
|
@ -1,4 +1,4 @@
|
|||||||
set(CUTTER_DIR_NAME "RadareOrg/Cutter")
|
set(CUTTER_DIR_NAME "RizinOrg/Cutter")
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(CMAKE_INSTALL_BINDIR "." CACHE PATH "Executable install directory")
|
set(CMAKE_INSTALL_BINDIR "." CACHE PATH "Executable install directory")
|
||||||
set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "Include install directory")
|
set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "Include install directory")
|
||||||
|
@ -1,117 +0,0 @@
|
|||||||
# - Find Radare2 (libr)
|
|
||||||
#
|
|
||||||
# This module provides the following imported targets, if found:
|
|
||||||
#
|
|
||||||
# Radare2::libr
|
|
||||||
#
|
|
||||||
# This will define the following variables:
|
|
||||||
# (but don't use them if you don't know what you are doing, use Radare2::libr)
|
|
||||||
#
|
|
||||||
# Radare2_FOUND - True if libr has been found.
|
|
||||||
# Radare2_INCLUDE_DIRS - libr include directory
|
|
||||||
# Radare2_LIBRARIES - List of libraries when using libr.
|
|
||||||
# Radare2_LIBRARY_DIRS - libr library directories
|
|
||||||
#
|
|
||||||
# If libr was found using find_library and not pkg-config, the following variables will also be set:
|
|
||||||
# Radare2_LIBRARY_<name> - Path to library r_<name>
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
find_path(Radare2_INCLUDE_DIRS
|
|
||||||
NAMES r_core.h r_bin.h r_util.h
|
|
||||||
HINTS
|
|
||||||
"$ENV{HOME}/bin/prefix/radare2/include/libr"
|
|
||||||
/usr/local/include/libr
|
|
||||||
/usr/include/libr)
|
|
||||||
find_path(SDB_INCLUDE_DIR
|
|
||||||
NAMES sdb.h sdbht.h sdb_version.h
|
|
||||||
HINTS
|
|
||||||
"$ENV{HOME}/bin/prefix/radare2/include/libr/sdb"
|
|
||||||
/usr/local/include/libr/sdb
|
|
||||||
/usr/include/libr/sdb)
|
|
||||||
|
|
||||||
list(APPEND Radare2_INCLUDE_DIRS ${SDB_INCLUDE_DIR})
|
|
||||||
|
|
||||||
set(Radare2_LIBRARY_NAMES
|
|
||||||
core
|
|
||||||
config
|
|
||||||
cons
|
|
||||||
io
|
|
||||||
util
|
|
||||||
flag
|
|
||||||
asm
|
|
||||||
debug
|
|
||||||
hash
|
|
||||||
bin
|
|
||||||
lang
|
|
||||||
io
|
|
||||||
anal
|
|
||||||
parse
|
|
||||||
bp
|
|
||||||
egg
|
|
||||||
reg
|
|
||||||
search
|
|
||||||
syscall
|
|
||||||
socket
|
|
||||||
fs
|
|
||||||
magic
|
|
||||||
crypto)
|
|
||||||
|
|
||||||
set(Radare2_LIBRARIES "")
|
|
||||||
set(Radare2_LIBRARIES_VARS "")
|
|
||||||
foreach(libname ${Radare2_LIBRARY_NAMES})
|
|
||||||
find_library(Radare2_LIBRARY_${libname}
|
|
||||||
r_${libname}
|
|
||||||
HINTS
|
|
||||||
"$ENV{HOME}/bin/prefix/radare2/lib"
|
|
||||||
/usr/local/lib
|
|
||||||
/usr/lib)
|
|
||||||
|
|
||||||
list(APPEND Radare2_LIBRARIES ${Radare2_LIBRARY_${libname}})
|
|
||||||
list(APPEND Radare2_LIBRARIES_VARS "Radare2_LIBRARY_${libname}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
set(Radare2_LIBRARY_DIRS "")
|
|
||||||
|
|
||||||
add_library(Radare2::libr UNKNOWN IMPORTED)
|
|
||||||
set_target_properties(Radare2::libr PROPERTIES
|
|
||||||
IMPORTED_LOCATION "${Radare2_LIBRARY_core}"
|
|
||||||
IMPORTED_LINK_INTERFACE_LIBRARIES "${Radare2_LIBRARIES}"
|
|
||||||
INTERFACE_LINK_DIRECTORIES "${Radare2_LIBRARY_DIRS}"
|
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${Radare2_INCLUDE_DIRS}")
|
|
||||||
set(Radare2_TARGET Radare2::libr)
|
|
||||||
else()
|
|
||||||
# support installation locations used by r2 scripts like sys/user.sh and sys/install.sh
|
|
||||||
if(CUTTER_USE_ADDITIONAL_RADARE2_PATHS)
|
|
||||||
set(Radare2_CMAKE_PREFIX_PATH_TEMP ${CMAKE_PREFIX_PATH})
|
|
||||||
list(APPEND CMAKE_PREFIX_PATH "$ENV{HOME}/bin/prefix/radare2") # sys/user.sh
|
|
||||||
list(APPEND CMAKE_PREFIX_PATH "/usr/local") # sys/install.sh
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_package(PkgConfig REQUIRED)
|
|
||||||
if(CMAKE_VERSION VERSION_LESS "3.6")
|
|
||||||
pkg_search_module(Radare2 REQUIRED r_core)
|
|
||||||
else()
|
|
||||||
pkg_search_module(Radare2 IMPORTED_TARGET REQUIRED r_core)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# reset CMAKE_PREFIX_PATH
|
|
||||||
if(CUTTER_USE_ADDITIONAL_RADARE2_PATHS)
|
|
||||||
set(CMAKE_PREFIX_PATH ${Radare2_CMAKE_PREFIX_PATH_TEMP})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if((TARGET PkgConfig::Radare2) AND (NOT CMAKE_VERSION VERSION_LESS "3.11.0"))
|
|
||||||
set_target_properties(PkgConfig::Radare2 PROPERTIES IMPORTED_GLOBAL ON)
|
|
||||||
add_library(Radare2::libr ALIAS PkgConfig::Radare2)
|
|
||||||
set(Radare2_TARGET Radare2::libr)
|
|
||||||
elseif(Radare2_FOUND)
|
|
||||||
add_library(Radare2::libr INTERFACE IMPORTED)
|
|
||||||
set_target_properties(Radare2::libr PROPERTIES
|
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${Radare2_INCLUDE_DIRS}")
|
|
||||||
set_target_properties(Radare2::libr PROPERTIES
|
|
||||||
INTERFACE_LINK_LIBRARIES "${Radare2_LIBRARIES}")
|
|
||||||
set(Radare2_TARGET Radare2::libr)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
find_package_handle_standard_args(Radare2 REQUIRED_VARS Radare2_TARGET Radare2_LIBRARIES Radare2_INCLUDE_DIRS)
|
|
116
src/cmake/FindRizin.cmake
Normal file
116
src/cmake/FindRizin.cmake
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
# - Find Rizin (librz)
|
||||||
|
#
|
||||||
|
# This module provides the following imported targets, if found:
|
||||||
|
#
|
||||||
|
# Rizin::librz
|
||||||
|
#
|
||||||
|
# This will define the following variables:
|
||||||
|
# (but don't use them if you don't know what you are doing, use Rizin::librz)
|
||||||
|
#
|
||||||
|
# Rizin_FOUND - True if librz has been found.
|
||||||
|
# Rizin_INCLUDE_DIRS - librz include directory
|
||||||
|
# Rizin_LIBRARIES - List of libraries when using librz.
|
||||||
|
# Rizin_LIBRARY_DIRS - librz library directories
|
||||||
|
#
|
||||||
|
# If librz was found using find_library and not pkg-config, the following variables will also be set:
|
||||||
|
# Rizin_LIBRARY_<name> - Path to library rz_<name>
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
find_path(Rizin_INCLUDE_DIRS
|
||||||
|
NAMES rz_core.h rz_bin.h rz_util.h
|
||||||
|
HINTS
|
||||||
|
"$ENV{HOME}/bin/prefix/rizin/include/librz"
|
||||||
|
/usr/local/include/libr
|
||||||
|
/usr/include/librz)
|
||||||
|
find_path(SDB_INCLUDE_DIR
|
||||||
|
NAMES sdb.h sdbht.h sdb_version.h
|
||||||
|
HINTS
|
||||||
|
"$ENV{HOME}/bin/prefix/rizin/include/librz/sdb"
|
||||||
|
/usr/local/include/librz/sdb
|
||||||
|
/usr/include/librz/sdb)
|
||||||
|
|
||||||
|
list(APPEND Rizin_INCLUDE_DIRS ${SDB_INCLUDE_DIR})
|
||||||
|
|
||||||
|
set(Rizin_LIBRARY_NAMES
|
||||||
|
core
|
||||||
|
config
|
||||||
|
cons
|
||||||
|
io
|
||||||
|
util
|
||||||
|
flag
|
||||||
|
asm
|
||||||
|
debug
|
||||||
|
hash
|
||||||
|
bin
|
||||||
|
lang
|
||||||
|
io
|
||||||
|
anal
|
||||||
|
parse
|
||||||
|
bp
|
||||||
|
egg
|
||||||
|
reg
|
||||||
|
search
|
||||||
|
syscall
|
||||||
|
socket
|
||||||
|
magic
|
||||||
|
crypto)
|
||||||
|
|
||||||
|
set(Rizin_LIBRARIES "")
|
||||||
|
set(Rizin_LIBRARIES_VARS "")
|
||||||
|
foreach(libname ${Rizin_LIBRARY_NAMES})
|
||||||
|
find_library(Rizin_LIBRARY_${libname}
|
||||||
|
r_${libname}
|
||||||
|
HINTS
|
||||||
|
"$ENV{HOME}/bin/prefix/rizin/lib"
|
||||||
|
/usr/local/lib
|
||||||
|
/usr/lib)
|
||||||
|
|
||||||
|
list(APPEND Rizin_LIBRARIES ${Rizin_LIBRARY_${libname}})
|
||||||
|
list(APPEND Rizin_LIBRARIES_VARS "Rizin_LIBRARY_${libname}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set(Rizin_LIBRARY_DIRS "")
|
||||||
|
|
||||||
|
add_library(Rizin::librz UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(Rizin::librz PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${Rizin_LIBRARY_core}"
|
||||||
|
IMPORTED_LINK_INTERFACE_LIBRARIES "${Rizin_LIBRARIES}"
|
||||||
|
INTERFACE_LINK_DIRECTORIES "${Rizin_LIBRARY_DIRS}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${Rizin_INCLUDE_DIRS}")
|
||||||
|
set(Rizin_TARGET Rizin::librz)
|
||||||
|
else()
|
||||||
|
# support installation locations used by r2 scripts like sys/user.sh and sys/install.sh
|
||||||
|
if(CUTTER_USE_ADDITIONAL_RIZIN_PATHS)
|
||||||
|
set(Rizin_CMAKE_PREFIX_PATH_TEMP ${CMAKE_PREFIX_PATH})
|
||||||
|
list(APPEND CMAKE_PREFIX_PATH "$ENV{HOME}/bin/prefix/rizin") # sys/user.sh
|
||||||
|
list(APPEND CMAKE_PREFIX_PATH "/usr/local") # sys/install.sh
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
if(CMAKE_VERSION VERSION_LESS "3.6")
|
||||||
|
pkg_search_module(Rizin REQUIRED rz_core)
|
||||||
|
else()
|
||||||
|
pkg_search_module(Rizin IMPORTED_TARGET REQUIRED rz_core)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# reset CMAKE_PREFIX_PATH
|
||||||
|
if(CUTTER_USE_ADDITIONAL_RIZIN_PATHS)
|
||||||
|
set(CMAKE_PREFIX_PATH ${Rizin_CMAKE_PREFIX_PATH_TEMP})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if((TARGET PkgConfig::Rizin) AND (NOT CMAKE_VERSION VERSION_LESS "3.11.0"))
|
||||||
|
set_target_properties(PkgConfig::Rizin PROPERTIES IMPORTED_GLOBAL ON)
|
||||||
|
add_library(Rizin::librz ALIAS PkgConfig::Rizin)
|
||||||
|
set(Rizin_TARGET Rizin::librz)
|
||||||
|
elseif(Rizin_FOUND)
|
||||||
|
add_library(Rizin::librz INTERFACE IMPORTED)
|
||||||
|
set_target_properties(Rizin::librz PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${Rizin_INCLUDE_DIRS}")
|
||||||
|
set_target_properties(Rizin::librz PROPERTIES
|
||||||
|
INTERFACE_LINK_LIBRARIES "${Rizin_LIBRARIES}")
|
||||||
|
set(Rizin_TARGET Rizin::librz)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(Rizin REQUIRED_VARS Rizin_TARGET Rizin_LIBRARIES Rizin_INCLUDE_DIRS)
|
@ -18,7 +18,7 @@ AnalTask::~AnalTask()
|
|||||||
void AnalTask::interrupt()
|
void AnalTask::interrupt()
|
||||||
{
|
{
|
||||||
AsyncTask::interrupt();
|
AsyncTask::interrupt();
|
||||||
r_cons_singleton()->context->breaked = true;
|
rz_cons_singleton()->context->breaked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AnalTask::getTitle() {
|
QString AnalTask::getTitle() {
|
||||||
@ -32,9 +32,9 @@ QString AnalTask::getTitle() {
|
|||||||
|
|
||||||
void AnalTask::runTask()
|
void AnalTask::runTask()
|
||||||
{
|
{
|
||||||
int perms = R_PERM_RX;
|
int perms = RZ_PERM_RX;
|
||||||
if (options.writeEnabled) {
|
if (options.writeEnabled) {
|
||||||
perms |= R_PERM_W;
|
perms |= RZ_PERM_W;
|
||||||
emit Core()->ioModeChanged();
|
emit Core()->ioModeChanged();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ void AnalTask::runTask()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// r_core_bin_load might change asm.bits, so let's set that after the bin is loaded
|
// rz_core_bin_load might change asm.bits, so let's set that after the bin is loaded
|
||||||
Core()->setCPU(options.arch, options.cpu, options.bits);
|
Core()->setCPU(options.arch, options.cpu, options.bits);
|
||||||
|
|
||||||
if (isInterrupted()) {
|
if (isInterrupted()) {
|
||||||
@ -103,9 +103,6 @@ void AnalTask::runTask()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use prj.simple as default as long as regular projects are broken
|
|
||||||
Core()->setConfig("prj.simple", true);
|
|
||||||
|
|
||||||
if (!options.analCmd.empty()) {
|
if (!options.analCmd.empty()) {
|
||||||
log(tr("Executing analysis..."));
|
log(tr("Executing analysis..."));
|
||||||
for (const CommandDescription &cmd : options.analCmd) {
|
for (const CommandDescription &cmd : options.analCmd) {
|
||||||
|
@ -59,17 +59,17 @@ const QStringList ColorThemeWorker::radare2UnusedOptions = {
|
|||||||
|
|
||||||
ColorThemeWorker::ColorThemeWorker(QObject *parent) : QObject (parent)
|
ColorThemeWorker::ColorThemeWorker(QObject *parent) : QObject (parent)
|
||||||
{
|
{
|
||||||
char* szThemes = r_str_home(R2_HOME_THEMES);
|
char* szThemes = rz_str_home(RZ_HOME_THEMES);
|
||||||
customR2ThemesLocationPath = szThemes;
|
customR2ThemesLocationPath = szThemes;
|
||||||
r_mem_free(szThemes);
|
rz_mem_free(szThemes);
|
||||||
if (!QDir(customR2ThemesLocationPath).exists()) {
|
if (!QDir(customR2ThemesLocationPath).exists()) {
|
||||||
QDir().mkpath(customR2ThemesLocationPath);
|
QDir().mkpath(customR2ThemesLocationPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
QDir currDir { QStringLiteral("%1%2%3")
|
QDir currDir { QStringLiteral("%1%2%3")
|
||||||
.arg(r_sys_prefix(nullptr))
|
.arg(rz_sys_prefix(nullptr))
|
||||||
.arg(R_SYS_DIR)
|
.arg(RZ_SYS_DIR)
|
||||||
.arg(R2_THEMES)
|
.arg(RZ_THEMES)
|
||||||
};
|
};
|
||||||
if (currDir.exists()) {
|
if (currDir.exists()) {
|
||||||
standardR2ThemesLocationPath = currDir.absolutePath();
|
standardR2ThemesLocationPath = currDir.absolutePath();
|
||||||
|
@ -22,81 +22,81 @@ void Colors::colorizeAssembly(RichTextPainter::List &list, QString opcode, ut64
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Temporary solution
|
// Temporary solution
|
||||||
// Copied from R_API const char* r_print_color_op_type(RPrint *p, ut64 anal_type) {
|
// Copied from RZ_API const char* r_print_color_op_type(RPrint *p, ut64 anal_type) {
|
||||||
QString Colors::getColor(ut64 type)
|
QString Colors::getColor(ut64 type)
|
||||||
{
|
{
|
||||||
switch (type & R_ANAL_OP_TYPE_MASK) {
|
switch (type & RZ_ANAL_OP_TYPE_MASK) {
|
||||||
case R_ANAL_OP_TYPE_NOP:
|
case RZ_ANAL_OP_TYPE_NOP:
|
||||||
return "nop";
|
return "nop";
|
||||||
case R_ANAL_OP_TYPE_ADD:
|
case RZ_ANAL_OP_TYPE_ADD:
|
||||||
case R_ANAL_OP_TYPE_SUB:
|
case RZ_ANAL_OP_TYPE_SUB:
|
||||||
case R_ANAL_OP_TYPE_MUL:
|
case RZ_ANAL_OP_TYPE_MUL:
|
||||||
case R_ANAL_OP_TYPE_DIV:
|
case RZ_ANAL_OP_TYPE_DIV:
|
||||||
case R_ANAL_OP_TYPE_MOD:
|
case RZ_ANAL_OP_TYPE_MOD:
|
||||||
case R_ANAL_OP_TYPE_LENGTH:
|
case RZ_ANAL_OP_TYPE_LENGTH:
|
||||||
return "math";
|
return "math";
|
||||||
case R_ANAL_OP_TYPE_AND:
|
case RZ_ANAL_OP_TYPE_AND:
|
||||||
case R_ANAL_OP_TYPE_OR:
|
case RZ_ANAL_OP_TYPE_OR:
|
||||||
case R_ANAL_OP_TYPE_XOR:
|
case RZ_ANAL_OP_TYPE_XOR:
|
||||||
case R_ANAL_OP_TYPE_NOT:
|
case RZ_ANAL_OP_TYPE_NOT:
|
||||||
case R_ANAL_OP_TYPE_SHL:
|
case RZ_ANAL_OP_TYPE_SHL:
|
||||||
case R_ANAL_OP_TYPE_SAL:
|
case RZ_ANAL_OP_TYPE_SAL:
|
||||||
case R_ANAL_OP_TYPE_SAR:
|
case RZ_ANAL_OP_TYPE_SAR:
|
||||||
case R_ANAL_OP_TYPE_SHR:
|
case RZ_ANAL_OP_TYPE_SHR:
|
||||||
case R_ANAL_OP_TYPE_ROL:
|
case RZ_ANAL_OP_TYPE_ROL:
|
||||||
case R_ANAL_OP_TYPE_ROR:
|
case RZ_ANAL_OP_TYPE_ROR:
|
||||||
case R_ANAL_OP_TYPE_CPL:
|
case RZ_ANAL_OP_TYPE_CPL:
|
||||||
return "bin";
|
return "bin";
|
||||||
case R_ANAL_OP_TYPE_IO:
|
case RZ_ANAL_OP_TYPE_IO:
|
||||||
return "swi";
|
return "swi";
|
||||||
case R_ANAL_OP_TYPE_JMP:
|
case RZ_ANAL_OP_TYPE_JMP:
|
||||||
case R_ANAL_OP_TYPE_UJMP:
|
case RZ_ANAL_OP_TYPE_UJMP:
|
||||||
case R_ANAL_OP_TYPE_IJMP:
|
case RZ_ANAL_OP_TYPE_IJMP:
|
||||||
case R_ANAL_OP_TYPE_RJMP:
|
case RZ_ANAL_OP_TYPE_RJMP:
|
||||||
case R_ANAL_OP_TYPE_IRJMP:
|
case RZ_ANAL_OP_TYPE_IRJMP:
|
||||||
case R_ANAL_OP_TYPE_MJMP:
|
case RZ_ANAL_OP_TYPE_MJMP:
|
||||||
return "jmp";
|
return "jmp";
|
||||||
case R_ANAL_OP_TYPE_CJMP:
|
case RZ_ANAL_OP_TYPE_CJMP:
|
||||||
case R_ANAL_OP_TYPE_UCJMP:
|
case RZ_ANAL_OP_TYPE_UCJMP:
|
||||||
case R_ANAL_OP_TYPE_SWITCH:
|
case RZ_ANAL_OP_TYPE_SWITCH:
|
||||||
return "cjmp";
|
return "cjmp";
|
||||||
case R_ANAL_OP_TYPE_CMP:
|
case RZ_ANAL_OP_TYPE_CMP:
|
||||||
case R_ANAL_OP_TYPE_ACMP:
|
case RZ_ANAL_OP_TYPE_ACMP:
|
||||||
return "cmp";
|
return "cmp";
|
||||||
case R_ANAL_OP_TYPE_UCALL:
|
case RZ_ANAL_OP_TYPE_UCALL:
|
||||||
case R_ANAL_OP_TYPE_ICALL:
|
case RZ_ANAL_OP_TYPE_ICALL:
|
||||||
case R_ANAL_OP_TYPE_RCALL:
|
case RZ_ANAL_OP_TYPE_RCALL:
|
||||||
case R_ANAL_OP_TYPE_IRCALL:
|
case RZ_ANAL_OP_TYPE_IRCALL:
|
||||||
case R_ANAL_OP_TYPE_UCCALL:
|
case RZ_ANAL_OP_TYPE_UCCALL:
|
||||||
case R_ANAL_OP_TYPE_CALL:
|
case RZ_ANAL_OP_TYPE_CALL:
|
||||||
case R_ANAL_OP_TYPE_CCALL:
|
case RZ_ANAL_OP_TYPE_CCALL:
|
||||||
return "call";
|
return "call";
|
||||||
case R_ANAL_OP_TYPE_NEW:
|
case RZ_ANAL_OP_TYPE_NEW:
|
||||||
case R_ANAL_OP_TYPE_SWI:
|
case RZ_ANAL_OP_TYPE_SWI:
|
||||||
return "swi";
|
return "swi";
|
||||||
case R_ANAL_OP_TYPE_ILL:
|
case RZ_ANAL_OP_TYPE_ILL:
|
||||||
case R_ANAL_OP_TYPE_TRAP:
|
case RZ_ANAL_OP_TYPE_TRAP:
|
||||||
return "trap";
|
return "trap";
|
||||||
case R_ANAL_OP_TYPE_CRET:
|
case RZ_ANAL_OP_TYPE_CRET:
|
||||||
case R_ANAL_OP_TYPE_RET:
|
case RZ_ANAL_OP_TYPE_RET:
|
||||||
return "ret";
|
return "ret";
|
||||||
case R_ANAL_OP_TYPE_CAST:
|
case RZ_ANAL_OP_TYPE_CAST:
|
||||||
case R_ANAL_OP_TYPE_MOV:
|
case RZ_ANAL_OP_TYPE_MOV:
|
||||||
case R_ANAL_OP_TYPE_LEA:
|
case RZ_ANAL_OP_TYPE_LEA:
|
||||||
case R_ANAL_OP_TYPE_CMOV: // TODO: add cmov cathegory?
|
case RZ_ANAL_OP_TYPE_CMOV: // TODO: add cmov cathegory?
|
||||||
return "mov";
|
return "mov";
|
||||||
case R_ANAL_OP_TYPE_PUSH:
|
case RZ_ANAL_OP_TYPE_PUSH:
|
||||||
case R_ANAL_OP_TYPE_UPUSH:
|
case RZ_ANAL_OP_TYPE_UPUSH:
|
||||||
case R_ANAL_OP_TYPE_LOAD:
|
case RZ_ANAL_OP_TYPE_LOAD:
|
||||||
return "push";
|
return "push";
|
||||||
case R_ANAL_OP_TYPE_POP:
|
case RZ_ANAL_OP_TYPE_POP:
|
||||||
case R_ANAL_OP_TYPE_STORE:
|
case RZ_ANAL_OP_TYPE_STORE:
|
||||||
return "pop";
|
return "pop";
|
||||||
case R_ANAL_OP_TYPE_CRYPTO:
|
case RZ_ANAL_OP_TYPE_CRYPTO:
|
||||||
return "crypto";
|
return "crypto";
|
||||||
case R_ANAL_OP_TYPE_NULL:
|
case RZ_ANAL_OP_TYPE_NULL:
|
||||||
return "other";
|
return "other";
|
||||||
case R_ANAL_OP_TYPE_UNK:
|
case RZ_ANAL_OP_TYPE_UNK:
|
||||||
default:
|
default:
|
||||||
return "invalid";
|
return "invalid";
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "core/Cutter.h"
|
#include "core/Cutter.h"
|
||||||
#include "common/RichTextPainter.h"
|
#include "common/RichTextPainter.h"
|
||||||
#include <r_anal.h>
|
#include <rz_anal.h>
|
||||||
|
|
||||||
class Colors
|
class Colors
|
||||||
{
|
{
|
||||||
|
@ -122,7 +122,7 @@ static const QHash<QString, QVariant> asmOptions = {
|
|||||||
{ "asm.ucase", false },
|
{ "asm.ucase", false },
|
||||||
{ "asm.bb.line", false },
|
{ "asm.bb.line", false },
|
||||||
{ "asm.capitalize", false },
|
{ "asm.capitalize", false },
|
||||||
{ "asm.var.sub", true },
|
{ "asm.sub.var", true },
|
||||||
{ "asm.sub.varonly", true },
|
{ "asm.sub.varonly", true },
|
||||||
{ "asm.tabs", 8 },
|
{ "asm.tabs", 8 },
|
||||||
{ "asm.tabs.off", 5 },
|
{ "asm.tabs.off", 5 },
|
||||||
|
@ -12,9 +12,9 @@ Decompiler::Decompiler(const QString &id, const QString &name, QObject *parent)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
RAnnotatedCode *Decompiler::makeWarning(QString warningMessage){
|
RzAnnotatedCode *Decompiler::makeWarning(QString warningMessage){
|
||||||
std::string temporary = warningMessage.toStdString();
|
std::string temporary = warningMessage.toStdString();
|
||||||
return r_annotated_code_new(strdup(temporary.c_str()));
|
return rz_annotated_code_new(strdup(temporary.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
R2DecDecompiler::R2DecDecompiler(QObject *parent)
|
R2DecDecompiler::R2DecDecompiler(QObject *parent)
|
||||||
@ -42,7 +42,7 @@ void R2DecDecompiler::decompileAt(RVA addr)
|
|||||||
emit finished(Decompiler::makeWarning(tr("Failed to parse JSON from r2dec")));
|
emit finished(Decompiler::makeWarning(tr("Failed to parse JSON from r2dec")));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RAnnotatedCode *code = r_annotated_code_new(nullptr);
|
RzAnnotatedCode *code = rz_annotated_code_new(nullptr);
|
||||||
QString codeString = "";
|
QString codeString = "";
|
||||||
for (const auto &line : json["log"].toArray()) {
|
for (const auto &line : json["log"].toArray()) {
|
||||||
if (!line.isString()) {
|
if (!line.isString()) {
|
||||||
@ -57,14 +57,14 @@ void R2DecDecompiler::decompileAt(RVA addr)
|
|||||||
if (lineObject.isEmpty()) {
|
if (lineObject.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
RCodeAnnotation annotationi = { 0 };
|
RzCodeAnnotation annotationi = { 0 };
|
||||||
annotationi.start = codeString.length();
|
annotationi.start = codeString.length();
|
||||||
codeString.append(lineObject["str"].toString() + "\n");
|
codeString.append(lineObject["str"].toString() + "\n");
|
||||||
annotationi.end = codeString.length();
|
annotationi.end = codeString.length();
|
||||||
bool ok;
|
bool ok;
|
||||||
annotationi.type = R_CODE_ANNOTATION_TYPE_OFFSET;
|
annotationi.type = RZ_CODE_ANNOTATION_TYPE_OFFSET;
|
||||||
annotationi.offset.offset = lineObject["offset"].toVariant().toULongLong(&ok);
|
annotationi.offset.offset = lineObject["offset"].toVariant().toULongLong(&ok);
|
||||||
r_annotated_code_add_annotation(code, &annotationi);
|
rz_annotated_code_add_annotation(code, &annotationi);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto &line : json["errors"].toArray()) {
|
for (const auto &line : json["errors"].toArray()) {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "CutterCommon.h"
|
#include "CutterCommon.h"
|
||||||
#include "R2Task.h"
|
#include "R2Task.h"
|
||||||
#include <r_util/r_annotated_code.h>
|
#include <rz_util/rz_annotated_code.h>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@ -23,7 +23,7 @@ public:
|
|||||||
Decompiler(const QString &id, const QString &name, QObject *parent = nullptr);
|
Decompiler(const QString &id, const QString &name, QObject *parent = nullptr);
|
||||||
virtual ~Decompiler() = default;
|
virtual ~Decompiler() = default;
|
||||||
|
|
||||||
static RAnnotatedCode *makeWarning(QString warningMessage);
|
static RzAnnotatedCode *makeWarning(QString warningMessage);
|
||||||
|
|
||||||
QString getId() const { return id; }
|
QString getId() const { return id; }
|
||||||
QString getName() const { return name; }
|
QString getName() const { return name; }
|
||||||
@ -34,7 +34,7 @@ public:
|
|||||||
virtual void cancel() {}
|
virtual void cancel() {}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void finished(RAnnotatedCode *codeDecompiled);
|
void finished(RzAnnotatedCode *codeDecompiled);
|
||||||
};
|
};
|
||||||
|
|
||||||
class R2DecDecompiler: public Decompiler
|
class R2DecDecompiler: public Decompiler
|
||||||
|
@ -12,7 +12,7 @@ DecompilerHighlighter::DecompilerHighlighter(QTextDocument *parent)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecompilerHighlighter::setAnnotations(RAnnotatedCode *code)
|
void DecompilerHighlighter::setAnnotations(RzAnnotatedCode *code)
|
||||||
{
|
{
|
||||||
this->code = code;
|
this->code = code;
|
||||||
}
|
}
|
||||||
@ -23,14 +23,14 @@ void DecompilerHighlighter::setupTheme()
|
|||||||
RSyntaxHighlightType type;
|
RSyntaxHighlightType type;
|
||||||
QString name;
|
QString name;
|
||||||
} mapping[] = {
|
} mapping[] = {
|
||||||
{R_SYNTAX_HIGHLIGHT_TYPE_KEYWORD, "pop"},
|
{RZ_SYNTAX_HIGHLIGHT_TYPE_KEYWORD, "pop"},
|
||||||
{R_SYNTAX_HIGHLIGHT_TYPE_COMMENT, "comment"},
|
{RZ_SYNTAX_HIGHLIGHT_TYPE_COMMENT, "comment"},
|
||||||
{R_SYNTAX_HIGHLIGHT_TYPE_DATATYPE, "func_var_type"},
|
{RZ_SYNTAX_HIGHLIGHT_TYPE_DATATYPE, "func_var_type"},
|
||||||
{R_SYNTAX_HIGHLIGHT_TYPE_FUNCTION_NAME, "fname"},
|
{RZ_SYNTAX_HIGHLIGHT_TYPE_FUNCTION_NAME, "fname"},
|
||||||
{R_SYNTAX_HIGHLIGHT_TYPE_FUNCTION_PARAMETER, "args"},
|
{RZ_SYNTAX_HIGHLIGHT_TYPE_FUNCTION_PARAMETER, "args"},
|
||||||
{R_SYNTAX_HIGHLIGHT_TYPE_LOCAL_VARIABLE, "func_var"},
|
{RZ_SYNTAX_HIGHLIGHT_TYPE_LOCAL_VARIABLE, "func_var"},
|
||||||
{R_SYNTAX_HIGHLIGHT_TYPE_CONSTANT_VARIABLE, "num"},
|
{RZ_SYNTAX_HIGHLIGHT_TYPE_CONSTANT_VARIABLE, "num"},
|
||||||
{R_SYNTAX_HIGHLIGHT_TYPE_GLOBAL_VARIABLE, "flag"},
|
{RZ_SYNTAX_HIGHLIGHT_TYPE_GLOBAL_VARIABLE, "flag"},
|
||||||
};
|
};
|
||||||
for (const auto &pair : mapping) {
|
for (const auto &pair : mapping) {
|
||||||
assert(pair.type < format.size());
|
assert(pair.type < format.size());
|
||||||
@ -47,11 +47,11 @@ void DecompilerHighlighter::highlightBlock(const QString &)
|
|||||||
size_t start = block.position();
|
size_t start = block.position();
|
||||||
size_t end = block.position() + block.length();
|
size_t end = block.position() + block.length();
|
||||||
|
|
||||||
std::unique_ptr<RPVector, decltype(&r_pvector_free)> annotations(r_annotated_code_annotations_range(code, start, end), &r_pvector_free);
|
std::unique_ptr<RzPVector, decltype(&rz_pvector_free)> annotations(rz_annotated_code_annotations_range(code, start, end), &rz_pvector_free);
|
||||||
void **iter;
|
void **iter;
|
||||||
r_pvector_foreach(annotations.get(), iter) {
|
rz_pvector_foreach(annotations.get(), iter) {
|
||||||
RCodeAnnotation *annotation = static_cast<RCodeAnnotation*>(*iter);
|
RzCodeAnnotation *annotation = static_cast<RzCodeAnnotation*>(*iter);
|
||||||
if (annotation->type != R_CODE_ANNOTATION_TYPE_SYNTAX_HIGHLIGHT) {
|
if (annotation->type != RZ_CODE_ANNOTATION_TYPE_SYNTAX_HIGHLIGHT) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
auto type = annotation->syntax_highlight.type;
|
auto type = annotation->syntax_highlight.type;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define DECOMPILER_HIGHLIGHTER_H
|
#define DECOMPILER_HIGHLIGHTER_H
|
||||||
|
|
||||||
#include "CutterCommon.h"
|
#include "CutterCommon.h"
|
||||||
#include <r_util/r_annotated_code.h>
|
#include <rz_util/rz_annotated_code.h>
|
||||||
#include <QSyntaxHighlighter>
|
#include <QSyntaxHighlighter>
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
#include <QTextCharFormat>
|
#include <QTextCharFormat>
|
||||||
@ -28,7 +28,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @param code
|
* @param code
|
||||||
*/
|
*/
|
||||||
void setAnnotations(RAnnotatedCode *code);
|
void setAnnotations(RzAnnotatedCode *code);
|
||||||
protected:
|
protected:
|
||||||
void highlightBlock(const QString &text) override;
|
void highlightBlock(const QString &text) override;
|
||||||
|
|
||||||
@ -36,9 +36,9 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void setupTheme();
|
void setupTheme();
|
||||||
|
|
||||||
static const int HIGHLIGHT_COUNT = R_SYNTAX_HIGHLIGHT_TYPE_GLOBAL_VARIABLE + 1;
|
static const int HIGHLIGHT_COUNT = RZ_SYNTAX_HIGHLIGHT_TYPE_GLOBAL_VARIABLE + 1;
|
||||||
std::array<QTextCharFormat, HIGHLIGHT_COUNT> format;
|
std::array<QTextCharFormat, HIGHLIGHT_COUNT> format;
|
||||||
RAnnotatedCode *code = nullptr;
|
RzAnnotatedCode *code = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,18 +3,18 @@
|
|||||||
|
|
||||||
R2Task::R2Task(const QString &cmd, bool transient)
|
R2Task::R2Task(const QString &cmd, bool transient)
|
||||||
{
|
{
|
||||||
task = r_core_task_new(Core()->core(),
|
task = rz_core_task_new(Core()->core(),
|
||||||
true,
|
true,
|
||||||
cmd.toLocal8Bit().constData(),
|
cmd.toLocal8Bit().constData(),
|
||||||
static_cast<RCoreTaskCallback>(&R2Task::taskFinishedCallback),
|
static_cast<RzCoreTaskCallback>(&R2Task::taskFinishedCallback),
|
||||||
this);
|
this);
|
||||||
task->transient = transient;
|
task->transient = transient;
|
||||||
r_core_task_incref(task);
|
rz_core_task_incref(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
R2Task::~R2Task()
|
R2Task::~R2Task()
|
||||||
{
|
{
|
||||||
r_core_task_decref(task);
|
rz_core_task_decref(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R2Task::taskFinishedCallback(void *user, char *)
|
void R2Task::taskFinishedCallback(void *user, char *)
|
||||||
@ -29,17 +29,17 @@ void R2Task::taskFinished()
|
|||||||
|
|
||||||
void R2Task::startTask()
|
void R2Task::startTask()
|
||||||
{
|
{
|
||||||
r_core_task_enqueue(&Core()->core_->tasks, task);
|
rz_core_task_enqueue(&Core()->core_->tasks, task);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R2Task::breakTask()
|
void R2Task::breakTask()
|
||||||
{
|
{
|
||||||
r_core_task_break(&Core()->core_->tasks, task->id);
|
rz_core_task_break(&Core()->core_->tasks, task->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R2Task::joinTask()
|
void R2Task::joinTask()
|
||||||
{
|
{
|
||||||
r_core_task_join(&Core()->core_->tasks, nullptr, task->id);
|
rz_core_task_join(&Core()->core_->tasks, nullptr, task->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString R2Task::getResult()
|
QString R2Task::getResult()
|
||||||
|
@ -9,7 +9,7 @@ class R2Task: public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RCoreTask *task;
|
RzCoreTask *task;
|
||||||
|
|
||||||
static void taskFinishedCallback(void *user, char *);
|
static void taskFinishedCallback(void *user, char *);
|
||||||
void taskFinished();
|
void taskFinished();
|
||||||
|
@ -14,7 +14,7 @@ RunScriptTask::~RunScriptTask()
|
|||||||
void RunScriptTask::interrupt()
|
void RunScriptTask::interrupt()
|
||||||
{
|
{
|
||||||
AsyncTask::interrupt();
|
AsyncTask::interrupt();
|
||||||
r_cons_singleton()->context->breaked = true;
|
rz_cons_singleton()->context->breaked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunScriptTask::runTask()
|
void RunScriptTask::runTask()
|
||||||
|
@ -28,7 +28,7 @@ static bool migrateSettingsPre18(QSettings &newSettings)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CUTTER_SETTINGS_VERSION_CURRENT 4
|
#define CUTTER_SETTINGS_VERSION_CURRENT 5
|
||||||
#define CUTTER_SETTINGS_VERSION_KEY "version"
|
#define CUTTER_SETTINGS_VERSION_KEY "version"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -103,16 +103,24 @@ static void migrateSettingsTo3(QSettings &settings) {
|
|||||||
settings.remove("unsync");
|
settings.remove("unsync");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void migrateSettingsTo4(QSettings &settings) {
|
static void renameAsmOption(QSettings &settings, const QString &oldName, const QString &newName)
|
||||||
auto renameAsmOption = [&](QString oldName, QString newName) {
|
{
|
||||||
if (settings.contains(oldName)) {
|
if (settings.contains(oldName)) {
|
||||||
auto value = settings.value(oldName);
|
auto value = settings.value(oldName);
|
||||||
settings.remove(oldName);
|
settings.remove(oldName);
|
||||||
settings.setValue(newName, value);
|
settings.setValue(newName, value);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
renameAsmOption("asm.var.subonly", "asm.sub.varonly");
|
|
||||||
renameAsmOption("asm.bytespace", "asm.bytes.space");
|
static void migrateSettingsTo4(QSettings &settings)
|
||||||
|
{
|
||||||
|
renameAsmOption(settings, "asm.var.subonly", "asm.sub.varonly");
|
||||||
|
renameAsmOption(settings, "asm.bytespace", "asm.bytes.space");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void migrateSettingsTo5(QSettings &settings)
|
||||||
|
{
|
||||||
|
renameAsmOption(settings, "asm.var.sub", "asm.sub.var");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cutter::initializeSettings()
|
void Cutter::initializeSettings()
|
||||||
@ -140,6 +148,8 @@ void Cutter::initializeSettings()
|
|||||||
migrateSettingsTo3(settings); break;
|
migrateSettingsTo3(settings); break;
|
||||||
case 4:
|
case 4:
|
||||||
migrateSettingsTo4(settings); break;
|
migrateSettingsTo4(settings); break;
|
||||||
|
case 5:
|
||||||
|
migrateSettingsTo5(settings); break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -30,13 +30,13 @@ class R2TaskDialog;
|
|||||||
|
|
||||||
#define Core() (CutterCore::instance())
|
#define Core() (CutterCore::instance())
|
||||||
|
|
||||||
class RCoreLocked;
|
class RzCoreLocked;
|
||||||
|
|
||||||
class CUTTER_EXPORT CutterCore: public QObject
|
class CUTTER_EXPORT CutterCore: public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
friend class RCoreLocked;
|
friend class RzCoreLocked;
|
||||||
friend class R2Task;
|
friend class R2Task;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -140,7 +140,7 @@ public:
|
|||||||
return parseJson(res, cmd.isNull() ? nullptr : cmd.toLocal8Bit().constData());
|
return parseJson(res, cmd.isNull() ? nullptr : cmd.toLocal8Bit().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList autocomplete(const QString &cmd, RLinePromptType promptType, size_t limit = 4096);
|
QStringList autocomplete(const QString &cmd, RzLinePromptType promptType, size_t limit = 4096);
|
||||||
|
|
||||||
/* Functions methods */
|
/* Functions methods */
|
||||||
void renameFunction(const RVA offset, const QString &newName);
|
void renameFunction(const RVA offset, const QString &newName);
|
||||||
@ -160,13 +160,13 @@ public:
|
|||||||
* @param addr
|
* @param addr
|
||||||
* @return a function that contains addr or nullptr
|
* @return a function that contains addr or nullptr
|
||||||
*/
|
*/
|
||||||
RAnalFunction *functionIn(ut64 addr);
|
RzAnalFunction *functionIn(ut64 addr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param addr
|
* @param addr
|
||||||
* @return the function that has its entrypoint at addr or nullptr
|
* @return the function that has its entrypoint at addr or nullptr
|
||||||
*/
|
*/
|
||||||
RAnalFunction *functionAt(ut64 addr);
|
RzAnalFunction *functionAt(ut64 addr);
|
||||||
|
|
||||||
RVA getFunctionStart(RVA addr);
|
RVA getFunctionStart(RVA addr);
|
||||||
RVA getFunctionEnd(RVA addr);
|
RVA getFunctionEnd(RVA addr);
|
||||||
@ -256,7 +256,7 @@ public:
|
|||||||
void setAnalMethod(const QString &cls, const AnalMethodDescription &meth);
|
void setAnalMethod(const QString &cls, const AnalMethodDescription &meth);
|
||||||
|
|
||||||
/* File related methods */
|
/* File related methods */
|
||||||
bool loadFile(QString path, ut64 baddr = 0LL, ut64 mapaddr = 0LL, int perms = R_PERM_R,
|
bool loadFile(QString path, ut64 baddr = 0LL, ut64 mapaddr = 0LL, int perms = RZ_PERM_R,
|
||||||
int va = 0, bool loadbin = false, const QString &forceBinPlugin = QString());
|
int va = 0, bool loadbin = false, const QString &forceBinPlugin = QString());
|
||||||
bool tryFile(QString path, bool rw);
|
bool tryFile(QString path, bool rw);
|
||||||
bool mapFile(QString path, RVA mapaddr);
|
bool mapFile(QString path, RVA mapaddr);
|
||||||
@ -481,10 +481,10 @@ public:
|
|||||||
static bool isProjectNameValid(const QString &name);
|
static bool isProjectNameValid(const QString &name);
|
||||||
|
|
||||||
/* Widgets */
|
/* Widgets */
|
||||||
QList<RBinPluginDescription> getRBinPluginDescriptions(const QString &type = QString());
|
QList<RzBinPluginDescription> getRBinPluginDescriptions(const QString &type = QString());
|
||||||
QList<RIOPluginDescription> getRIOPluginDescriptions();
|
QList<RzIOPluginDescription> getRIOPluginDescriptions();
|
||||||
QList<RCorePluginDescription> getRCorePluginDescriptions();
|
QList<RzCorePluginDescription> getRCorePluginDescriptions();
|
||||||
QList<RAsmPluginDescription> getRAsmPluginDescriptions();
|
QList<RzAsmPluginDescription> getRAsmPluginDescriptions();
|
||||||
QList<FunctionDescription> getAllFunctions();
|
QList<FunctionDescription> getAllFunctions();
|
||||||
QList<ImportDescription> getAllImports();
|
QList<ImportDescription> getAllImports();
|
||||||
QList<ExportDescription> getAllExports();
|
QList<ExportDescription> getAllExports();
|
||||||
@ -545,10 +545,10 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Adds new types
|
* @brief Adds new types
|
||||||
* It first uses the r_parse_c_string() function from radare2 API to parse the
|
* It first uses the rz_parse_c_string() function from radare2 API to parse the
|
||||||
* supplied C file (in the form of a string). If there were errors, they are displayed.
|
* supplied C file (in the form of a string). If there were errors, they are displayed.
|
||||||
* If there were no errors, it uses sdb_query_lines() function from radare2 API
|
* If there were no errors, it uses sdb_query_lines() function from radare2 API
|
||||||
* to save the parsed types returned by r_parse_c_string()
|
* to save the parsed types returned by rz_parse_c_string()
|
||||||
* \param str Contains the definition of the data types
|
* \param str Contains the definition of the data types
|
||||||
* \return returns an empty QString if there was no error, else returns the error
|
* \return returns an empty QString if there was no error, else returns the error
|
||||||
*/
|
*/
|
||||||
@ -603,7 +603,7 @@ public:
|
|||||||
|
|
||||||
QStringList getSectionList();
|
QStringList getSectionList();
|
||||||
|
|
||||||
RCoreLocked core();
|
RzCoreLocked core();
|
||||||
|
|
||||||
static QString ansiEscapeToHtml(const QString &text);
|
static QString ansiEscapeToHtml(const QString &text);
|
||||||
BasicBlockHighlighter *getBBHighlighter();
|
BasicBlockHighlighter *getBBHighlighter();
|
||||||
@ -711,10 +711,10 @@ private:
|
|||||||
QString notes;
|
QString notes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal reference to the RCore.
|
* Internal reference to the RzCore.
|
||||||
* NEVER use this directly! Always use the CORE_LOCK(); macro and access it like core->...
|
* NEVER use this directly! Always use the CORE_LOCK(); macro and access it like core->...
|
||||||
*/
|
*/
|
||||||
RCore *core_ = nullptr;
|
RzCore *core_ = nullptr;
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||||
QMutex coreMutex;
|
QMutex coreMutex;
|
||||||
#else
|
#else
|
||||||
@ -740,18 +740,18 @@ private:
|
|||||||
QVector<QString> getCutterRCFilePaths() const;
|
QVector<QString> getCutterRCFilePaths() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CUTTER_EXPORT RCoreLocked
|
class CUTTER_EXPORT RzCoreLocked
|
||||||
{
|
{
|
||||||
CutterCore * const core;
|
CutterCore * const core;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit RCoreLocked(CutterCore *core);
|
explicit RzCoreLocked(CutterCore *core);
|
||||||
RCoreLocked(const RCoreLocked &) = delete;
|
RzCoreLocked(const RzCoreLocked &) = delete;
|
||||||
RCoreLocked &operator=(const RCoreLocked &) = delete;
|
RzCoreLocked &operator=(const RzCoreLocked &) = delete;
|
||||||
RCoreLocked(RCoreLocked &&);
|
RzCoreLocked(RzCoreLocked &&);
|
||||||
~RCoreLocked();
|
~RzCoreLocked();
|
||||||
operator RCore *() const;
|
operator RzCore *() const;
|
||||||
RCore *operator->() const;
|
RzCore *operator->() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CUTTER_H
|
#endif // CUTTER_H
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#ifndef CUTTERCORE_H
|
#ifndef CUTTERCORE_H
|
||||||
#define CUTTERCORE_H
|
#define CUTTERCORE_H
|
||||||
|
|
||||||
#include "r_core.h"
|
#include "rz_core.h"
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
// Workaround for compile errors on Windows
|
// Workaround for compile errors on Windows
|
||||||
|
@ -26,7 +26,7 @@ struct FunctionDescription {
|
|||||||
bool contains(RVA addr) const
|
bool contains(RVA addr) const
|
||||||
{
|
{
|
||||||
// TODO: this is not exactly correct in edge cases.
|
// TODO: this is not exactly correct in edge cases.
|
||||||
// r_anal_function_contains() does it right.
|
// rz_anal_function_contains() does it right.
|
||||||
return addr >= offset && addr < offset + linearSize;
|
return addr >= offset && addr < offset + linearSize;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -158,14 +158,14 @@ struct XrefDescription {
|
|||||||
QString type;
|
QString type;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RBinPluginDescription {
|
struct RzBinPluginDescription {
|
||||||
QString name;
|
QString name;
|
||||||
QString description;
|
QString description;
|
||||||
QString license;
|
QString license;
|
||||||
QString type;
|
QString type;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RIOPluginDescription {
|
struct RzIOPluginDescription {
|
||||||
QString name;
|
QString name;
|
||||||
QString description;
|
QString description;
|
||||||
QString license;
|
QString license;
|
||||||
@ -173,12 +173,12 @@ struct RIOPluginDescription {
|
|||||||
QList<QString> uris;
|
QList<QString> uris;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RCorePluginDescription {
|
struct RzCorePluginDescription {
|
||||||
QString name;
|
QString name;
|
||||||
QString description;
|
QString description;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RAsmPluginDescription {
|
struct RzAsmPluginDescription {
|
||||||
QString name;
|
QString name;
|
||||||
QString architecture;
|
QString architecture;
|
||||||
QString author;
|
QString author;
|
||||||
@ -338,10 +338,10 @@ Q_DECLARE_METATYPE(FlagspaceDescription)
|
|||||||
Q_DECLARE_METATYPE(FlagDescription)
|
Q_DECLARE_METATYPE(FlagDescription)
|
||||||
Q_DECLARE_METATYPE(XrefDescription)
|
Q_DECLARE_METATYPE(XrefDescription)
|
||||||
Q_DECLARE_METATYPE(EntrypointDescription)
|
Q_DECLARE_METATYPE(EntrypointDescription)
|
||||||
Q_DECLARE_METATYPE(RBinPluginDescription)
|
Q_DECLARE_METATYPE(RzBinPluginDescription)
|
||||||
Q_DECLARE_METATYPE(RIOPluginDescription)
|
Q_DECLARE_METATYPE(RzIOPluginDescription)
|
||||||
Q_DECLARE_METATYPE(RCorePluginDescription)
|
Q_DECLARE_METATYPE(RzCorePluginDescription)
|
||||||
Q_DECLARE_METATYPE(RAsmPluginDescription)
|
Q_DECLARE_METATYPE(RzAsmPluginDescription)
|
||||||
Q_DECLARE_METATYPE(BinClassMethodDescription)
|
Q_DECLARE_METATYPE(BinClassMethodDescription)
|
||||||
Q_DECLARE_METATYPE(BinClassFieldDescription)
|
Q_DECLARE_METATYPE(BinClassFieldDescription)
|
||||||
Q_DECLARE_METATYPE(BinClassDescription)
|
Q_DECLARE_METATYPE(BinClassDescription)
|
||||||
|
@ -535,7 +535,7 @@ void MainWindow::openNewFile(InitialOptions &options, bool skipOptionsDialog)
|
|||||||
/* Prompt to load filename.r2 script */
|
/* Prompt to load filename.r2 script */
|
||||||
if (options.script.isEmpty()) {
|
if (options.script.isEmpty()) {
|
||||||
QString script = QString("%1.r2").arg(this->filename);
|
QString script = QString("%1.r2").arg(this->filename);
|
||||||
if (r_file_exists(script.toStdString().data())) {
|
if (rz_file_exists(script.toStdString().data())) {
|
||||||
QMessageBox mb;
|
QMessageBox mb;
|
||||||
mb.setWindowTitle(tr("Script loading"));
|
mb.setWindowTitle(tr("Script loading"));
|
||||||
mb.setText(tr("Do you want to load the '%1' script?").arg(script));
|
mb.setText(tr("Do you want to load the '%1' script?").arg(script));
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "r_version.h"
|
#include "rz_version.h"
|
||||||
#include "core/Cutter.h"
|
#include "core/Cutter.h"
|
||||||
#include "AboutDialog.h"
|
#include "AboutDialog.h"
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ AboutDialog::AboutDialog(QWidget *parent) :
|
|||||||
ui->logoSvgWidget->load(Config()->getLogoFile());
|
ui->logoSvgWidget->load(Config()->getLogoFile());
|
||||||
|
|
||||||
QString aboutString(tr("Version") + " " CUTTER_VERSION_FULL "<br/>"
|
QString aboutString(tr("Version") + " " CUTTER_VERSION_FULL "<br/>"
|
||||||
+ tr("Using r2-") + R2_GITTAP + "<br/>"
|
+ tr("Using r2-") + RZ_GITTAP + "<br/>"
|
||||||
+ buildQtVersionString()
|
+ buildQtVersionString()
|
||||||
+ "<p><b>" + tr("Optional Features:") + "</b><br/>"
|
+ "<p><b>" + tr("Optional Features:") + "</b><br/>"
|
||||||
+ QString("Python: %1<br/>").arg(
|
+ QString("Python: %1<br/>").arg(
|
||||||
|
@ -85,9 +85,9 @@ BreakpointsDialog::BreakpointsDialog(const BreakpointDescription &breakpoint, QW
|
|||||||
ui->breakpointCondition->setEditText(breakpoint.condition);
|
ui->breakpointCondition->setEditText(breakpoint.condition);
|
||||||
if (breakpoint.hw) {
|
if (breakpoint.hw) {
|
||||||
ui->radioHardware->setChecked(true);
|
ui->radioHardware->setChecked(true);
|
||||||
ui->hwRead->setChecked(breakpoint.permission & R_BP_PROT_READ);
|
ui->hwRead->setChecked(breakpoint.permission & RZ_BP_PROT_READ);
|
||||||
ui->hwWrite->setChecked(breakpoint.permission & R_BP_PROT_WRITE);
|
ui->hwWrite->setChecked(breakpoint.permission & RZ_BP_PROT_WRITE);
|
||||||
ui->hwExecute->setChecked(breakpoint.permission & R_BP_PROT_EXEC);
|
ui->hwExecute->setChecked(breakpoint.permission & RZ_BP_PROT_EXEC);
|
||||||
ui->breakpointSize->setCurrentText(QString::number(breakpoint.size));
|
ui->breakpointSize->setCurrentText(QString::number(breakpoint.size));
|
||||||
} else {
|
} else {
|
||||||
ui->radioSoftware->setChecked(true);
|
ui->radioSoftware->setChecked(true);
|
||||||
@ -201,13 +201,13 @@ int BreakpointsDialog::getHwPermissions()
|
|||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
if (ui->hwRead->isChecked()) {
|
if (ui->hwRead->isChecked()) {
|
||||||
result |= R_BP_PROT_READ;
|
result |= RZ_BP_PROT_READ;
|
||||||
}
|
}
|
||||||
if (ui->hwWrite->isChecked()) {
|
if (ui->hwWrite->isChecked()) {
|
||||||
result |= R_BP_PROT_WRITE;
|
result |= RZ_BP_PROT_WRITE;
|
||||||
}
|
}
|
||||||
if (ui->hwExecute->isChecked()) {
|
if (ui->hwExecute->isChecked()) {
|
||||||
result |= R_BP_PROT_EXEC;
|
result |= RZ_BP_PROT_EXEC;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ FlagDialog::FlagDialog(RVA offset, QWidget *parent) :
|
|||||||
// Setup UI
|
// Setup UI
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||||
RFlagItem* flag = r_flag_get_i(Core()->core()->flags, offset);
|
RzFlagItem *flag = rz_flag_get_i(Core()->core()->flags, offset);
|
||||||
if (flag) {
|
if (flag) {
|
||||||
flagName = QString(flag->name);
|
flagName = QString(flag->name);
|
||||||
flagOffset = flag->offset;
|
flagOffset = flag->offset;
|
||||||
|
@ -106,7 +106,7 @@ void InitialOptionsDialog::updateCPUComboBox()
|
|||||||
QString arch = getSelectedArch();
|
QString arch = getSelectedArch();
|
||||||
QStringList cpus;
|
QStringList cpus;
|
||||||
if (!arch.isEmpty()) {
|
if (!arch.isEmpty()) {
|
||||||
auto pluginDescr = std::find_if(asmPlugins.begin(), asmPlugins.end(), [&](const RAsmPluginDescription &plugin) {
|
auto pluginDescr = std::find_if(asmPlugins.begin(), asmPlugins.end(), [&](const RzAsmPluginDescription &plugin) {
|
||||||
return plugin.name == arch;
|
return plugin.name == arch;
|
||||||
});
|
});
|
||||||
if (pluginDescr != asmPlugins.end()) {
|
if (pluginDescr != asmPlugins.end()) {
|
||||||
@ -269,7 +269,7 @@ void InitialOptionsDialog::setupAndStartAnalysis(/*int level, QList<QString> adv
|
|||||||
options.loadBinInfo = !ui->binCheckBox->isChecked();
|
options.loadBinInfo = !ui->binCheckBox->isChecked();
|
||||||
QVariant forceBinPluginData = ui->formatComboBox->currentData();
|
QVariant forceBinPluginData = ui->formatComboBox->currentData();
|
||||||
if (!forceBinPluginData.isNull()) {
|
if (!forceBinPluginData.isNull()) {
|
||||||
RBinPluginDescription pluginDesc = forceBinPluginData.value<RBinPluginDescription>();
|
RzBinPluginDescription pluginDesc = forceBinPluginData.value<RzBinPluginDescription>();
|
||||||
options.forceBinPlugin = pluginDesc.name;
|
options.forceBinPlugin = pluginDesc.name;
|
||||||
}
|
}
|
||||||
options.demangle = ui->demangleCheckBox->isChecked();
|
options.demangle = ui->demangleCheckBox->isChecked();
|
||||||
|
@ -46,7 +46,7 @@ private:
|
|||||||
QString analysisDescription(int level);
|
QString analysisDescription(int level);
|
||||||
QString shellcode;
|
QString shellcode;
|
||||||
int analLevel;
|
int analLevel;
|
||||||
QList<RAsmPluginDescription> asmPlugins;
|
QList<RzAsmPluginDescription> asmPlugins;
|
||||||
|
|
||||||
|
|
||||||
void updateCPUComboBox();
|
void updateCPUComboBox();
|
||||||
|
@ -339,8 +339,8 @@ void NewFileDialog::fillIOPluginsList()
|
|||||||
ui->ioPlugin->setItemData(0, tr("Open a file with no extra treatment."), Qt::ToolTipRole);
|
ui->ioPlugin->setItemData(0, tr("Open a file with no extra treatment."), Qt::ToolTipRole);
|
||||||
|
|
||||||
int index = 1;
|
int index = 1;
|
||||||
QList<RIOPluginDescription> ioPlugins = Core()->getRIOPluginDescriptions();
|
QList<RzIOPluginDescription> ioPlugins = Core()->getRIOPluginDescriptions();
|
||||||
for (const RIOPluginDescription &plugin : ioPlugins) {
|
for (const RzIOPluginDescription &plugin : ioPlugins) {
|
||||||
// Hide debug plugins
|
// Hide debug plugins
|
||||||
if (plugin.permissions.contains('d')) {
|
if (plugin.permissions.contains('d')) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -17,10 +17,10 @@ R2PluginsDialog::R2PluginsDialog(QWidget *parent) :
|
|||||||
item->setText(1, plugin.description);
|
item->setText(1, plugin.description);
|
||||||
item->setText(2, plugin.license);
|
item->setText(2, plugin.license);
|
||||||
item->setText(3, plugin.type);
|
item->setText(3, plugin.type);
|
||||||
ui->RBinTreeWidget->addTopLevelItem(item);
|
ui->RzBinTreeWidget->addTopLevelItem(item);
|
||||||
}
|
}
|
||||||
ui->RBinTreeWidget->sortByColumn(0, Qt::AscendingOrder);
|
ui->RzBinTreeWidget->sortByColumn(0, Qt::AscendingOrder);
|
||||||
qhelpers::adjustColumns(ui->RBinTreeWidget, 0);
|
qhelpers::adjustColumns(ui->RzBinTreeWidget, 0);
|
||||||
|
|
||||||
for (const auto &plugin : Core()->getRIOPluginDescriptions()) {
|
for (const auto &plugin : Core()->getRIOPluginDescriptions()) {
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||||
@ -28,19 +28,19 @@ R2PluginsDialog::R2PluginsDialog(QWidget *parent) :
|
|||||||
item->setText(1, plugin.description);
|
item->setText(1, plugin.description);
|
||||||
item->setText(2, plugin.license);
|
item->setText(2, plugin.license);
|
||||||
item->setText(3, plugin.permissions);
|
item->setText(3, plugin.permissions);
|
||||||
ui->RIOTreeWidget->addTopLevelItem(item);
|
ui->RzIOTreeWidget->addTopLevelItem(item);
|
||||||
}
|
}
|
||||||
ui->RIOTreeWidget->sortByColumn(0, Qt::AscendingOrder);
|
ui->RzIOTreeWidget->sortByColumn(0, Qt::AscendingOrder);
|
||||||
qhelpers::adjustColumns(ui->RIOTreeWidget, 0);
|
qhelpers::adjustColumns(ui->RzIOTreeWidget, 0);
|
||||||
|
|
||||||
for (const auto &plugin : Core()->getRCorePluginDescriptions()) {
|
for (const auto &plugin : Core()->getRCorePluginDescriptions()) {
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||||
item->setText(0, plugin.name);
|
item->setText(0, plugin.name);
|
||||||
item->setText(1, plugin.description);
|
item->setText(1, plugin.description);
|
||||||
ui->RCoreTreeWidget->addTopLevelItem(item);
|
ui->RzCoreTreeWidget->addTopLevelItem(item);
|
||||||
}
|
}
|
||||||
ui->RCoreTreeWidget->sortByColumn(0, Qt::AscendingOrder);
|
ui->RzCoreTreeWidget->sortByColumn(0, Qt::AscendingOrder);
|
||||||
qhelpers::adjustColumns(ui->RCoreTreeWidget, 0);
|
qhelpers::adjustColumns(ui->RzCoreTreeWidget, 0);
|
||||||
|
|
||||||
for (const auto &plugin : Core()->getRAsmPluginDescriptions()) {
|
for (const auto &plugin : Core()->getRAsmPluginDescriptions()) {
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||||
@ -51,10 +51,10 @@ R2PluginsDialog::R2PluginsDialog(QWidget *parent) :
|
|||||||
item->setText(4, plugin.description);
|
item->setText(4, plugin.description);
|
||||||
item->setText(5, plugin.license);
|
item->setText(5, plugin.license);
|
||||||
item->setText(6, plugin.author);
|
item->setText(6, plugin.author);
|
||||||
ui->RAsmTreeWidget->addTopLevelItem(item);
|
ui->RzAsmTreeWidget->addTopLevelItem(item);
|
||||||
}
|
}
|
||||||
ui->RAsmTreeWidget->sortByColumn(0, Qt::AscendingOrder);
|
ui->RzAsmTreeWidget->sortByColumn(0, Qt::AscendingOrder);
|
||||||
qhelpers::adjustColumns(ui->RAsmTreeWidget, 0);
|
qhelpers::adjustColumns(ui->RzAsmTreeWidget, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
R2PluginsDialog::~R2PluginsDialog()
|
R2PluginsDialog::~R2PluginsDialog()
|
||||||
|
@ -19,20 +19,20 @@
|
|||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>4</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="RBinTab">
|
<widget class="QWidget" name="RzBinTab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>RBin</string>
|
<string>RzBin</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="RBinLabel">
|
<widget class="QLabel" name="RzBinLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>RBin plugins</string>
|
<string>RzBin plugins</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTreeWidget" name="RBinTreeWidget">
|
<widget class="QTreeWidget" name="RzBinTreeWidget">
|
||||||
<property name="sortingEnabled">
|
<property name="sortingEnabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -60,20 +60,20 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="RIOTab">
|
<widget class="QWidget" name="RzIOTab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>RIO</string>
|
<string>RzIO</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="RIOLabel">
|
<widget class="QLabel" name="RzIOLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>RIO plugins</string>
|
<string>RzIO plugins</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTreeWidget" name="RIOTreeWidget">
|
<widget class="QTreeWidget" name="RzIOTreeWidget">
|
||||||
<property name="sortingEnabled">
|
<property name="sortingEnabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -101,20 +101,20 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="RCoreTab">
|
<widget class="QWidget" name="RzCoreTab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>RCore</string>
|
<string>RzCore</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="RCoreLabel">
|
<widget class="QLabel" name="RzCoreLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>RCore plugins</string>
|
<string>RzCore plugins</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTreeWidget" name="RCoreTreeWidget">
|
<widget class="QTreeWidget" name="RzCoreTreeWidget">
|
||||||
<property name="sortingEnabled">
|
<property name="sortingEnabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -132,20 +132,20 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="RAsmTab">
|
<widget class="QWidget" name="RzAsmTab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>RAsm</string>
|
<string>RzAsm</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="RAsmLabel">
|
<widget class="QLabel" name="RzAsmLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>RAsm plugins</string>
|
<string>RzAsm plugins</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTreeWidget" name="RAsmTreeWidget">
|
<widget class="QTreeWidget" name="RzAsmTreeWidget">
|
||||||
<property name="sortingEnabled">
|
<property name="sortingEnabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
@ -26,7 +26,7 @@ AsmOptionsWidget::AsmOptionsWidget(PreferencesDialog *dialog)
|
|||||||
{ ui->refptrCheckBox, "asm.refptr" },
|
{ ui->refptrCheckBox, "asm.refptr" },
|
||||||
{ ui->xrefCheckBox, "asm.xrefs" },
|
{ ui->xrefCheckBox, "asm.xrefs" },
|
||||||
{ ui->bblineCheckBox, "asm.bb.line" },
|
{ ui->bblineCheckBox, "asm.bb.line" },
|
||||||
{ ui->varsubCheckBox, "asm.var.sub" },
|
{ ui->varsubCheckBox, "asm.sub.var" },
|
||||||
{ ui->varsubOnlyCheckBox, "asm.sub.varonly" },
|
{ ui->varsubOnlyCheckBox, "asm.sub.varonly" },
|
||||||
{ ui->lbytesCheckBox, "asm.lbytes" },
|
{ ui->lbytesCheckBox, "asm.lbytes" },
|
||||||
{ ui->bytespaceCheckBox, "asm.bytes.space" },
|
{ ui->bytespaceCheckBox, "asm.bytes.space" },
|
||||||
@ -92,7 +92,7 @@ void AsmOptionsWidget::updateAsmOptionsFromVars()
|
|||||||
ui->nbytesSpinBox->blockSignals(false);
|
ui->nbytesSpinBox->blockSignals(false);
|
||||||
ui->nbytesLabel->setEnabled(bytesEnabled);
|
ui->nbytesLabel->setEnabled(bytesEnabled);
|
||||||
ui->nbytesSpinBox->setEnabled(bytesEnabled);
|
ui->nbytesSpinBox->setEnabled(bytesEnabled);
|
||||||
bool varsubEnabled = Config()->getConfigBool("asm.var.sub");
|
bool varsubEnabled = Config()->getConfigBool("asm.sub.var");
|
||||||
ui->varsubOnlyCheckBox->setEnabled(varsubEnabled);
|
ui->varsubOnlyCheckBox->setEnabled(varsubEnabled);
|
||||||
|
|
||||||
QString currentSyntax = Config()->getConfigString("asm.syntax");
|
QString currentSyntax = Config()->getConfigString("asm.syntax");
|
||||||
@ -222,7 +222,7 @@ void AsmOptionsWidget::on_asmTabsOffSpinBox_valueChanged(int value)
|
|||||||
|
|
||||||
void AsmOptionsWidget::on_varsubCheckBox_toggled(bool checked)
|
void AsmOptionsWidget::on_varsubCheckBox_toggled(bool checked)
|
||||||
{
|
{
|
||||||
Config()->setConfig("asm.var.sub", checked);
|
Config()->setConfig("asm.sub.var", checked);
|
||||||
ui->varsubOnlyCheckBox->setEnabled(checked);
|
ui->varsubOnlyCheckBox->setEnabled(checked);
|
||||||
triggerAsmOptionsChanged();
|
triggerAsmOptionsChanged();
|
||||||
}
|
}
|
||||||
|
@ -472,7 +472,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="varsubCheckBox">
|
<widget class="QCheckBox" name="varsubCheckBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Substitute variables (asm.var.sub)</string>
|
<string>Substitute variables (asm.sub.var)</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -71,7 +71,7 @@ DecompilerContextMenu::~DecompilerContextMenu()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecompilerContextMenu::setAnnotationHere(RCodeAnnotation *annotation)
|
void DecompilerContextMenu::setAnnotationHere(RzCodeAnnotation *annotation)
|
||||||
{
|
{
|
||||||
annotationHere = annotation;
|
annotationHere = annotation;
|
||||||
}
|
}
|
||||||
@ -199,16 +199,16 @@ void DecompilerContextMenu::aboutToShowSlot()
|
|||||||
|
|
||||||
if (!annotationHere
|
if (!annotationHere
|
||||||
|| annotationHere->type ==
|
|| annotationHere->type ==
|
||||||
R_CODE_ANNOTATION_TYPE_CONSTANT_VARIABLE) { // If constant, don't show rename and targeted show-in
|
RZ_CODE_ANNOTATION_TYPE_CONSTANT_VARIABLE) { // If constant, don't show rename and targeted show-in
|
||||||
actionRenameThingHere.setVisible(false);
|
actionRenameThingHere.setVisible(false);
|
||||||
copySeparator->setVisible(false);
|
copySeparator->setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
copySeparator->setVisible(true);
|
copySeparator->setVisible(true);
|
||||||
if (annotationHere->type == R_CODE_ANNOTATION_TYPE_FUNCTION_NAME) {
|
if (annotationHere->type == RZ_CODE_ANNOTATION_TYPE_FUNCTION_NAME) {
|
||||||
actionRenameThingHere.setText(tr("Rename function %1").arg(QString(
|
actionRenameThingHere.setText(tr("Rename function %1").arg(QString(
|
||||||
annotationHere->reference.name)));
|
annotationHere->reference.name)));
|
||||||
} else if (annotationHere->type == R_CODE_ANNOTATION_TYPE_GLOBAL_VARIABLE) {
|
} else if (annotationHere->type == RZ_CODE_ANNOTATION_TYPE_GLOBAL_VARIABLE) {
|
||||||
RFlagItem *flagDetails = r_flag_get_i(Core()->core()->flags, annotationHere->reference.offset);
|
RzFlagItem *flagDetails = rz_flag_get_i(Core()->core()->flags, annotationHere->reference.offset);
|
||||||
if (flagDetails) {
|
if (flagDetails) {
|
||||||
actionRenameThingHere.setText(tr("Rename %1").arg(QString(flagDetails->name)));
|
actionRenameThingHere.setText(tr("Rename %1").arg(QString(flagDetails->name)));
|
||||||
actionDeleteName.setText(tr("Remove %1").arg(QString(flagDetails->name)));
|
actionDeleteName.setText(tr("Remove %1").arg(QString(flagDetails->name)));
|
||||||
@ -223,8 +223,8 @@ void DecompilerContextMenu::aboutToShowSlot()
|
|||||||
if (isReference()) {
|
if (isReference()) {
|
||||||
actionCopyReferenceAddress.setVisible(true);
|
actionCopyReferenceAddress.setVisible(true);
|
||||||
RVA referenceAddr = annotationHere->reference.offset;
|
RVA referenceAddr = annotationHere->reference.offset;
|
||||||
RFlagItem *flagDetails = r_flag_get_i(Core()->core()->flags, referenceAddr);
|
RzFlagItem *flagDetails = rz_flag_get_i(Core()->core()->flags, referenceAddr);
|
||||||
if (annotationHere->type == R_CODE_ANNOTATION_TYPE_FUNCTION_NAME) {
|
if (annotationHere->type == RZ_CODE_ANNOTATION_TYPE_FUNCTION_NAME) {
|
||||||
actionCopyReferenceAddress.setText(tr("Copy address of %1 (%2)").arg
|
actionCopyReferenceAddress.setText(tr("Copy address of %1 (%2)").arg
|
||||||
(QString(annotationHere->reference.name), RAddressString(referenceAddr)));
|
(QString(annotationHere->reference.name), RAddressString(referenceAddr)));
|
||||||
} else if (flagDetails) {
|
} else if (flagDetails) {
|
||||||
@ -386,16 +386,16 @@ void DecompilerContextMenu::actionDeleteCommentTriggered()
|
|||||||
|
|
||||||
void DecompilerContextMenu::actionRenameThingHereTriggered()
|
void DecompilerContextMenu::actionRenameThingHereTriggered()
|
||||||
{
|
{
|
||||||
if (!annotationHere || annotationHere->type == R_CODE_ANNOTATION_TYPE_CONSTANT_VARIABLE) {
|
if (!annotationHere || annotationHere->type == RZ_CODE_ANNOTATION_TYPE_CONSTANT_VARIABLE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RCoreLocked core = Core()->core();
|
RzCoreLocked core = Core()->core();
|
||||||
bool ok;
|
bool ok;
|
||||||
auto type = annotationHere->type;
|
auto type = annotationHere->type;
|
||||||
if (type == R_CODE_ANNOTATION_TYPE_FUNCTION_NAME) {
|
if (type == RZ_CODE_ANNOTATION_TYPE_FUNCTION_NAME) {
|
||||||
QString currentName(annotationHere->reference.name);
|
QString currentName(annotationHere->reference.name);
|
||||||
RVA func_addr = annotationHere->reference.offset;
|
RVA func_addr = annotationHere->reference.offset;
|
||||||
RAnalFunction *func = Core()->functionAt(func_addr);
|
RzAnalFunction *func = Core()->functionAt(func_addr);
|
||||||
if (func == NULL) {
|
if (func == NULL) {
|
||||||
QString function_name = QInputDialog::getText(this,
|
QString function_name = QInputDialog::getText(this,
|
||||||
tr("Define this function at %2").arg(RAddressString(func_addr)),
|
tr("Define this function at %2").arg(RAddressString(func_addr)),
|
||||||
@ -410,9 +410,9 @@ void DecompilerContextMenu::actionRenameThingHereTriggered()
|
|||||||
Core()->renameFunction(func_addr, newName);
|
Core()->renameFunction(func_addr, newName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (type == R_CODE_ANNOTATION_TYPE_GLOBAL_VARIABLE) {
|
} else if (type == RZ_CODE_ANNOTATION_TYPE_GLOBAL_VARIABLE) {
|
||||||
RVA var_addr = annotationHere->reference.offset;
|
RVA var_addr = annotationHere->reference.offset;
|
||||||
RFlagItem *flagDetails = r_flag_get_i(core->flags, var_addr);
|
RzFlagItem *flagDetails = rz_flag_get_i(core->flags, var_addr);
|
||||||
if (flagDetails) {
|
if (flagDetails) {
|
||||||
QString newName = QInputDialog::getText(this, tr("Rename %2").arg(flagDetails->name),
|
QString newName = QInputDialog::getText(this, tr("Rename %2").arg(flagDetails->name),
|
||||||
tr("Enter name"), QLineEdit::Normal, flagDetails->name, &ok);
|
tr("Enter name"), QLineEdit::Normal, flagDetails->name, &ok);
|
||||||
@ -470,7 +470,7 @@ void DecompilerContextMenu::actionXRefsTriggered()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
XrefsDialog dialog(mainWindow, nullptr);
|
XrefsDialog dialog(mainWindow, nullptr);
|
||||||
QString displayString = (annotationHere->type == R_CODE_ANNOTATION_TYPE_FUNCTION_NAME) ? QString(
|
QString displayString = (annotationHere->type == RZ_CODE_ANNOTATION_TYPE_FUNCTION_NAME) ? QString(
|
||||||
annotationHere->reference.name) : RAddressString(annotationHere->reference.offset);
|
annotationHere->reference.name) : RAddressString(annotationHere->reference.offset);
|
||||||
dialog.fillRefsForAddress(annotationHere->reference.offset, displayString, false);
|
dialog.fillRefsForAddress(annotationHere->reference.offset, displayString, false);
|
||||||
dialog.exec();
|
dialog.exec();
|
||||||
@ -549,22 +549,22 @@ void DecompilerContextMenu::updateTargetMenuActions()
|
|||||||
action->deleteLater();
|
action->deleteLater();
|
||||||
}
|
}
|
||||||
showTargetMenuActions.clear();
|
showTargetMenuActions.clear();
|
||||||
RCoreLocked core = Core()->core();
|
RzCoreLocked core = Core()->core();
|
||||||
if (isReference()) {
|
if (isReference()) {
|
||||||
QString name;
|
QString name;
|
||||||
QMenu *menu;
|
QMenu *menu;
|
||||||
if (annotationHere->type == R_CODE_ANNOTATION_TYPE_GLOBAL_VARIABLE
|
if (annotationHere->type == RZ_CODE_ANNOTATION_TYPE_GLOBAL_VARIABLE
|
||||||
|| annotationHere->type == R_CODE_ANNOTATION_TYPE_CONSTANT_VARIABLE) {
|
|| annotationHere->type == RZ_CODE_ANNOTATION_TYPE_CONSTANT_VARIABLE) {
|
||||||
menu = mainWindow->createShowInMenu(this, annotationHere->reference.offset,
|
menu = mainWindow->createShowInMenu(this, annotationHere->reference.offset,
|
||||||
MainWindow::AddressTypeHint::Data);
|
MainWindow::AddressTypeHint::Data);
|
||||||
RVA var_addr = annotationHere->reference.offset;
|
RVA var_addr = annotationHere->reference.offset;
|
||||||
RFlagItem *flagDetails = r_flag_get_i(core->flags, var_addr);
|
RzFlagItem *flagDetails = rz_flag_get_i(core->flags, var_addr);
|
||||||
if (flagDetails) {
|
if (flagDetails) {
|
||||||
name = tr("Show %1 in").arg(flagDetails->name);
|
name = tr("Show %1 in").arg(flagDetails->name);
|
||||||
} else {
|
} else {
|
||||||
name = tr("Show %1 in").arg(RAddressString(annotationHere->reference.offset));
|
name = tr("Show %1 in").arg(RAddressString(annotationHere->reference.offset));
|
||||||
}
|
}
|
||||||
} else if (annotationHere->type == R_CODE_ANNOTATION_TYPE_FUNCTION_NAME) {
|
} else if (annotationHere->type == RZ_CODE_ANNOTATION_TYPE_FUNCTION_NAME) {
|
||||||
menu = mainWindow->createShowInMenu(this, annotationHere->reference.offset,
|
menu = mainWindow->createShowInMenu(this, annotationHere->reference.offset,
|
||||||
MainWindow::AddressTypeHint::Function);
|
MainWindow::AddressTypeHint::Function);
|
||||||
name = tr("%1 (%2)").arg(QString(annotationHere->reference.name),
|
name = tr("%1 (%2)").arg(QString(annotationHere->reference.name),
|
||||||
@ -579,12 +579,12 @@ void DecompilerContextMenu::updateTargetMenuActions()
|
|||||||
|
|
||||||
bool DecompilerContextMenu::isReference()
|
bool DecompilerContextMenu::isReference()
|
||||||
{
|
{
|
||||||
return (annotationHere && r_annotation_is_reference(annotationHere));
|
return (annotationHere && rz_annotation_is_reference(annotationHere));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DecompilerContextMenu::isFunctionVariable()
|
bool DecompilerContextMenu::isFunctionVariable()
|
||||||
{
|
{
|
||||||
return (annotationHere && r_annotation_is_variable(annotationHere));
|
return (annotationHere && rz_annotation_is_variable(annotationHere));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DecompilerContextMenu::variablePresentInR2()
|
bool DecompilerContextMenu::variablePresentInR2()
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QKeySequence>
|
#include <QKeySequence>
|
||||||
|
|
||||||
#include <r_util/r_annotated_code.h>
|
#include <rz_util/rz_annotated_code.h>
|
||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ public:
|
|||||||
~DecompilerContextMenu();
|
~DecompilerContextMenu();
|
||||||
|
|
||||||
bool getIsTogglingBreakpoints();
|
bool getIsTogglingBreakpoints();
|
||||||
void setAnnotationHere(RCodeAnnotation *annotation);
|
void setAnnotationHere(RzCodeAnnotation *annotation);
|
||||||
RVA getFirstOffsetInLine();
|
RVA getFirstOffsetInLine();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -78,7 +78,7 @@ private:
|
|||||||
* Context-related annotation for the data under cursor in the decompiler widget.
|
* Context-related annotation for the data under cursor in the decompiler widget.
|
||||||
* If such an annotation doesn't exist, its value is nullptr.
|
* If such an annotation doesn't exist, its value is nullptr.
|
||||||
*/
|
*/
|
||||||
RCodeAnnotation *annotationHere;
|
RzCodeAnnotation *annotationHere;
|
||||||
|
|
||||||
// Actions and menus in the context menu
|
// Actions and menus in the context menu
|
||||||
QAction actionCopy;
|
QAction actionCopy;
|
||||||
|
@ -372,8 +372,8 @@ void DisassemblyContextMenu::setCurHighlightedWord(const QString &text)
|
|||||||
DisassemblyContextMenu::ThingUsedHere DisassemblyContextMenu::getThingAt(ut64 address)
|
DisassemblyContextMenu::ThingUsedHere DisassemblyContextMenu::getThingAt(ut64 address)
|
||||||
{
|
{
|
||||||
ThingUsedHere tuh;
|
ThingUsedHere tuh;
|
||||||
RAnalFunction *fcn = Core()->functionAt(address);
|
RzAnalFunction *fcn = Core()->functionAt(address);
|
||||||
RFlagItem *flag = r_flag_get_i(Core()->core()->flags, address);
|
RzFlagItem *flag = rz_flag_get_i(Core()->core()->flags, address);
|
||||||
|
|
||||||
// We will lookup through existing r2 types to find something relevant
|
// We will lookup through existing r2 types to find something relevant
|
||||||
|
|
||||||
@ -560,7 +560,7 @@ void DisassemblyContextMenu::aboutToShowSlot()
|
|||||||
setupRenaming();
|
setupRenaming();
|
||||||
|
|
||||||
// Only show retype for local vars if in a function
|
// Only show retype for local vars if in a function
|
||||||
RAnalFunction *in_fcn = Core()->functionIn(offset);
|
RzAnalFunction *in_fcn = Core()->functionIn(offset);
|
||||||
if (in_fcn) {
|
if (in_fcn) {
|
||||||
auto vars = Core()->getVariables(offset);
|
auto vars = Core()->getVariables(offset);
|
||||||
actionSetFunctionVarTypes.setVisible(!vars.empty());
|
actionSetFunctionVarTypes.setVisible(!vars.empty());
|
||||||
@ -835,7 +835,7 @@ void DisassemblyContextMenu::on_actionRename_triggered()
|
|||||||
FlagDialog dialog(doRenameInfo.addr, this->mainWindow);
|
FlagDialog dialog(doRenameInfo.addr, this->mainWindow);
|
||||||
ok = dialog.exec();
|
ok = dialog.exec();
|
||||||
} else if (doRenameAction == RENAME_LOCAL) {
|
} else if (doRenameAction == RENAME_LOCAL) {
|
||||||
RAnalFunction *fcn = Core()->functionIn(offset);
|
RzAnalFunction *fcn = Core()->functionIn(offset);
|
||||||
if (fcn) {
|
if (fcn) {
|
||||||
EditVariablesDialog dialog(fcn->addr, curHighlightedWord, this->mainWindow);
|
EditVariablesDialog dialog(fcn->addr, curHighlightedWord, this->mainWindow);
|
||||||
if (!dialog.empty()) {
|
if (!dialog.empty()) {
|
||||||
@ -858,7 +858,7 @@ void DisassemblyContextMenu::on_actionRename_triggered()
|
|||||||
|
|
||||||
void DisassemblyContextMenu::on_actionSetFunctionVarTypes_triggered()
|
void DisassemblyContextMenu::on_actionSetFunctionVarTypes_triggered()
|
||||||
{
|
{
|
||||||
RAnalFunction *fcn = Core()->functionIn(offset);
|
RzAnalFunction *fcn = Core()->functionIn(offset);
|
||||||
|
|
||||||
if (!fcn) {
|
if (!fcn) {
|
||||||
QMessageBox::critical(this, tr("Re-type Local Variables"),
|
QMessageBox::critical(this, tr("Re-type Local Variables"),
|
||||||
@ -1002,9 +1002,9 @@ void DisassemblyContextMenu::on_actionDeleteFunction_triggered()
|
|||||||
|
|
||||||
void DisassemblyContextMenu::on_actionEditFunction_triggered()
|
void DisassemblyContextMenu::on_actionEditFunction_triggered()
|
||||||
{
|
{
|
||||||
RCore *core = Core()->core();
|
RzCore *core = Core()->core();
|
||||||
EditFunctionDialog dialog(mainWindow);
|
EditFunctionDialog dialog(mainWindow);
|
||||||
RAnalFunction *fcn = r_anal_get_fcn_in(core->anal, offset, 0);
|
RzAnalFunction *fcn = rz_anal_get_fcn_in(core->anal, offset, 0);
|
||||||
|
|
||||||
if (fcn) {
|
if (fcn) {
|
||||||
dialog.setWindowTitle(tr("Edit function %1").arg(fcn->name));
|
dialog.setWindowTitle(tr("Edit function %1").arg(fcn->name));
|
||||||
|
@ -108,7 +108,7 @@ QVector<QDir> PluginManager::getPluginDirectories() const
|
|||||||
{
|
{
|
||||||
auto plugdir = QDir(QCoreApplication::applicationDirPath()); // appdir/bin
|
auto plugdir = QDir(QCoreApplication::applicationDirPath()); // appdir/bin
|
||||||
plugdir.cdUp(); // appdir
|
plugdir.cdUp(); // appdir
|
||||||
if (plugdir.cd("share/RadareOrg/Cutter/plugins")) { // appdir/share/RadareOrg/Cutter/plugins
|
if (plugdir.cd("share/RizinOrg/Cutter/plugins")) { // appdir/share/RizinOrg/Cutter/plugins
|
||||||
result.push_back(plugdir);
|
result.push_back(plugdir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,13 +32,13 @@ int BreakpointModel::columnCount(const QModelIndex &) const
|
|||||||
|
|
||||||
static QString formatHwBreakpoint(int permission) {
|
static QString formatHwBreakpoint(int permission) {
|
||||||
char data[] = "rwx";
|
char data[] = "rwx";
|
||||||
if ((permission & (R_BP_PROT_READ | R_BP_PROT_ACCESS)) == 0) {
|
if ((permission & (RZ_BP_PROT_READ | RZ_BP_PROT_ACCESS)) == 0) {
|
||||||
data[0] = '-';
|
data[0] = '-';
|
||||||
}
|
}
|
||||||
if ((permission & (R_BP_PROT_WRITE | R_BP_PROT_ACCESS)) == 0) {
|
if ((permission & (RZ_BP_PROT_WRITE | RZ_BP_PROT_ACCESS)) == 0) {
|
||||||
data[1] = '-';
|
data[1] = '-';
|
||||||
}
|
}
|
||||||
if ((permission & R_BP_PROT_EXEC) == 0) {
|
if ((permission & RZ_BP_PROT_EXEC) == 0) {
|
||||||
data[2] = '-';
|
data[2] = '-';
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
|
@ -373,7 +373,7 @@ void ConsoleWidget::updateCompletion()
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto current = ui->r2InputLineEdit->text();
|
auto current = ui->r2InputLineEdit->text();
|
||||||
auto completions = Core()->autocomplete(current, R_LINE_PROMPT_DEFAULT);
|
auto completions = Core()->autocomplete(current, RZ_LINE_PROMPT_DEFAULT);
|
||||||
int lastSpace = current.lastIndexOf(' ');
|
int lastSpace = current.lastIndexOf(' ');
|
||||||
if (lastSpace >= 0) {
|
if (lastSpace >= 0) {
|
||||||
current = current.left(lastSpace + 1);
|
current = current.left(lastSpace + 1);
|
||||||
|
@ -31,7 +31,7 @@ DecompilerWidget::DecompilerWidget(MainWindow *main) :
|
|||||||
previousFunctionAddr(RVA_INVALID),
|
previousFunctionAddr(RVA_INVALID),
|
||||||
decompiledFunctionAddr(RVA_INVALID),
|
decompiledFunctionAddr(RVA_INVALID),
|
||||||
code(Decompiler::makeWarning(tr("Choose an offset and refresh to get decompiled code")),
|
code(Decompiler::makeWarning(tr("Choose an offset and refresh to get decompiled code")),
|
||||||
&r_annotated_code_free)
|
&rz_annotated_code_free)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setObjectName(main
|
setObjectName(main
|
||||||
@ -58,8 +58,8 @@ DecompilerWidget::DecompilerWidget(MainWindow *main) :
|
|||||||
auto decompilers = Core()->getDecompilers();
|
auto decompilers = Core()->getDecompilers();
|
||||||
QString selectedDecompilerId = Config()->getSelectedDecompiler();
|
QString selectedDecompilerId = Config()->getSelectedDecompiler();
|
||||||
if (selectedDecompilerId.isEmpty()) {
|
if (selectedDecompilerId.isEmpty()) {
|
||||||
// If no decompiler was previously chosen. set r2ghidra as default decompiler
|
// If no decompiler was previously chosen. set rz-ghidra as default decompiler
|
||||||
selectedDecompilerId = "r2ghidra";
|
selectedDecompilerId = "ghidra";
|
||||||
}
|
}
|
||||||
for (Decompiler *dec : decompilers) {
|
for (Decompiler *dec : decompilers) {
|
||||||
ui->decompilerComboBox->addItem(dec->getName(), dec->getId());
|
ui->decompilerComboBox->addItem(dec->getName(), dec->getId());
|
||||||
@ -124,9 +124,9 @@ ut64 DecompilerWidget::offsetForPosition(size_t pos)
|
|||||||
size_t closestPos = SIZE_MAX;
|
size_t closestPos = SIZE_MAX;
|
||||||
ut64 closestOffset = mCtxMenu->getFirstOffsetInLine();
|
ut64 closestOffset = mCtxMenu->getFirstOffsetInLine();
|
||||||
void *iter;
|
void *iter;
|
||||||
r_vector_foreach(&code->annotations, iter) {
|
rz_vector_foreach(&code->annotations, iter) {
|
||||||
RCodeAnnotation *annotation = (RCodeAnnotation *)iter;
|
RzCodeAnnotation *annotation = (RzCodeAnnotation *)iter;
|
||||||
if (annotation->type != R_CODE_ANNOTATION_TYPE_OFFSET || annotation->start > pos
|
if (annotation->type != RZ_CODE_ANNOTATION_TYPE_OFFSET || annotation->start > pos
|
||||||
|| annotation->end <= pos) {
|
|| annotation->end <= pos) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -144,9 +144,9 @@ size_t DecompilerWidget::positionForOffset(ut64 offset)
|
|||||||
size_t closestPos = SIZE_MAX;
|
size_t closestPos = SIZE_MAX;
|
||||||
ut64 closestOffset = UT64_MAX;
|
ut64 closestOffset = UT64_MAX;
|
||||||
void *iter;
|
void *iter;
|
||||||
r_vector_foreach(&code->annotations, iter) {
|
rz_vector_foreach(&code->annotations, iter) {
|
||||||
RCodeAnnotation *annotation = (RCodeAnnotation *)iter;
|
RzCodeAnnotation *annotation = (RzCodeAnnotation *)iter;
|
||||||
if (annotation->type != R_CODE_ANNOTATION_TYPE_OFFSET || annotation->offset.offset > offset) {
|
if (annotation->type != RZ_CODE_ANNOTATION_TYPE_OFFSET || annotation->offset.offset > offset) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (closestOffset != UT64_MAX && closestOffset >= annotation->offset.offset) {
|
if (closestOffset != UT64_MAX && closestOffset >= annotation->offset.offset) {
|
||||||
@ -188,14 +188,14 @@ void DecompilerWidget::setInfoForBreakpoints()
|
|||||||
gatherBreakpointInfo(*code, startPos, endPos);
|
gatherBreakpointInfo(*code, startPos, endPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecompilerWidget::gatherBreakpointInfo(RAnnotatedCode &codeDecompiled, size_t startPos,
|
void DecompilerWidget::gatherBreakpointInfo(RzAnnotatedCode &codeDecompiled, size_t startPos,
|
||||||
size_t endPos)
|
size_t endPos)
|
||||||
{
|
{
|
||||||
RVA firstOffset = RVA_MAX;
|
RVA firstOffset = RVA_MAX;
|
||||||
void *iter;
|
void *iter;
|
||||||
r_vector_foreach(&codeDecompiled.annotations, iter) {
|
rz_vector_foreach(&codeDecompiled.annotations, iter) {
|
||||||
RCodeAnnotation *annotation = (RCodeAnnotation *)iter;
|
RzCodeAnnotation *annotation = (RzCodeAnnotation *)iter;
|
||||||
if (annotation->type != R_CODE_ANNOTATION_TYPE_OFFSET) {
|
if (annotation->type != RZ_CODE_ANNOTATION_TYPE_OFFSET) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((startPos <= annotation->start && annotation->start < endPos) || (startPos < annotation->end
|
if ((startPos <= annotation->start && annotation->start < endPos) || (startPos < annotation->end
|
||||||
@ -284,7 +284,7 @@ QTextCursor DecompilerWidget::getCursorForAddress(RVA addr)
|
|||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecompilerWidget::decompilationFinished(RAnnotatedCode *codeDecompiled)
|
void DecompilerWidget::decompilationFinished(RzAnnotatedCode *codeDecompiled)
|
||||||
{
|
{
|
||||||
bool isDisplayReset = false;
|
bool isDisplayReset = false;
|
||||||
if (previousFunctionAddr == decompiledFunctionAddr) {
|
if (previousFunctionAddr == decompiledFunctionAddr) {
|
||||||
@ -315,9 +315,9 @@ void DecompilerWidget::decompilationFinished(RAnnotatedCode *codeDecompiled)
|
|||||||
lowestOffsetInCode = RVA_MAX;
|
lowestOffsetInCode = RVA_MAX;
|
||||||
highestOffsetInCode = 0;
|
highestOffsetInCode = 0;
|
||||||
void *iter;
|
void *iter;
|
||||||
r_vector_foreach(&code->annotations, iter) {
|
rz_vector_foreach(&code->annotations, iter) {
|
||||||
RCodeAnnotation *annotation = (RCodeAnnotation *)iter;
|
RzCodeAnnotation *annotation = (RzCodeAnnotation *)iter;
|
||||||
if (annotation->type == R_CODE_ANNOTATION_TYPE_OFFSET) {
|
if (annotation->type == RZ_CODE_ANNOTATION_TYPE_OFFSET) {
|
||||||
if (lowestOffsetInCode > annotation->offset.offset) {
|
if (lowestOffsetInCode > annotation->offset.offset) {
|
||||||
lowestOffsetInCode = annotation->offset.offset;
|
lowestOffsetInCode = annotation->offset.offset;
|
||||||
}
|
}
|
||||||
@ -336,12 +336,12 @@ void DecompilerWidget::decompilationFinished(RAnnotatedCode *codeDecompiled)
|
|||||||
|
|
||||||
void DecompilerWidget::setAnnotationsAtCursor(size_t pos)
|
void DecompilerWidget::setAnnotationsAtCursor(size_t pos)
|
||||||
{
|
{
|
||||||
RCodeAnnotation *annotationAtPos = nullptr;
|
RzCodeAnnotation *annotationAtPos = nullptr;
|
||||||
void *iter;
|
void *iter;
|
||||||
r_vector_foreach(&this->code->annotations, iter) {
|
rz_vector_foreach(&this->code->annotations, iter) {
|
||||||
RCodeAnnotation *annotation = (RCodeAnnotation *)iter;
|
RzCodeAnnotation *annotation = (RzCodeAnnotation *)iter;
|
||||||
if (annotation->type == R_CODE_ANNOTATION_TYPE_OFFSET ||
|
if (annotation->type == RZ_CODE_ANNOTATION_TYPE_OFFSET ||
|
||||||
annotation->type == R_CODE_ANNOTATION_TYPE_SYNTAX_HIGHLIGHT ||
|
annotation->type == RZ_CODE_ANNOTATION_TYPE_SYNTAX_HIGHLIGHT ||
|
||||||
annotation->start > pos || annotation->end <= pos) {
|
annotation->start > pos || annotation->end <= pos) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -444,7 +444,7 @@ void DecompilerWidget::updateSelection()
|
|||||||
|
|
||||||
QString DecompilerWidget::getWindowTitle() const
|
QString DecompilerWidget::getWindowTitle() const
|
||||||
{
|
{
|
||||||
RAnalFunction *fcn = Core()->functionAt(decompiledFunctionAddr);
|
RzAnalFunction *fcn = Core()->functionAt(decompiledFunctionAddr);
|
||||||
QString windowTitle = tr("Decompiler");
|
QString windowTitle = tr("Decompiler");
|
||||||
if (fcn != NULL) {
|
if (fcn != NULL) {
|
||||||
windowTitle += " (" + QString(fcn->name) + ")";
|
windowTitle += " (" + QString(fcn->name) + ")";
|
||||||
@ -566,12 +566,12 @@ bool DecompilerWidget::addressInRange(RVA addr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert annotation ranges from byte offsets in utf8 used by RAnnotated code to QString QChars used by QString
|
* Convert annotation ranges from byte offsets in utf8 used by RzAnnotated code to QString QChars used by QString
|
||||||
* and Qt text editor.
|
* and Qt text editor.
|
||||||
* @param code - RAnnotated code with annotations that need to be modified
|
* @param code - RzAnnotated code with annotations that need to be modified
|
||||||
* @return Decompiled code
|
* @return Decompiled code
|
||||||
*/
|
*/
|
||||||
static QString remapAnnotationOffsetsToQString(RAnnotatedCode &code)
|
static QString remapAnnotationOffsetsToQString(RzAnnotatedCode &code)
|
||||||
{
|
{
|
||||||
QByteArray bytes(code.code);
|
QByteArray bytes(code.code);
|
||||||
QString text;
|
QString text;
|
||||||
@ -598,15 +598,15 @@ static QString remapAnnotationOffsetsToQString(RAnnotatedCode &code)
|
|||||||
};
|
};
|
||||||
|
|
||||||
void *iter;
|
void *iter;
|
||||||
r_vector_foreach(&code.annotations, iter) {
|
rz_vector_foreach(&code.annotations, iter) {
|
||||||
RCodeAnnotation *annotation = (RCodeAnnotation *)iter;
|
RzCodeAnnotation *annotation = (RzCodeAnnotation *)iter;
|
||||||
annotation->start = mapPos(annotation->start);
|
annotation->start = mapPos(annotation->start);
|
||||||
annotation->end = mapPos(annotation->end);
|
annotation->end = mapPos(annotation->end);
|
||||||
}
|
}
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecompilerWidget::setCode(RAnnotatedCode *code)
|
void DecompilerWidget::setCode(RzAnnotatedCode *code)
|
||||||
{
|
{
|
||||||
connectCursorPositionChanged(false);
|
connectCursorPositionChanged(false);
|
||||||
if (auto highlighter = qobject_cast<DecompilerHighlighter*>(syntaxHighlighter.get())) {
|
if (auto highlighter = qobject_cast<DecompilerHighlighter*>(syntaxHighlighter.get())) {
|
||||||
|
@ -54,7 +54,7 @@ private slots:
|
|||||||
* - Auto-refresh is disabled.
|
* - Auto-refresh is disabled.
|
||||||
*/
|
*/
|
||||||
void seekChanged();
|
void seekChanged();
|
||||||
void decompilationFinished(RAnnotatedCode *code);
|
void decompilationFinished(RzAnnotatedCode *code);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Ui::DecompilerWidget> ui;
|
std::unique_ptr<Ui::DecompilerWidget> ui;
|
||||||
@ -76,7 +76,7 @@ private:
|
|||||||
int scrollerVertical;
|
int scrollerVertical;
|
||||||
RVA previousFunctionAddr;
|
RVA previousFunctionAddr;
|
||||||
RVA decompiledFunctionAddr;
|
RVA decompiledFunctionAddr;
|
||||||
std::unique_ptr<RAnnotatedCode, void (*)(RAnnotatedCode *)> code;
|
std::unique_ptr<RzAnnotatedCode, void (*)(RzAnnotatedCode *)> code;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies the lowest offset of instructions among all the instructions in the decompiled function.
|
* Specifies the lowest offset of instructions among all the instructions in the decompiled function.
|
||||||
@ -183,17 +183,17 @@ private:
|
|||||||
void highlightBreakpoints();
|
void highlightBreakpoints();
|
||||||
/**
|
/**
|
||||||
* @brief Finds the earliest offset and breakpoints within the specified range [startPos, endPos]
|
* @brief Finds the earliest offset and breakpoints within the specified range [startPos, endPos]
|
||||||
* in the specified RAnnotatedCode.
|
* in the specified RzAnnotatedCode.
|
||||||
*
|
*
|
||||||
* This function is supposed to be used for finding the earliest offset and breakpoints within the specified range
|
* This function is supposed to be used for finding the earliest offset and breakpoints within the specified range
|
||||||
* [startPos, endPos]. This will set the value of the variables 'RVA firstOffsetInLine' and 'QVector<RVA> availableBreakpoints' in
|
* [startPos, endPos]. This will set the value of the variables 'RVA firstOffsetInLine' and 'QVector<RVA> availableBreakpoints' in
|
||||||
* the context menu.
|
* the context menu.
|
||||||
*
|
*
|
||||||
* @param codeDecompiled - A reference to the RAnnotatedCode for the function that is decompiled.
|
* @param codeDecompiled - A reference to the RzAnnotatedCode for the function that is decompiled.
|
||||||
* @param startPos - Position of the start of the range(inclusive).
|
* @param startPos - Position of the start of the range(inclusive).
|
||||||
* @param endPos - Position of the end of the range(inclusive).
|
* @param endPos - Position of the end of the range(inclusive).
|
||||||
*/
|
*/
|
||||||
void gatherBreakpointInfo(RAnnotatedCode &codeDecompiled, size_t startPos, size_t endPos);
|
void gatherBreakpointInfo(RzAnnotatedCode &codeDecompiled, size_t startPos, size_t endPos);
|
||||||
/**
|
/**
|
||||||
* @brief Finds the offset that's closest to the specified position in the decompiled code.
|
* @brief Finds the offset that's closest to the specified position in the decompiled code.
|
||||||
*
|
*
|
||||||
@ -235,7 +235,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
bool addressInRange(RVA addr);
|
bool addressInRange(RVA addr);
|
||||||
|
|
||||||
void setCode(RAnnotatedCode *code);
|
void setCode(RzAnnotatedCode *code);
|
||||||
|
|
||||||
void setHighlighter(bool annotationBasedHighlighter);
|
void setHighlighter(bool annotationBasedHighlighter);
|
||||||
};
|
};
|
||||||
|
@ -177,7 +177,7 @@ void DisassemblerGraphView::loadCurrentGraph()
|
|||||||
.set("asm.lines.fcn", false);
|
.set("asm.lines.fcn", false);
|
||||||
|
|
||||||
QJsonArray functions;
|
QJsonArray functions;
|
||||||
RAnalFunction *fcn = Core()->functionIn(seekable->getOffset());
|
RzAnalFunction *fcn = Core()->functionIn(seekable->getOffset());
|
||||||
if (fcn) {
|
if (fcn) {
|
||||||
currentFcnAddr = fcn->addr;
|
currentFcnAddr = fcn->addr;
|
||||||
QJsonDocument functionsDoc = Core()->cmdj("agJ " + RAddressString(fcn->addr));
|
QJsonDocument functionsDoc = Core()->cmdj("agJ " + RAddressString(fcn->addr));
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "ui_ProcessesWidget.h"
|
#include "ui_ProcessesWidget.h"
|
||||||
#include "common/JsonModel.h"
|
#include "common/JsonModel.h"
|
||||||
#include "QuickFilterView.h"
|
#include "QuickFilterView.h"
|
||||||
#include <r_debug.h>
|
#include <rz_debug.h>
|
||||||
|
|
||||||
#include "core/MainWindow.h"
|
#include "core/MainWindow.h"
|
||||||
|
|
||||||
@ -89,17 +89,17 @@ void ProcessesWidget::updateContents()
|
|||||||
QString ProcessesWidget::translateStatus(QString status)
|
QString ProcessesWidget::translateStatus(QString status)
|
||||||
{
|
{
|
||||||
switch (status.toStdString().c_str()[0]) {
|
switch (status.toStdString().c_str()[0]) {
|
||||||
case R_DBG_PROC_STOP:
|
case RZ_DBG_PROC_STOP:
|
||||||
return "Stopped";
|
return "Stopped";
|
||||||
case R_DBG_PROC_RUN:
|
case RZ_DBG_PROC_RUN:
|
||||||
return "Running";
|
return "Running";
|
||||||
case R_DBG_PROC_SLEEP:
|
case RZ_DBG_PROC_SLEEP:
|
||||||
return "Sleeping";
|
return "Sleeping";
|
||||||
case R_DBG_PROC_ZOMBIE:
|
case RZ_DBG_PROC_ZOMBIE:
|
||||||
return "Zombie";
|
return "Zombie";
|
||||||
case R_DBG_PROC_DEAD:
|
case RZ_DBG_PROC_DEAD:
|
||||||
return "Dead";
|
return "Dead";
|
||||||
case R_DBG_PROC_RAISED:
|
case RZ_DBG_PROC_RAISED:
|
||||||
return "Raised event";
|
return "Raised event";
|
||||||
default:
|
default:
|
||||||
return "Unknown status";
|
return "Unknown status";
|
||||||
@ -167,7 +167,7 @@ void ProcessesWidget::onActivated(const QModelIndex &index)
|
|||||||
for (QJsonValue value : processesValues) {
|
for (QJsonValue value : processesValues) {
|
||||||
QString status = value.toObject()["status"].toString();
|
QString status = value.toObject()["status"].toString();
|
||||||
if (pid == value.toObject()["pid"].toInt()) {
|
if (pid == value.toObject()["pid"].toInt()) {
|
||||||
if (QString(R_DBG_PROC_ZOMBIE) == status || QString(R_DBG_PROC_DEAD) == status) {
|
if (QString(RZ_DBG_PROC_ZOMBIE) == status || QString(RZ_DBG_PROC_DEAD) == status) {
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
msgBox.setText(tr("Unable to switch to the requested process."));
|
msgBox.setText(tr("Unable to switch to the requested process."));
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "ui_ThreadsWidget.h"
|
#include "ui_ThreadsWidget.h"
|
||||||
#include "common/JsonModel.h"
|
#include "common/JsonModel.h"
|
||||||
#include "QuickFilterView.h"
|
#include "QuickFilterView.h"
|
||||||
#include <r_debug.h>
|
#include <rz_debug.h>
|
||||||
|
|
||||||
#include "core/MainWindow.h"
|
#include "core/MainWindow.h"
|
||||||
|
|
||||||
@ -88,17 +88,17 @@ void ThreadsWidget::updateContents()
|
|||||||
QString ThreadsWidget::translateStatus(QString status)
|
QString ThreadsWidget::translateStatus(QString status)
|
||||||
{
|
{
|
||||||
switch (status.toStdString().c_str()[0]) {
|
switch (status.toStdString().c_str()[0]) {
|
||||||
case R_DBG_PROC_STOP:
|
case RZ_DBG_PROC_STOP:
|
||||||
return "Stopped";
|
return "Stopped";
|
||||||
case R_DBG_PROC_RUN:
|
case RZ_DBG_PROC_RUN:
|
||||||
return "Running";
|
return "Running";
|
||||||
case R_DBG_PROC_SLEEP:
|
case RZ_DBG_PROC_SLEEP:
|
||||||
return "Sleeping";
|
return "Sleeping";
|
||||||
case R_DBG_PROC_ZOMBIE:
|
case RZ_DBG_PROC_ZOMBIE:
|
||||||
return "Zombie";
|
return "Zombie";
|
||||||
case R_DBG_PROC_DEAD:
|
case RZ_DBG_PROC_DEAD:
|
||||||
return "Dead";
|
return "Dead";
|
||||||
case R_DBG_PROC_RAISED:
|
case RZ_DBG_PROC_RAISED:
|
||||||
return "Raised event";
|
return "Raised event";
|
||||||
default:
|
default:
|
||||||
return "Unknown status";
|
return "Unknown status";
|
||||||
|
Loading…
Reference in New Issue
Block a user