├── .clang-format ├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── config.yml │ ├── documentation.md │ └── feature_request.md ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── LICENSE ├── README.md ├── api ├── CMakeLists.txt ├── debugadaptertype.cpp ├── debuggerapi.h ├── debuggercontroller.cpp ├── ffi.h ├── python │ ├── CMakeLists.txt │ ├── __init__.py │ ├── _debuggercore_template.py │ ├── debugadaptertype.py │ ├── debuggercontroller.py │ └── generator.cpp └── utility.cpp ├── build.md ├── cli ├── CMakeLists.txt ├── log.h └── main.cpp ├── core ├── CMakeLists.txt ├── adapters │ ├── corelliumadapter.cpp │ ├── corelliumadapter.h │ ├── dbgeng │ │ ├── amd64 │ │ │ ├── dbgcore.dll │ │ │ ├── dbgeng.dll │ │ │ ├── dbghelp.dll │ │ │ ├── dbgmodel.dll │ │ │ └── dbgsrv.exe │ │ ├── install_windbg.py │ │ └── x86 │ │ │ ├── dbgcore.dll │ │ │ ├── dbgeng.dll │ │ │ ├── dbghelp.dll │ │ │ ├── dbgmodel.dll │ │ │ └── dbgsrv.exe │ ├── dbgengadapter.cpp │ ├── dbgengadapter.h │ ├── dbgengttdadapter.cpp │ ├── dbgengttdadapter.h │ ├── esrevenadapter.cpp │ ├── esrevenadapter.h │ ├── gdb │ │ └── gdbserver.zip │ ├── gdbadapter.cpp │ ├── gdbadapter.h │ ├── lldbadapter.cpp │ ├── lldbadapter.h │ ├── lldbrspadapter.cpp │ ├── lldbrspadapter.h │ ├── localwindowskerneladapter.cpp │ ├── localwindowskerneladapter.h │ ├── queuedadapter.cpp │ ├── queuedadapter.h │ ├── rspconnector.cpp │ ├── rspconnector.h │ ├── socket.h │ ├── windowsdumpfile.cpp │ ├── windowsdumpfile.h │ ├── windowskerneladapter.cpp │ └── windowskerneladapter.h ├── debugadapter.cpp ├── debugadapter.h ├── debugadaptertype.cpp ├── debugadaptertype.h ├── debugger.cpp ├── debuggercommon.h ├── debuggercontroller.cpp ├── debuggercontroller.h ├── debuggerevent.h ├── debuggerexceptions.h ├── debuggerfileaccessor.cpp ├── debuggerfileaccessor.h ├── debuggerstate.cpp ├── debuggerstate.h ├── ffi.cpp ├── ffi_global.h ├── refcountobject.h ├── semaphore.cpp └── semaphore.h ├── debuggerui.qrc ├── docs ├── guide │ ├── corellium-remote-debugging.md │ ├── dbgeng-ttd.md │ ├── gdbrsp-ttd.md │ ├── index.md │ ├── remote-debugging.md │ └── windows-kd.md └── img │ └── debugger │ ├── adaptersettings.png │ ├── attachtopid.png │ ├── breakpointwidget.png │ ├── contextmenu.png │ ├── controlbuttons.png │ ├── dbgeng_ttd.png │ ├── debuggerconsole.png │ ├── debuggerinfo0.png │ ├── debuggerinfo1.png │ ├── debuggerinfo2.png │ ├── debuggermenu.png │ ├── debugserver-dbgeng.png │ ├── debugserver-lldb.png │ ├── expressionparser.png │ ├── gdbrsp_ttd.png │ ├── modulewidget.png │ ├── overrideip.png │ ├── platform-list.png │ ├── registerwidget.png │ ├── remoteadaptersettings.png │ ├── remoteprocess-gdbrsp.png │ ├── remoteprocess-lldb.png │ ├── stacktracewidget.png │ ├── stackvariable.png │ ├── statuswidget.png │ ├── targetterminal.png │ ├── threadwidgetcontextmenu.png │ ├── ttd_buttons.png │ ├── ttd_record.png │ ├── ui.png │ ├── windows-kd.png │ └── windows_dump_file.png ├── icons ├── add.png ├── breakpoint.png ├── cancel.png ├── cctv-camera.png ├── connect.png ├── debugger.png ├── disconnect.png ├── menu.png ├── pause.png ├── remove.png ├── restart.png ├── resume-reverse.png ├── resume.png ├── settings.png ├── start.png ├── step-back.png ├── step-into-reverse.png ├── step-into.png ├── step-out-reverse.png ├── step-out.png ├── step-over.png └── stop.png ├── poetry.lock ├── pyproject.toml ├── scripts ├── build.py ├── build_linux ├── build_linux-arm ├── build_macosx ├── build_win64.bat └── target_llvm_version.py ├── test ├── CMakeLists.txt ├── README.md ├── binaries │ ├── Darwin-arm64 │ │ ├── cat │ │ ├── commandline_test │ │ ├── do_exception │ │ ├── exitcode │ │ ├── getcwd │ │ ├── helloworld │ │ ├── helloworld_func │ │ ├── helloworld_func_pie │ │ ├── helloworld_loop │ │ ├── helloworld_loop_pie │ │ ├── helloworld_objc │ │ ├── helloworld_pie │ │ ├── helloworld_recursion │ │ ├── helloworld_recursion_pie │ │ ├── helloworld_thread │ │ ├── helloworld_thread_pie │ │ ├── helloworld_virtual │ │ ├── many_stdlib_calls │ │ ├── md5 │ │ ├── nopspeed │ │ └── read_input │ ├── Darwin-x86_64 │ │ ├── analysis_propagation │ │ ├── asmtest │ │ ├── cat │ │ ├── commandline_test │ │ ├── do_exception │ │ ├── exitcode │ │ ├── getcwd │ │ ├── hello │ │ ├── helloworld │ │ ├── helloworld_func │ │ ├── helloworld_func_pie │ │ ├── helloworld_loop │ │ ├── helloworld_loop_pie │ │ ├── helloworld_objc │ │ ├── helloworld_pie │ │ ├── helloworld_recursion │ │ ├── helloworld_recursion_pie │ │ ├── helloworld_thread │ │ ├── helloworld_thread_pie │ │ ├── helloworld_virtual │ │ ├── indirect_calls │ │ ├── many_stdlib_calls │ │ ├── md5 │ │ ├── missing_switch_case │ │ ├── nopspeed │ │ ├── read_input │ │ ├── undiscovered_func │ │ └── undiscovered_func2 │ ├── Linux-arm64 │ │ ├── cat │ │ ├── commandline_test │ │ ├── do_exception │ │ ├── exitcode │ │ ├── getcwd │ │ ├── helloworld │ │ ├── helloworld_func │ │ ├── helloworld_func_pie │ │ ├── helloworld_loop │ │ ├── helloworld_loop_pie │ │ ├── helloworld_pie │ │ ├── helloworld_recursion │ │ ├── helloworld_recursion_pie │ │ ├── helloworld_thread │ │ ├── helloworld_thread_pie │ │ ├── helloworld_virtual │ │ ├── many_stdlib_calls │ │ ├── md5 │ │ ├── nopspeed │ │ ├── read_input │ │ └── test_library │ ├── Linux-x86 │ │ ├── asmtest │ │ ├── cat │ │ ├── commandline_test │ │ ├── do_exception │ │ ├── exitcode │ │ ├── helloworld │ │ ├── helloworld_func │ │ ├── helloworld_func_pie │ │ ├── helloworld_loop │ │ ├── helloworld_loop_pie │ │ ├── helloworld_pie │ │ ├── helloworld_recursion │ │ ├── helloworld_recursion_pie │ │ ├── helloworld_thread │ │ ├── helloworld_thread_pie │ │ ├── helloworld_virtual │ │ ├── many_stdlib_calls │ │ ├── md5 │ │ └── nopspeed │ ├── Linux-x86_64 │ │ ├── analysis_propagation │ │ ├── asmtest │ │ ├── cat │ │ ├── commandline_test │ │ ├── do_exception │ │ ├── exitcode │ │ ├── hello │ │ ├── helloworld │ │ ├── helloworld_func │ │ ├── helloworld_func_pie │ │ ├── helloworld_loop │ │ ├── helloworld_loop_pie │ │ ├── helloworld_pie │ │ ├── helloworld_recursion │ │ ├── helloworld_recursion_pie │ │ ├── helloworld_thread │ │ ├── helloworld_thread_pie │ │ ├── helloworld_virtual │ │ ├── indirect_calls │ │ ├── many_stdlib_calls │ │ ├── md5 │ │ ├── missing_switch_case │ │ ├── nopspeed │ │ ├── undiscovered_func │ │ └── undiscovered_func2 │ ├── Windows-x86 │ │ ├── asmtest.exe │ │ ├── cat.exe │ │ ├── commandline_test.exe │ │ ├── do_exception.exe │ │ ├── exitcode.exe │ │ ├── helloworld.exe │ │ ├── helloworld_func.exe │ │ ├── helloworld_func_pie.exe │ │ ├── helloworld_loop.exe │ │ ├── helloworld_loop_pie.exe │ │ ├── helloworld_pie.exe │ │ ├── helloworld_recursion.exe │ │ ├── helloworld_recursion_pie.exe │ │ ├── helloworld_thread.exe │ │ ├── helloworld_thread_pie.exe │ │ ├── helloworld_virtual.exe │ │ ├── many_stdlib_calls.exe │ │ └── md5.exe │ ├── Windows-x86_64 │ │ ├── asmtest.exe │ │ ├── cat.exe │ │ ├── commandline_test.exe │ │ ├── do_exception.exe │ │ ├── exitcode.exe │ │ ├── hello.exe │ │ ├── helloworld.exe │ │ ├── helloworld_func.exe │ │ ├── helloworld_func_pie.exe │ │ ├── helloworld_loop.exe │ │ ├── helloworld_loop_pie.exe │ │ ├── helloworld_pie.exe │ │ ├── helloworld_recursion.exe │ │ ├── helloworld_recursion_pie.exe │ │ ├── helloworld_thread.exe │ │ ├── helloworld_thread_pie.exe │ │ ├── helloworld_virtual.exe │ │ ├── indirect_calls.exe │ │ ├── many_stdlib_calls.exe │ │ ├── md5.exe │ │ ├── missing_switch_case.exe │ │ └── undiscovered_func.exe │ ├── android-aarch64 │ │ ├── do_exception │ │ ├── exitcode │ │ ├── helloworld │ │ └── helloworld_loop │ └── ios-arm64 │ │ ├── do_exception │ │ ├── exitcode │ │ ├── helloworld │ │ └── helloworld_thread ├── debugger_test.py ├── debugserver-entitlements.plist ├── entitlements.plist └── src │ ├── analysis_propagation_x64-macos.lst │ ├── analysis_propagation_x64.asm │ ├── asmtest_aarch64-android.s │ ├── asmtest_armv7-android.s │ ├── asmtest_x64.asm │ ├── asmtest_x86.asm │ ├── cat.c │ ├── commandline_test.c │ ├── do_exception.c │ ├── execute_test.exe.manifest │ ├── exitcode.c │ ├── hello_x64.asm │ ├── helloworld.c │ ├── helloworld_func.c │ ├── helloworld_ios │ ├── helloworld_loop.c │ ├── helloworld_objc.m │ ├── helloworld_recursion.c │ ├── helloworld_thread.c │ ├── helloworld_virtual.cpp │ ├── hh1.asm │ ├── indirect_calls_x64.asm │ ├── many_stdlib_calls.c │ ├── md5 │ ├── Makefile-linux │ ├── Makefile-macos │ ├── global.h │ ├── md5.h │ ├── md5c.c │ └── md5driver.c │ ├── missing_switch_case_x64-macos.lst │ ├── missing_switch_case_x64.asm │ ├── nopspeed.c │ ├── read_input.c │ ├── rm_func_starts.py │ ├── undiscovered_func2_x64.asm │ └── undiscovered_func_x64.asm ├── ui ├── CMakeLists.txt ├── adaptersettings.cpp ├── adaptersettings.h ├── attachprocess.cpp ├── attachprocess.h ├── breakpointswidget.cpp ├── breakpointswidget.h ├── codedatarenderer.cpp ├── codedatarenderer.h ├── controlswidget.cpp ├── controlswidget.h ├── debugadapterscriptingprovider.cpp ├── debugadapterscriptingprovider.h ├── debuggerinfowidget.cpp ├── debuggerinfowidget.h ├── debuggerwidget.cpp ├── debuggerwidget.h ├── moduleswidget.cpp ├── moduleswidget.h ├── registerswidget.cpp ├── registerswidget.h ├── renderlayer.cpp ├── renderlayer.h ├── stackwidget.cpp ├── stackwidget.h ├── statusbar.cpp ├── statusbar.h ├── targetscriptingprovier.cpp ├── targetscriptingprovier.h ├── threadframes.cpp ├── threadframes.h ├── ttdrecord.cpp ├── ttdrecord.h ├── ui.cpp ├── ui.h ├── uinotification.cpp ├── uinotification.h └── uitypes.h └── vendor ├── .gitkeep └── pugixml ├── pugiconfig.hpp ├── pugixml.cpp └── pugixml.hpp /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | AccessModifierOffset: -4 3 | AlignAfterOpenBracket: DontAlign 4 | AlignConsecutiveMacros: 'true' 5 | AlignConsecutiveAssignments: 'false' 6 | AlignConsecutiveDeclarations: 'false' 7 | AlignEscapedNewlines: DontAlign 8 | AlignOperands: 'false' 9 | AlignTrailingComments: 'true' 10 | AllowAllArgumentsOnNextLine: 'true' 11 | AllowAllConstructorInitializersOnNextLine: 'false' 12 | AllowAllParametersOfDeclarationOnNextLine: 'false' 13 | AllowShortBlocksOnASingleLine: 'false' 14 | AllowShortCaseLabelsOnASingleLine: 'false' 15 | AllowShortFunctionsOnASingleLine: Inline 16 | AllowShortIfStatementsOnASingleLine: Never 17 | AllowShortLambdasOnASingleLine: Inline 18 | AllowShortLoopsOnASingleLine: 'false' 19 | AlwaysBreakAfterDefinitionReturnType: None 20 | AlwaysBreakAfterReturnType: None 21 | AlwaysBreakBeforeMultilineStrings: 'true' 22 | AlwaysBreakTemplateDeclarations: 'Yes' 23 | BinPackArguments: 'true' 24 | BinPackParameters: 'true' 25 | BreakBeforeBraces: Custom 26 | BraceWrapping: 27 | AfterCaseLabel: 'true' 28 | AfterClass: 'true' 29 | AfterControlStatement: 'true' 30 | AfterEnum: 'true' 31 | AfterFunction: 'true' 32 | AfterNamespace: 'false' 33 | AfterObjCDeclaration: 'true' 34 | AfterStruct: 'true' 35 | AfterUnion: 'true' 36 | AfterExternBlock: 'true' 37 | BeforeCatch: 'true' 38 | BeforeElse: 'true' 39 | IndentBraces: 'false' 40 | SplitEmptyFunction: 'false' 41 | SplitEmptyRecord: 'false' 42 | SplitEmptyNamespace: 'false' 43 | BreakBeforeBinaryOperators: NonAssignment 44 | BreakBeforeTernaryOperators: 'false' 45 | BreakConstructorInitializers: AfterColon 46 | BreakInheritanceList: AfterColon 47 | ColumnLimit: '120' 48 | CompactNamespaces: 'true' 49 | ConstructorInitializerAllOnOneLineOrOnePerLine: 'false' 50 | Cpp11BracedListStyle: 'true' 51 | DerivePointerAlignment: 'false' 52 | DisableFormat: 'false' 53 | EmptyLineBeforeAccessModifier: Always 54 | FixNamespaceComments: 'true' 55 | IncludeBlocks: Preserve 56 | IndentCaseLabels: 'false' 57 | IndentPPDirectives: BeforeHash 58 | IndentWrappedFunctionNames: 'true' 59 | KeepEmptyLinesAtTheStartOfBlocks: 'false' 60 | MaxEmptyLinesToKeep: '2' 61 | NamespaceIndentation: All 62 | PenaltyIndentedWhitespace: 100 63 | PointerAlignment: Left 64 | SortIncludes: 'false' 65 | SortUsingDeclarations: 'true' 66 | SpaceAfterCStyleCast: 'false' 67 | SpaceAfterLogicalNot: 'false' 68 | SpaceAfterTemplateKeyword: 'true' 69 | SpaceBeforeAssignmentOperators: 'true' 70 | SpaceBeforeCpp11BracedList: 'true' 71 | SpaceBeforeCtorInitializerColon: 'true' 72 | SpaceBeforeInheritanceColon: 'true' 73 | SpaceBeforeParens: ControlStatements 74 | SpaceBeforeRangeBasedForLoopColon: 'true' 75 | SpaceInEmptyParentheses: 'false' 76 | SpacesBeforeTrailingComments: '2' 77 | SpacesInAngles: 'false' 78 | SpacesInCStyleCastParentheses: 'false' 79 | SpacesInContainerLiterals: 'false' 80 | SpacesInParentheses: 'false' 81 | SpacesInSquareBrackets: 'false' 82 | IndentWidth: '4' 83 | TabWidth: '4' 84 | UseTab: AlignWithSpaces 85 | 86 | ... 87 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Create a bug report 3 | about: Describe your issue and help us improve Binary Ninja debugger 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Version and Platform (required):** 11 | - Binary Ninja Version: [e.g. 4.0.4000-dev] (if version is stable, please also test the latest development build via the "Update Channel" option) 12 | - OS: [e.g. Ubuntu Linux] 13 | - OS Version: [e.g. 22.04] 14 | - CPU Architecture: [e.g. x64 or M1] 15 | - Local or Remote Debugging: [e.g, local] 16 | 17 | **Bug Description:** 18 | Please provide a clear and concise description of what happened. 19 | 20 | **Steps To Reproduce:** 21 | Please provide all steps required to reproduce the behavior: 22 | 1. Open... 23 | 2. Launch it... 24 | 3. Interact with it... 25 | 4. See error 26 | 27 | **Expected Behavior:** 28 | Please provide a clear and concise description of what you *expected* to happen. 29 | 30 | **Screenshots/Video Recording:** 31 | If applicable, please add screenshots/video recording here to help explain your problem. 32 | 33 | **Binary:** 34 | If applicable, please provide us with the binary to help us work with the issue faster. 35 | This is especially helpful due to the dynamic nature of the debugger. 36 | Here are a few options: 37 | 38 | - Upload it privately using the [Binary Ninja Portal file uploader](https://portal.binary.ninja/upload) and add the provided reference phrase here 39 | - Directly attach it to this issue in a ZIP archive 40 | - Share a publicly accessible link to it (For malware samples, we do not have access to VirusTotal; [Malshare](https://malshare.com/) is an option) 41 | - Email it to binaryninja at vector35.com, or join our [slack](https://slack.binary.ninja/) and share with us in private 42 | - We understand sometimes it is not possible to share the binary -- sure, no worries, we can still work with it! 43 | - If your issue is general and not related to a specific binary, then there is no need to attach the binary as well 44 | 45 | **Additional Information:** 46 | Please add any other context about the problem here. 47 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Binary Ninja Slack 4 | url: https://slack.binary.ninja/ 5 | about: Join for quick responses to short questions 6 | - name: Official Support 7 | url: https://binary.ninja/support/ 8 | about: Check our official support page for more information 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Request for documentation 3 | about: Let us know where we can clarify Binary Ninja debugger's documentation 4 | title: '' 5 | labels: documentation 6 | assignees: '' 7 | 8 | --- 9 | 10 | **What concept or API needs more documentation?** 11 | Please provide a clear and concise description of the API or concept which is confusing or missing documentation. 12 | 13 | **Is this documentation related to a specific API?** 14 | Describe which API needs documentation: C++, Python. (**Note:** The C API is not intended to be a documented interface.) 15 | 16 | **Are there any known examples of people using this API/concept?** 17 | Describe or link to any public examples for this (i.e., repositories or blog posts). 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Request a feature 3 | about: Let us know how we could improve Binary Ninja debugger 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **What is the feature you'd like to have?** 11 | Please provide a clear and concise description of what you want. 12 | 13 | **Is your feature request related to a problem?** 14 | If applicable, please provide a clear and concise description of what the problem is. 15 | 16 | **Are any alternative solutions acceptable?** 17 | Please provide a clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional Information:** 20 | Please add any other context or screenshots that would help us understand your feature request here. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | #*.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | #*.exe 31 | *.out 32 | *.app 33 | 34 | .idea/ 35 | cmake-build-*/ 36 | test/testbins/CMakeFiles/ 37 | test/testbins/googlemock/ 38 | test/testbins/googletest/ 39 | test/testbins/lib/ 40 | 41 | .vscode/* 42 | test/testbins/cmake_install.cmake 43 | test/testbins/CTestTestfile.cmake 44 | 45 | /api/python/_debuggercore.py 46 | /api/python/debugger_enums.py 47 | /test/cmake_install.cmake 48 | /test/CMakeCache.txt 49 | /test/Makefile 50 | /test/CMakeFiles/ 51 | .gdb_history 52 | 53 | *.pdb 54 | *.ilk 55 | *.manifest 56 | 57 | core/adapters/LLDB.framework 58 | /test/binaries/Darwin-arm64-signed/ 59 | /test/binaries/Darwin-x86_64-signed/ 60 | test/__pycache__ 61 | 62 | /build 63 | /artifacts 64 | /test/Pipfile 65 | 66 | .DS_Store 67 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/.gitmodules -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13 FATAL_ERROR) 2 | 3 | project(debugger) 4 | 5 | if((NOT BN_API_PATH) AND (NOT BN_INTERNAL_BUILD)) 6 | set(BN_API_PATH $ENV{BN_API_PATH}) 7 | if(NOT BN_API_PATH) 8 | message(FATAL_ERROR "Provide path to Binary Ninja API source in BN_API_PATH") 9 | endif() 10 | endif() 11 | 12 | if (NOT BN_INTERNAL_BUILD) 13 | if(WIN32) 14 | set(MSVC_VERSION msvc2022_64 CACHE STRING "Version of MSVC Qt is built with" ) 15 | endif() 16 | set(QT_VERSION 6.8.2 CACHE STRING "Version of Qt to use") 17 | 18 | if(DEFINED ENV{QT_INSTALL_DIR}) 19 | set(QT_INSTALL_DIR $ENV{QT_INSTALL_DIR}/${QT_VERSION}) 20 | else() 21 | if(APPLE) 22 | set(QT_INSTALL_DIR $ENV{HOME}/Qt/${QT_VERSION}) 23 | elseif(WIN32) 24 | set(QT_INSTALL_DIR $ENV{HOMEDRIVE}$ENV{HOMEPATH}/Qt/${QT_VERSION}) 25 | else() 26 | set(QT_INSTALL_DIR $ENV{HOME}/Qt/${QT_VERSION}) 27 | endif() 28 | endif() 29 | 30 | if(NOT CMAKE_PREFIX_PATH) 31 | if(APPLE) 32 | set(CMAKE_PREFIX_PATH ${QT_INSTALL_DIR}/clang_64/lib/cmake) 33 | elseif(WIN32) 34 | set(CMAKE_PREFIX_PATH ${QT_INSTALL_DIR}/${MSVC_VERSION}/lib/cmake) 35 | else() 36 | set(CMAKE_PREFIX_PATH ${QT_INSTALL_DIR}/gcc_64/lib/cmake) 37 | endif() 38 | endif() 39 | message("CMAKE_PREFIX_PATH is: ${CMAKE_PREFIX_PATH}") 40 | endif() 41 | 42 | add_subdirectory(core) 43 | add_subdirectory(api) 44 | if(NOT HEADLESS) 45 | add_subdirectory(ui) 46 | endif() 47 | 48 | if (NOT DEMO) 49 | add_subdirectory(cli) 50 | endif() 51 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2020-2025 Vector 35 Inc. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /api/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13 FATAL_ERROR) 2 | 3 | project(debuggerapi) 4 | 5 | file(GLOB BN_DEBUGGER_API_SOURCES *.cpp *.h) 6 | add_library(debuggerapi STATIC ${BN_DEBUGGER_API_SOURCES}) 7 | 8 | target_include_directories(debuggerapi 9 | PUBLIC ${PROJECT_SOURCE_DIR}) 10 | 11 | target_link_libraries(debuggerapi PUBLIC debuggercore) 12 | 13 | set_target_properties(debuggerapi PROPERTIES 14 | CXX_STANDARD 17 15 | CXX_VISIBILITY_PRESET hidden 16 | CXX_STANDARD_REQUIRED ON 17 | VISIBILITY_INLINES_HIDDEN ON 18 | POSITION_INDEPENDENT_CODE ON 19 | ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/out) 20 | 21 | if (NOT DEMO) 22 | add_subdirectory(python) 23 | endif() -------------------------------------------------------------------------------- /api/debugadaptertype.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "debuggerapi.h" 18 | 19 | using namespace BinaryNinja; 20 | using namespace BinaryNinjaDebuggerAPI; 21 | using namespace std; 22 | 23 | 24 | DebugAdapterType* DebugAdapterType::GetByName(const std::string& name) 25 | { 26 | BNDebugAdapterType* adapter = BNGetDebugAdapterTypeByName(name.c_str()); 27 | if (!adapter) 28 | return nullptr; 29 | 30 | return new DebugAdapterType(adapter); 31 | } 32 | 33 | 34 | DebugAdapterType::DebugAdapterType(BNDebugAdapterType* controller) 35 | { 36 | m_object = controller; 37 | } 38 | 39 | 40 | bool DebugAdapterType::CanConnect(Ref data) 41 | { 42 | return BNDebugAdapterTypeCanConnect(m_object, data->GetObject()); 43 | } 44 | 45 | 46 | bool DebugAdapterType::CanExecute(Ref data) 47 | { 48 | return BNDebugAdapterTypeCanExecute(m_object, data->GetObject()); 49 | } 50 | 51 | 52 | std::vector DebugAdapterType::GetAvailableAdapters(Ref data) 53 | { 54 | size_t count; 55 | char** adapters = BNGetAvailableDebugAdapterTypes(data->GetObject(), &count); 56 | 57 | std::vector result; 58 | result.reserve(count); 59 | for (size_t i = 0; i < count; i++) 60 | { 61 | result.push_back(adapters[i]); 62 | } 63 | 64 | BNDebuggerFreeStringList(adapters, count); 65 | return result; 66 | } -------------------------------------------------------------------------------- /api/python/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.9...3.15 FATAL_ERROR) 2 | 3 | project(debugger-python-api) 4 | 5 | file(GLOB PYTHON_SOURCES ${PROJECT_SOURCE_DIR}/*.py) 6 | list(REMOVE_ITEM PYTHON_SOURCES ${PROJECT_SOURCE_DIR}/_debuggercore.py) 7 | list(REMOVE_ITEM PYTHON_SOURCES ${PROJECT_SOURCE_DIR}/enums.py) 8 | 9 | add_executable(debugger_generator 10 | ${PROJECT_SOURCE_DIR}/generator.cpp) 11 | target_link_libraries(debugger_generator binaryninjaapi) 12 | 13 | set_target_properties(debugger_generator PROPERTIES 14 | CXX_STANDARD 17 15 | CXX_STANDARD_REQUIRED ON 16 | BUILD_WITH_INSTALL_RPATH OFF 17 | RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}) 18 | 19 | if(BN_INTERNAL_BUILD) 20 | set(PYTHON_OUTPUT_DIRECTORY ${BN_RESOURCE_DIR}/python/binaryninja/debugger/) 21 | else() 22 | set(PYTHON_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out/plugins/debugger/) 23 | endif() 24 | 25 | if(WIN32) 26 | if (BN_INTERNAL_BUILD) 27 | add_custom_command(TARGET debugger_generator PRE_BUILD 28 | COMMAND ${CMAKE_COMMAND} -E copy ${BN_CORE_OUTPUT_DIR}/binaryninjacore.dll ${PROJECT_BINARY_DIR}/) 29 | else() 30 | add_custom_command(TARGET debugger_generator PRE_BUILD 31 | COMMAND ${CMAKE_COMMAND} -E copy ${BN_INSTALL_DIR}/binaryninjacore.dll ${PROJECT_BINARY_DIR}/) 32 | endif() 33 | endif() 34 | 35 | add_custom_target(debugger_generator_copy ALL 36 | BYPRODUCTS ${PROJECT_SOURCE_DIR}/_debuggercore.py ${PROJECT_SOURCE_DIR}/enums.py 37 | DEPENDS ${PYTHON_SOURCES} ${PROJECT_SOURCE_DIR}/../ffi.h $ 38 | COMMAND ${CMAKE_COMMAND} -E echo "Copying Debugger Python Sources" 39 | COMMAND ${CMAKE_COMMAND} -E make_directory ${PYTHON_OUTPUT_DIRECTORY} 40 | COMMAND ${CMAKE_COMMAND} -E env ASAN_OPTIONS=detect_leaks=0 $ 41 | ${PROJECT_SOURCE_DIR}/../ffi.h 42 | ${PROJECT_SOURCE_DIR}/_debuggercore.py 43 | ${PROJECT_SOURCE_DIR}/_debuggercore_template.py 44 | ${PROJECT_SOURCE_DIR}/debugger_enums.py 45 | 46 | COMMAND ${CMAKE_COMMAND} -E copy ${PYTHON_SOURCES} ${PYTHON_OUTPUT_DIRECTORY} 47 | COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/_debuggercore.py ${PYTHON_OUTPUT_DIRECTORY} 48 | COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/debugger_enums.py ${PYTHON_OUTPUT_DIRECTORY}) 49 | 50 | -------------------------------------------------------------------------------- /api/python/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2020-2025 Vector 35 Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | from binaryninja.settings import Settings 17 | 18 | from binaryninja._binaryninjacore import BNGetUserPluginDirectory 19 | user_plugin_dir = os.path.realpath(BNGetUserPluginDirectory()) 20 | current_path = os.path.realpath(__file__) 21 | 22 | # If BN_STANDALONE_DEBUGGER is set, only initialize the python module when it is loaded from the user plugin dir 23 | if os.environ.get('BN_STANDALONE_DEBUGGER'): 24 | if current_path.startswith(user_plugin_dir): 25 | from .debuggercontroller import * 26 | from .debugadaptertype import * 27 | from .debugger_enums import * 28 | else: 29 | if Settings().get_bool('corePlugins.debugger') and (os.environ.get('BN_DISABLE_CORE_DEBUGGER') is None): 30 | from .debuggercontroller import * 31 | from .debugadaptertype import * 32 | from .debugger_enums import * 33 | -------------------------------------------------------------------------------- /api/python/_debuggercore_template.py: -------------------------------------------------------------------------------- 1 | import binaryninja 2 | import ctypes, os 3 | 4 | from typing import Optional 5 | from . import debugger_enums 6 | # Load core module 7 | import platform 8 | core = None 9 | core_platform = platform.system() 10 | 11 | if os.environ.get('BN_STANDALONE_DEBUGGER'): 12 | # By the time the debugger is loaded, binaryninja has not fully initialized. 13 | # So we cannot call binaryninja.user_plugin_path() 14 | from binaryninja._binaryninjacore import BNGetUserPluginDirectory 15 | if core_platform == "Darwin": 16 | _base_path = BNGetUserPluginDirectory() 17 | core = ctypes.CDLL(os.path.join(_base_path, "libdebuggercore.dylib")) 18 | 19 | elif core_platform == "Linux": 20 | _base_path = BNGetUserPluginDirectory() 21 | core = ctypes.CDLL(os.path.join(_base_path, "libdebuggercore.so")) 22 | 23 | elif (core_platform == "Windows") or (core_platform.find("CYGWIN_NT") == 0): 24 | _base_path = BNGetUserPluginDirectory() 25 | core = ctypes.CDLL(os.path.join(_base_path, "debuggercore.dll")) 26 | else: 27 | raise Exception("OS not supported") 28 | else: 29 | # By the time the debugger is loaded, binaryninja has not fully initialized. 30 | # So we cannot call binaryninja.bundled_plugin_path() 31 | from binaryninja._binaryninjacore import BNGetBundledPluginDirectory 32 | if core_platform == "Darwin": 33 | _base_path = BNGetBundledPluginDirectory() 34 | core = ctypes.CDLL(os.path.join(_base_path, "libdebuggercore.dylib")) 35 | 36 | elif core_platform == "Linux": 37 | _base_path = BNGetBundledPluginDirectory() 38 | core = ctypes.CDLL(os.path.join(_base_path, "libdebuggercore.so")) 39 | 40 | elif (core_platform == "Windows") or (core_platform.find("CYGWIN_NT") == 0): 41 | _base_path = BNGetBundledPluginDirectory() 42 | core = ctypes.CDLL(os.path.join(_base_path, "debuggercore.dll")) 43 | else: 44 | raise Exception("OS not supported") 45 | 46 | def cstr(var) -> Optional[ctypes.c_char_p]: 47 | if var is None: 48 | return None 49 | if isinstance(var, bytes): 50 | return var 51 | return var.encode("utf-8") 52 | 53 | def pyNativeStr(arg): 54 | if isinstance(arg, str): 55 | return arg 56 | else: 57 | return arg.decode('utf8') 58 | 59 | def free_string(value:ctypes.c_char_p) -> None: 60 | BNDebuggerFreeString(ctypes.cast(value, ctypes.POINTER(ctypes.c_byte))) 61 | 62 | -------------------------------------------------------------------------------- /api/python/debugadaptertype.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | # Copyright 2020-2025 Vector 35 Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | import ctypes 17 | import traceback 18 | 19 | import binaryninja 20 | # import debugger 21 | from . import _debuggercore as dbgcore 22 | from .debugger_enums import * 23 | from typing import List 24 | 25 | 26 | class DebugAdapterType: 27 | """ 28 | The ``DebugAdapterType`` object is used to access the DebugAdapters. DebugAdapterType should not be directly 29 | instantiated; instead, use ``get_by_name`` to get an instance of DebugAdapter by name. 30 | 31 | Right now, the DebugAdapterType class cannot be used to create a DebuggerController. This is planned for the future. 32 | """ 33 | 34 | def __init__(self, handle: dbgcore.BNDebugAdapterType): 35 | self.handle = handle 36 | 37 | @classmethod 38 | def get_by_name(cls, name: str) -> None: 39 | """ 40 | Get a DebugAdapterType by its name. 41 | 42 | :param name: the name of the DebugAdapterType 43 | :return: 44 | """ 45 | cls.handle = dbgcore.BNGetDebugAdapterTypeByName(name) 46 | 47 | def can_execute(self, bv: binaryninja.BinaryView) -> bool: 48 | """ 49 | Whether the current DebugAdapterType can execute the specified BinaryView 50 | 51 | :param bv: the BinaryView to check for 52 | :return: 53 | """ 54 | bv_obj = ctypes.cast(bv.handle, ctypes.POINTER(dbgcore.BNBinaryView)) 55 | return dbgcore.BNDebugAdapterTypeCanExecute(self.handle, bv_obj) 56 | 57 | def can_connect(self, bv: binaryninja.BinaryView) -> bool: 58 | """ 59 | Whether the current DebugAdapterType can connect to a remote host for the specified BinaryView 60 | 61 | :param bv: the BinaryView to check for 62 | :return: 63 | """ 64 | bv_obj = ctypes.cast(bv.handle, ctypes.POINTER(dbgcore.BNBinaryView)) 65 | return dbgcore.BNDebugAdapterTypeCanConnect(self.handle, bv_obj) 66 | 67 | @staticmethod 68 | def get_available_adapters(bv: binaryninja.BinaryView) -> List[str]: 69 | """ 70 | Get a list of available DebugAdapters for the specified BinaryView. The DebugAdapters in the list can be used to 71 | debug the BinaryView. 72 | 73 | :param bv: the BinaryView to check for 74 | :return: list of available DebugAdapters 75 | """ 76 | count = ctypes.c_ulonglong() 77 | bv_obj = ctypes.cast(bv.handle, ctypes.POINTER(dbgcore.BNBinaryView)) 78 | adapters = dbgcore.BNGetAvailableDebugAdapterTypes(bv_obj, count) 79 | result = [] 80 | for i in range(count.value): 81 | result.append(adapters[i].decode('utf-8')) 82 | dbgcore.BNDebuggerFreeStringList(adapters, count) 83 | return result 84 | -------------------------------------------------------------------------------- /api/utility.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "debuggerapi.h" 18 | 19 | using namespace BinaryNinja; 20 | using namespace BinaryNinjaDebuggerAPI; 21 | using namespace std; 22 | 23 | 24 | bool DebugModule::IsSameBaseModule(const std::string& module1, const std::string& module2) 25 | { 26 | return BNDebuggerIsSameBaseModule(module1.c_str(), module2.c_str()); 27 | } 28 | -------------------------------------------------------------------------------- /build.md: -------------------------------------------------------------------------------- 1 | # Building 2 | 3 | - Update to the latest development build of Binary Ninja 4 | - Follow [this](https://docs.binary.ninja/guide/index.html#support) guide to do so 5 | 6 | - Clone `binaryninja-api` and checkout to the corresponding commit used to build the version of Binary Ninja you are running 7 | - If you updated to the latest dev build of Binary Ninja, then you can checkout the api repo to the latest dev as well 8 | - A more robust approach is to find the file `api_REVISION.txt` in `BN_INSTALLATION_FOLDER/Resources` 9 | 10 | ```bash 11 | git clone https://github.com/Vector35/binaryninja-api.git 12 | cd binaryninja-api 13 | git checkout dev 14 | # or git checkout commit_hash 15 | ``` 16 | 17 | - Download LLDB development build for your OS at https://github.com/Vector35/lldb-artifacts/releases/latest - make sure that the correct LLDB version is downloaded (`grep 'LLVM_VERSION ' core/CMakeLists.txt` can help) 18 | - Extract the zip archive to `~/libclang` 19 | 20 | - Download Qt development build for your OS at https://github.com/Vector35/qt-artifacts/releases/latest. 21 | - Extract the zip archive to `~/Qt` 22 | 23 | - Build the debugger 24 | 25 | ```bash 26 | # Get the source 27 | git clone https://github.com/Vector35/debugger.git 28 | 29 | # Do an out-of-source build 30 | mkdir -p build 31 | cd build 32 | 33 | # Build it 34 | cmake -DBN_API_PATH=../binaryninja-api -DBN_INSTALL_DIR=/path/to/binaryninja/installation .. 35 | 36 | make 37 | ``` 38 | 39 | While the code is compiling, it's a good time to check the [Binary Ninja slack](https://slack.binary.ninja) for any updates! 40 | 41 | The build artifacts will be in the folder `out`. You should find two files `libdebuggercore` and `libdebuggerui`, and two folders `debugger` (that contains the Python code) and `lldb`. 42 | 43 | - Run the debugger 44 | - Open Binary Ninja, disable the setting `corePlugins.debugger` so the debugger that comes with Binary Ninja is not loaded 45 | - Close Binary Ninja 46 | - Copy everything in the `out` folder to the user plugin folder - `cp -r out/plugins/* ~/.binaryninja/plugins/` 47 | - Set the environment variable `BN_STANDALONE_DEBUGGER=1` 48 | - Launch BinaryNinja 49 | 50 | 51 | ## Notes: 52 | 53 | - On Windows, building the debugger in Debug mode may cause obscure bugs since the debug ABI of MSVC can be different from that of the release build. 54 | It is recommended to build with `RelWithDebInfo` on Windows. 55 | -------------------------------------------------------------------------------- /cli/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13 FATAL_ERROR) 2 | 3 | project(debugger-cli) 4 | 5 | remove_definitions(-DUNICODE -D_UNICODE) 6 | 7 | file(GLOB SOURCES *.cpp *.h) 8 | 9 | add_executable(debugger-cli ${SOURCES}) 10 | 11 | if(UNIX AND NOT APPLE) 12 | target_link_libraries(debugger-cli debuggerapi pthread) 13 | else() 14 | target_link_libraries(debugger-cli debuggerapi) 15 | endif() 16 | 17 | set_target_properties(debugger-cli PROPERTIES 18 | CXX_STANDARD 17 19 | CXX_STANDARD_REQUIRED ON 20 | CXX_VISIBILITY_PRESET hidden 21 | VISIBILITY_INLINES_HIDDEN ON 22 | POSITION_INDEPENDENT_CODE ON 23 | RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out/bin 24 | ) 25 | -------------------------------------------------------------------------------- /core/adapters/dbgeng/amd64/dbgcore.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/core/adapters/dbgeng/amd64/dbgcore.dll -------------------------------------------------------------------------------- /core/adapters/dbgeng/amd64/dbgeng.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/core/adapters/dbgeng/amd64/dbgeng.dll -------------------------------------------------------------------------------- /core/adapters/dbgeng/amd64/dbghelp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/core/adapters/dbgeng/amd64/dbghelp.dll -------------------------------------------------------------------------------- /core/adapters/dbgeng/amd64/dbgmodel.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/core/adapters/dbgeng/amd64/dbgmodel.dll -------------------------------------------------------------------------------- /core/adapters/dbgeng/amd64/dbgsrv.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/core/adapters/dbgeng/amd64/dbgsrv.exe -------------------------------------------------------------------------------- /core/adapters/dbgeng/install_windbg.py: -------------------------------------------------------------------------------- 1 | import urllib.request 2 | import xml.dom.minidom 3 | import zipfile 4 | import tempfile 5 | import binaryninja 6 | from binaryninja.settings import Settings 7 | import os 8 | 9 | 10 | def check_install_ok(path): 11 | if not os.path.exists(os.path.join(path, 'amd64', 'dbgeng.dll')): 12 | return False 13 | 14 | if not os.path.exists(os.path.join(path, 'amd64', 'dbghelp.dll')): 15 | return False 16 | 17 | if not os.path.exists(os.path.join(path, 'amd64', 'dbgmodel.dll')): 18 | return False 19 | 20 | if not os.path.exists(os.path.join(path, 'amd64', 'dbgcore.dll')): 21 | return False 22 | 23 | if not os.path.exists(os.path.join(path, 'amd64', 'ttd', 'TTD.exe')): 24 | return False 25 | 26 | if not os.path.exists(os.path.join(path, 'amd64', 'ttd', 'TTDRecord.dll')): 27 | return False 28 | 29 | return True 30 | 31 | 32 | def install_windbg(): 33 | ttd_url = 'https://aka.ms/windbg/download' 34 | print('Downloading appinstaller from: %s...' % ttd_url) 35 | try: 36 | local_file, _ = urllib.request.urlretrieve(ttd_url) 37 | except Exception as e: 38 | print('Failed to download appinstaller file from %s' % ttd_url) 39 | print(e) 40 | return 41 | print('Successfully downloaded appinstaller') 42 | 43 | xml_doc = xml.dom.minidom.parse(local_file) 44 | try: 45 | msix_url = xml_doc.getElementsByTagName('MainBundle')[0].attributes['Uri'].value 46 | except Exception as e: 47 | print('Failed to parse XML') 48 | print(e) 49 | return 50 | 51 | print('Downloading MSIX bundle from: %s...' % msix_url) 52 | try: 53 | msix_file, _ = urllib.request.urlretrieve(msix_url) 54 | except Exception as e: 55 | print('Failed to download MSIX bundle from %s' % msix_url) 56 | print(e) 57 | return 58 | print('Successfully downloaded MSIX bundle') 59 | 60 | zip_file = zipfile.ZipFile(msix_file) 61 | temp_dir = tempfile.mkdtemp() 62 | inner_msix = zip_file.extract('windbg_win-x64.msix', temp_dir) 63 | print('Extracted windbg_win-x64 to %s' % inner_msix) 64 | 65 | install_target = os.path.join(binaryninja.user_directory(), 'windbg') 66 | print('Installing to: %s' % install_target) 67 | 68 | inner_zip = zipfile.ZipFile(inner_msix) 69 | inner_zip.extractall(install_target) 70 | 71 | if check_install_ok(install_target): 72 | print('WinDbg/TTD installed to %s!' % install_target) 73 | else: 74 | print('The WinDbg/TTD installation appears to be successful, but important files are missing from %s, ' 75 | 'and the TTD recording may not work properly.' % install_target) 76 | return 77 | 78 | x64dbgEngPath = os.path.join(install_target, 'amd64') 79 | if Settings().set_string("debugger.x64dbgEngPath", x64dbgEngPath): 80 | print('Please restart Binary Ninja to make the changes take effect!') 81 | else: 82 | print('Failed to set debugger.x64dbgEngPath to %s, the WinDbg/TTD installation is not being used' % (x64dbgEngPath)) 83 | 84 | 85 | install_windbg() 86 | -------------------------------------------------------------------------------- /core/adapters/dbgeng/x86/dbgcore.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/core/adapters/dbgeng/x86/dbgcore.dll -------------------------------------------------------------------------------- /core/adapters/dbgeng/x86/dbgeng.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/core/adapters/dbgeng/x86/dbgeng.dll -------------------------------------------------------------------------------- /core/adapters/dbgeng/x86/dbghelp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/core/adapters/dbgeng/x86/dbghelp.dll -------------------------------------------------------------------------------- /core/adapters/dbgeng/x86/dbgmodel.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/core/adapters/dbgeng/x86/dbgmodel.dll -------------------------------------------------------------------------------- /core/adapters/dbgeng/x86/dbgsrv.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/core/adapters/dbgeng/x86/dbgsrv.exe -------------------------------------------------------------------------------- /core/adapters/dbgengttdadapter.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | #include "dbgengadapter.h" 19 | 20 | namespace BinaryNinjaDebugger { 21 | class DbgEngTTDAdapter: public DbgEngAdapter 22 | { 23 | public: 24 | DbgEngTTDAdapter(BinaryView* data); 25 | 26 | [[nodiscard]] bool ExecuteWithArgsInternal(const std::string& path, const std::string& args, 27 | const std::string& workingDir, const LaunchConfigurations& configs = {}) override; 28 | bool WriteMemory(std::uintptr_t address, const DataBuffer& buffer) override; 29 | bool WriteRegister(const std::string& reg, std::uintptr_t value) override; 30 | 31 | bool Start() override; 32 | void Reset() override; 33 | 34 | bool GoReverse() override; 35 | bool StepIntoReverse() override; 36 | bool StepOverReverse() override; 37 | bool StepReturnReverse() override; 38 | 39 | bool SupportFeature(DebugAdapterCapacity feature) override; 40 | 41 | bool Quit() override; 42 | 43 | void GenerateDefaultAdapterSettings(BinaryView* data); 44 | Ref GetAdapterSettings() override; 45 | }; 46 | 47 | class DbgEngTTDAdapterType : public DebugAdapterType 48 | { 49 | static Ref RegisterAdapterSettings(); 50 | 51 | public: 52 | DbgEngTTDAdapterType(); 53 | virtual DebugAdapter* Create(BinaryNinja::BinaryView* data); 54 | virtual bool IsValidForData(BinaryNinja::BinaryView* data); 55 | virtual bool CanExecute(BinaryNinja::BinaryView* data); 56 | virtual bool CanConnect(BinaryNinja::BinaryView* data); 57 | static Ref GetAdapterSettings(); 58 | }; 59 | 60 | void InitDbgEngTTDAdapterType(); 61 | }; 62 | -------------------------------------------------------------------------------- /core/adapters/gdb/gdbserver.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/core/adapters/gdb/gdbserver.zip -------------------------------------------------------------------------------- /core/adapters/lldbrspadapter.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | #include "gdbadapter.h" 19 | 20 | namespace BinaryNinjaDebugger 21 | { 22 | class LldbRspAdapter : public GdbAdapter 23 | { 24 | bool LoadRegisterInfo() override; 25 | DebugStopReason SignalToStopReason(std::unordered_map& dict) override; 26 | 27 | std::string GetDebugServerPath(); 28 | 29 | public: 30 | LldbRspAdapter(BinaryView* data); 31 | bool ExecuteWithArgs(const std::string &path, const std::string &args, const std::string &workingDir, 32 | const LaunchConfigurations &configs) override; 33 | bool Attach(uint32_t pid) override; 34 | bool Go() override; 35 | std::string GetTargetArchitecture() override; 36 | std::vector GetModuleList() override; 37 | 38 | // LLDB requires a different way of reading register values, the g packet that works for gdb does not work for lldb 39 | std::unordered_map ReadAllRegisters() override; 40 | DebugRegister ReadRegister(const std::string& reg) override; 41 | 42 | DataBuffer ReadMemory(std::uintptr_t address, std::size_t size) override; 43 | }; 44 | 45 | 46 | class LocalLldbRspAdapterType: public DebugAdapterType 47 | { 48 | public: 49 | LocalLldbRspAdapterType(); 50 | virtual DebugAdapter* Create(BinaryNinja::BinaryView* data); 51 | virtual bool IsValidForData(BinaryNinja::BinaryView* data); 52 | virtual bool CanExecute(BinaryNinja::BinaryView* data); 53 | virtual bool CanConnect(BinaryNinja::BinaryView* data); 54 | }; 55 | 56 | 57 | class RemoteLldbRspAdapterType: public DebugAdapterType 58 | { 59 | public: 60 | RemoteLldbRspAdapterType(); 61 | virtual DebugAdapter* Create(BinaryNinja::BinaryView* data); 62 | virtual bool IsValidForData(BinaryNinja::BinaryView* data); 63 | virtual bool CanExecute(BinaryNinja::BinaryView* data); 64 | virtual bool CanConnect(BinaryNinja::BinaryView* data); 65 | }; 66 | 67 | 68 | void InitLldbRspAdapterType(); 69 | }; 70 | -------------------------------------------------------------------------------- /core/adapters/localwindowskerneladapter.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | #include "dbgengadapter.h" 19 | 20 | namespace BinaryNinjaDebugger { 21 | class LocalWindowsKernelAdapter: public DbgEngAdapter 22 | { 23 | public: 24 | LocalWindowsKernelAdapter(BinaryView* data); 25 | 26 | [[nodiscard]] bool ExecuteWithArgsInternal(const std::string& path, const std::string& args, 27 | const std::string& workingDir, const LaunchConfigurations& configs = {}) override; 28 | 29 | bool Start() override; 30 | void Reset() override; 31 | 32 | bool Detach() override; 33 | bool Quit() override; 34 | 35 | bool Attach(std::uint32_t pid) override { return false; } 36 | bool Connect(const std::string& server, std::uint32_t port) override { return false; } 37 | std::vector GetProcessList() override {return {}; } 38 | bool ConnectToDebugServer(const std::string& server, std::uint32_t port) override { return false; } 39 | bool DisconnectDebugServer() override { return false; } 40 | 41 | void GenerateDefaultAdapterSettings(BinaryView* data); 42 | Ref GetAdapterSettings() override; 43 | }; 44 | 45 | class LocalWindowsKernelAdapterType : public DebugAdapterType 46 | { 47 | static Ref RegisterAdapterSettings(); 48 | 49 | public: 50 | LocalWindowsKernelAdapterType(); 51 | virtual DebugAdapter* Create(BinaryNinja::BinaryView* data); 52 | virtual bool IsValidForData(BinaryNinja::BinaryView* data); 53 | virtual bool CanExecute(BinaryNinja::BinaryView* data); 54 | virtual bool CanConnect(BinaryNinja::BinaryView* data); 55 | static Ref GetAdapterSettings(); 56 | }; 57 | 58 | void InitLocalWindowsKernelAdapterType(); 59 | }; 60 | -------------------------------------------------------------------------------- /core/adapters/queuedadapter.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | #include "../debugadapter.h" 19 | #include "../debugadaptertype.h" 20 | #include "rspconnector.h" 21 | #include 22 | #include 23 | #include "../semaphore.h" 24 | #include "gdbadapter.h" 25 | 26 | namespace BinaryNinjaDebugger 27 | { 28 | class QueuedAdapter : public DebugAdapter 29 | { 30 | DebugAdapter* m_adapter; 31 | mutable std::mutex m_queueMutex; 32 | mutable std::queue> m_queue; 33 | 34 | public: 35 | QueuedAdapter(DebugAdapter* adapter, BinaryView* data); 36 | ~QueuedAdapter(); 37 | 38 | bool Execute(const std::string& path, const LaunchConfigurations& configs) override; 39 | bool ExecuteWithArgs(const std::string &path, const std::string &args, const std::string &workingDir, 40 | const LaunchConfigurations &configs) override; 41 | bool Attach(std::uint32_t pid) override; 42 | bool Connect(const std::string& server, std::uint32_t port) override; 43 | 44 | bool Detach() override; 45 | bool Quit() override; 46 | 47 | std::vector GetThreadList() override; 48 | DebugThread GetActiveThread() const override; 49 | std::uint32_t GetActiveThreadId() const override; 50 | bool SetActiveThread(const DebugThread& thread) override; 51 | bool SetActiveThreadId(std::uint32_t tid) override; 52 | std::vector GetFramesOfThread(uint32_t tid) override; 53 | 54 | DebugBreakpoint AddBreakpoint(std::uintptr_t address, unsigned long breakpoint_type = 0) override; 55 | 56 | bool RemoveBreakpoint(const DebugBreakpoint& breakpoint) override; 57 | 58 | std::vector GetBreakpointList() const override; 59 | 60 | std::unordered_map ReadAllRegisters() override; 61 | DebugRegister ReadRegister(const std::string& reg) override; 62 | bool WriteRegister(const std::string& reg, std::uintptr_t value) override; 63 | 64 | DataBuffer ReadMemory(std::uintptr_t address, std::size_t size) override; 65 | bool WriteMemory(std::uintptr_t address, const DataBuffer& buffer) override; 66 | 67 | std::vector GetModuleList() override; 68 | 69 | std::string GetTargetArchitecture() override; 70 | 71 | DebugStopReason StopReason() override; 72 | 73 | uint64_t ExitCode() override; 74 | 75 | bool GenericGo(const std::string& go_type); 76 | bool GenericGoAsync(const std::string& go_type); 77 | 78 | bool BreakInto() override; 79 | bool Go() override; 80 | bool StepInto() override; 81 | bool StepOver() override; 82 | bool StepReturn() override; 83 | 84 | std::string InvokeBackendCommand(const std::string& command) override; 85 | uint64_t GetInstructionOffset() override; 86 | uint64_t GetStackPointer() override; 87 | 88 | bool SupportFeature(DebugAdapterCapacity feature) override; 89 | 90 | void Worker(); 91 | 92 | virtual void SetEventCallback(std::function function) override; 93 | 94 | virtual void WriteStdin(const std::string& msg) override; 95 | 96 | std::vector GetProcessList() override; 97 | bool SuspendThread(std::uint32_t tid) override; 98 | bool ResumeThread(std::uint32_t tid) override; 99 | DebugBreakpoint AddBreakpoint(const ModuleNameAndOffset& address, unsigned long breakpoint_type = 0) override; 100 | }; 101 | }; 102 | -------------------------------------------------------------------------------- /core/adapters/socket.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | #ifdef WIN32 19 | #include 20 | #include 21 | #else 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #endif 31 | 32 | namespace BinaryNinjaDebugger 33 | { 34 | class Socket { 35 | using socket_type = 36 | #ifdef WIN32 37 | SOCKET; 38 | #else 39 | std::int32_t; 40 | #endif 41 | 42 | socket_type m_socket{}; 43 | [[maybe_unused]] std::int32_t m_addressFamily{}, m_type{}, m_protocol{}; 44 | std::uint32_t m_port{}; 45 | 46 | public: 47 | Socket() = default; 48 | 49 | /* if port is zero it will be bruteforced */ 50 | Socket(std::int32_t address_family, std::int32_t type, std::int32_t protocol) 51 | : m_addressFamily(address_family), m_type(type), m_protocol(protocol) { 52 | this->m_socket = ::socket(address_family, type, protocol); 53 | SetSocketReusable(); 54 | } 55 | 56 | void SetSocketReusable() 57 | { 58 | #ifndef WIN32 59 | int reuse = 1; 60 | if (setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, (const char*)&reuse, sizeof(reuse)) < 0) 61 | printf("unable to set SO_REUSEADDR"); 62 | 63 | if (setsockopt(m_socket, SOL_SOCKET, SO_REUSEPORT, (const char*)&reuse, sizeof(reuse)) < 0) 64 | printf("unable to set SO_REUSEPORT"); 65 | #else 66 | // TODO: Windows 67 | #endif 68 | } 69 | 70 | [[nodiscard]] std::uint32_t GetPort() const { 71 | return this->m_port; 72 | } 73 | 74 | [[nodiscard]] socket_type GetSocket() const { 75 | return this->m_socket; 76 | } 77 | 78 | bool Bind(sockaddr_in& address) const { 79 | return ::bind(this->m_socket, (const sockaddr*)&address, sizeof(address)) >= 0; 80 | } 81 | 82 | bool Connect(sockaddr_in& address) const { 83 | return ::connect(this->m_socket, (const sockaddr*)&address, sizeof(address)) >= 0; 84 | } 85 | 86 | intptr_t Recv(char* data, std::int32_t size, std::int32_t flags = 0) const { 87 | return ::recv(this->m_socket, data, size, flags); 88 | } 89 | 90 | intptr_t Send(char* data, std::int32_t size, std::int32_t flags = 0) const { 91 | return ::send(this->m_socket, data, size, flags); 92 | } 93 | 94 | bool Close() const { 95 | return 96 | #ifdef WIN32 97 | ::closesocket(this->m_socket) 98 | #else 99 | ::close(this->m_socket) 100 | #endif 101 | >= 0; 102 | } 103 | 104 | bool Kill() const { 105 | return 106 | #ifdef WIN32 107 | ::shutdown(this->m_socket, 2) >= 0 108 | #else 109 | ::shutdown(this->m_socket, SHUT_RDWR) >= 0 110 | #endif 111 | && this->Close(); 112 | } 113 | }; 114 | }; 115 | -------------------------------------------------------------------------------- /core/adapters/windowsdumpfile.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | #include "dbgengadapter.h" 19 | 20 | namespace BinaryNinjaDebugger { 21 | class WindowsDumpFileAdapter: public DbgEngAdapter 22 | { 23 | public: 24 | WindowsDumpFileAdapter(BinaryView* data); 25 | 26 | [[nodiscard]] bool ExecuteWithArgsInternal(const std::string& path, const std::string& args, 27 | const std::string& workingDir, const LaunchConfigurations& configs = {}) override; 28 | 29 | bool Start() override; 30 | void Reset() override; 31 | 32 | bool Detach() override; 33 | bool Quit() override; 34 | 35 | void GenerateDefaultAdapterSettings(BinaryView* data); 36 | Ref GetAdapterSettings() override; 37 | }; 38 | 39 | class WindowsDumpFileAdapterType : public DebugAdapterType 40 | { 41 | static Ref RegisterAdapterSettings(); 42 | 43 | public: 44 | WindowsDumpFileAdapterType(); 45 | virtual DebugAdapter* Create(BinaryNinja::BinaryView* data); 46 | virtual bool IsValidForData(BinaryNinja::BinaryView* data); 47 | virtual bool CanExecute(BinaryNinja::BinaryView* data); 48 | virtual bool CanConnect(BinaryNinja::BinaryView* data); 49 | static Ref GetAdapterSettings(); 50 | }; 51 | 52 | void InitWindowsDumpFileAdapterType(); 53 | }; 54 | -------------------------------------------------------------------------------- /core/adapters/windowskerneladapter.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | #include "dbgengadapter.h" 19 | 20 | namespace BinaryNinjaDebugger { 21 | class WindowsKernelAdapter: public DbgEngAdapter 22 | { 23 | public: 24 | WindowsKernelAdapter(BinaryView* data); 25 | 26 | [[nodiscard]] bool ExecuteWithArgsInternal(const std::string& path, const std::string& args, 27 | const std::string& workingDir, const LaunchConfigurations& configs = {}) override; 28 | 29 | bool Start() override; 30 | void Reset() override; 31 | 32 | bool Detach() override; 33 | bool Quit() override; 34 | 35 | void GenerateDefaultAdapterSettings(BinaryView* data); 36 | Ref GetAdapterSettings() override; 37 | }; 38 | 39 | class WindowsKernelAdapterType : public DebugAdapterType 40 | { 41 | static Ref RegisterAdapterSettings(); 42 | 43 | public: 44 | WindowsKernelAdapterType(); 45 | virtual DebugAdapter* Create(BinaryNinja::BinaryView* data); 46 | virtual bool IsValidForData(BinaryNinja::BinaryView* data); 47 | virtual bool CanExecute(BinaryNinja::BinaryView* data); 48 | virtual bool CanConnect(BinaryNinja::BinaryView* data); 49 | static Ref GetAdapterSettings(); 50 | }; 51 | 52 | void InitWindowsKernelAdapterType(); 53 | }; 54 | -------------------------------------------------------------------------------- /core/debugadaptertype.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "debugadaptertype.h" 18 | #include "./adapters/gdbadapter.h" 19 | #include "./adapters/lldbrspadapter.h" 20 | 21 | #ifdef WIN32 22 | #include "./adapters/dbgengadapter.h" 23 | #include "./adapters/lldbadapter.h" 24 | #endif 25 | 26 | #include "debuggerexceptions.h" 27 | #include "../api/ffi.h" 28 | 29 | using namespace BinaryNinjaDebugger; 30 | 31 | 32 | DebugAdapterType::DebugAdapterType(const std::string& name) : m_name(name) 33 | { 34 | INIT_DEBUGGER_API_OBJECT(); 35 | } 36 | 37 | 38 | void DebugAdapterType::Register(DebugAdapterType* type) 39 | { 40 | m_types.push_back(type); 41 | } 42 | 43 | 44 | DebugAdapterType* DebugAdapterType::GetByName(const std::string& name) 45 | { 46 | for (DebugAdapterType* adapter : m_types) 47 | { 48 | if (adapter->GetName() == name) 49 | return adapter; 50 | } 51 | return nullptr; 52 | } 53 | 54 | 55 | std::vector DebugAdapterType::GetAvailableAdapters(BinaryNinja::BinaryView* data) 56 | { 57 | std::vector result; 58 | for (DebugAdapterType* adapter : m_types) 59 | { 60 | // The adapter must be: 61 | // 1. valid for the data 62 | // 2. can connect/execute on the current host system 63 | if (adapter->IsValidForData(data) && (adapter->CanConnect(data) || adapter->CanExecute(data))) 64 | { 65 | result.push_back(adapter->GetName()); 66 | } 67 | } 68 | return result; 69 | } 70 | 71 | 72 | std::string DebugAdapterType::GetBestAdapterForCurrentSystem(BinaryNinja::BinaryView* data) 73 | { 74 | #ifdef WIN32 75 | return "DBGENG"; 76 | #else 77 | return "LLDB"; 78 | #endif 79 | } 80 | -------------------------------------------------------------------------------- /core/debugadaptertype.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "binaryninjaapi.h" 20 | #include "debugadapter.h" 21 | #include "../api/ffi.h" 22 | #include "ffi_global.h" 23 | 24 | DECLARE_DEBUGGER_API_OBJECT(BNDebugAdapterType, DebugAdapterType); 25 | 26 | namespace BinaryNinjaDebugger { 27 | class DebugAdapter; 28 | 29 | class DebugAdapterType 30 | { 31 | IMPLEMENT_DEBUGGER_API_OBJECT(BNDebugAdapterType); 32 | 33 | private: 34 | std::string m_name; 35 | inline static std::vector m_types; 36 | 37 | public: 38 | DebugAdapterType(const std::string& name); 39 | 40 | static void Register(DebugAdapterType* type); 41 | 42 | virtual DebugAdapter* Create(BinaryNinja::BinaryView* data) = 0; 43 | 44 | virtual bool IsValidForData(BinaryNinja::BinaryView* data) = 0; 45 | 46 | virtual bool CanExecute(BinaryNinja::BinaryView* data) = 0; 47 | 48 | virtual bool CanConnect(BinaryNinja::BinaryView* data) = 0; 49 | 50 | std::string GetName() const { return m_name; } 51 | 52 | static DebugAdapterType* GetByName(const std::string& name); 53 | 54 | // Returns a list of usable DebugAdapters on the current system 55 | static std::vector GetAvailableAdapters(BinaryNinja::BinaryView* data); 56 | 57 | static std::string GetBestAdapterForCurrentSystem(BinaryNinja::BinaryView* data); 58 | }; 59 | }; // namespace BinaryNinjaDebugger -------------------------------------------------------------------------------- /core/debuggercommon.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | #include 19 | #ifndef WIN32 20 | #include "libgen.h" 21 | #endif 22 | 23 | namespace BinaryNinjaDebugger { 24 | struct ModuleNameAndOffset 25 | { 26 | // TODO: maybe we should use DebugModule instead of its name 27 | // Update: We are not using a DebugModule here because the base address information of it can be outdated; 28 | // instead, we only keep a name and an offset. 29 | std::string module; 30 | uint64_t offset; 31 | 32 | ModuleNameAndOffset() : module(""), offset(0) {} 33 | ModuleNameAndOffset(std::string mod, uint64_t off) : module(mod), offset(off) {} 34 | bool operator==(const ModuleNameAndOffset& other) const 35 | { 36 | return IsSameBaseModule(other) && (offset == other.offset); 37 | } 38 | bool operator<(const ModuleNameAndOffset& other) const 39 | { 40 | if (module < other.module) 41 | return true; 42 | if (module > other.module) 43 | return false; 44 | return offset < other.offset; 45 | } 46 | bool operator>(const ModuleNameAndOffset& other) const 47 | { 48 | if (module > other.module) 49 | return true; 50 | if (module < other.module) 51 | return false; 52 | return offset > other.offset; 53 | } 54 | 55 | 56 | static std::string GetPathBaseName(const std::string& path) 57 | { 58 | #ifdef WIN32 59 | // TODO: someone please write it on Windows! 60 | char baseName[MAX_PATH]; 61 | _splitpath(path.c_str(), NULL, NULL, baseName, NULL); 62 | return std::string(baseName); 63 | #else 64 | return basename(strdup(path.c_str())); 65 | #endif 66 | } 67 | 68 | 69 | bool IsSameBaseModule(const ModuleNameAndOffset& other) const 70 | { 71 | return ((module == other.module) || (GetPathBaseName(module) == GetPathBaseName(other.module))); 72 | } 73 | 74 | 75 | bool IsSameBaseModule(const std::string& other) const 76 | { 77 | return ((module == other) || (GetPathBaseName(module) == GetPathBaseName(other))); 78 | } 79 | 80 | 81 | static bool IsSameBaseModule(const std::string& module1, const std::string& module2) 82 | { 83 | return ((module1 == module2) || (GetPathBaseName(module1) == GetPathBaseName(module2))); 84 | } 85 | }; 86 | }; // namespace BinaryNinjaDebugger 87 | -------------------------------------------------------------------------------- /core/debuggerevent.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | #include "cstddef" 19 | #include 20 | #include "debuggercommon.h" 21 | #include "../api/ffi.h" 22 | 23 | namespace BinaryNinjaDebugger { 24 | typedef BNDebuggerEventType DebuggerEventType; 25 | typedef BNDebugStopReason DebugStopReason; 26 | typedef BNDebuggerAdapterOperation DebugAdapterOperation; 27 | 28 | struct TargetStoppedEventData 29 | { 30 | DebugStopReason reason; 31 | std::uint32_t lastActiveThread; 32 | size_t exitCode; 33 | void* data; 34 | }; 35 | 36 | 37 | struct ErrorEventData 38 | { 39 | std::string shortError {}; 40 | std::string error {}; 41 | void* data; 42 | }; 43 | 44 | 45 | struct TargetExitedEventData 46 | { 47 | uint64_t exitCode; 48 | }; 49 | 50 | 51 | struct StdoutMessageEventData 52 | { 53 | std::string message; 54 | }; 55 | 56 | 57 | // This should really be a union, but gcc complains... 58 | struct DebuggerEventData 59 | { 60 | TargetStoppedEventData targetStoppedData; 61 | ErrorEventData errorData; 62 | uint64_t absoluteAddress; 63 | ModuleNameAndOffset relativeAddress; 64 | TargetExitedEventData exitData; 65 | StdoutMessageEventData messageData; 66 | }; 67 | 68 | 69 | struct DebuggerEvent 70 | { 71 | DebuggerEventType type; 72 | DebuggerEventData data; 73 | }; 74 | }; // namespace BinaryNinjaDebugger 75 | -------------------------------------------------------------------------------- /core/debuggerexceptions.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | namespace BinaryNinjaDebugger { 20 | class ConnectionRefusedError : public std::exception 21 | { 22 | std::string m_error; 23 | 24 | public: 25 | ConnectionRefusedError(const std::string& error) : std::exception(), m_error(error) {} 26 | #ifdef __GNUC__ 27 | virtual const char* what() const noexcept 28 | { 29 | return m_error.c_str(); 30 | } 31 | #else 32 | virtual const char* what() const 33 | { 34 | return m_error.c_str(); 35 | } 36 | #endif 37 | }; 38 | 39 | 40 | class ProcessStartError : public std::exception 41 | { 42 | std::string m_error; 43 | 44 | public: 45 | ProcessStartError(const std::string& error) : std::exception(), m_error(error) {} 46 | #ifdef __GNUC__ 47 | virtual const char* what() const noexcept 48 | { 49 | return m_error.c_str(); 50 | } 51 | #else 52 | virtual const char* what() const 53 | { 54 | return m_error.c_str(); 55 | } 56 | #endif 57 | }; 58 | 59 | 60 | class NotExecutableError : public std::exception 61 | { 62 | std::string m_error; 63 | 64 | public: 65 | NotExecutableError(const std::string& error) : std::exception(), m_error(error) {} 66 | #ifdef __GNUC__ 67 | virtual const char* what() const noexcept 68 | { 69 | return m_error.c_str(); 70 | } 71 | #else 72 | virtual const char* what() const 73 | { 74 | return m_error.c_str(); 75 | } 76 | #endif 77 | }; 78 | 79 | 80 | class NotInstalledError : public std::exception 81 | { 82 | std::string m_error; 83 | 84 | public: 85 | NotInstalledError(const std::string& error) : std::exception(), m_error(error) {} 86 | #ifdef __GNUC__ 87 | virtual const char* what() const noexcept 88 | { 89 | return m_error.c_str(); 90 | } 91 | #else 92 | virtual const char* what() const 93 | { 94 | return m_error.c_str(); 95 | } 96 | #endif 97 | }; 98 | 99 | 100 | class PermissionDeniedError : public std::exception 101 | { 102 | std::string m_error; 103 | 104 | public: 105 | PermissionDeniedError(const std::string& error) : std::exception(), m_error(error) {} 106 | #ifdef __GNUC__ 107 | virtual const char* what() const noexcept 108 | { 109 | return m_error.c_str(); 110 | } 111 | #else 112 | virtual const char* what() const 113 | { 114 | return m_error.c_str(); 115 | } 116 | #endif 117 | }; 118 | }; // namespace BinaryNinjaDebugger 119 | -------------------------------------------------------------------------------- /core/debuggerfileaccessor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "debuggerfileaccessor.h" 18 | #include "debuggercontroller.h" 19 | 20 | using namespace BinaryNinja; 21 | using namespace BinaryNinjaDebugger; 22 | 23 | DebuggerFileAccessor::DebuggerFileAccessor(BinaryView* parent) 24 | { 25 | auto addressSize = parent->GetAddressSize(); 26 | auto bits = addressSize * 8; 27 | if (bits >= 64) 28 | m_length = UINT64_MAX; 29 | else 30 | m_length = (1ULL << bits) - 1; 31 | 32 | m_aggressiveAnalysisUpdate = Settings::Instance()->Get("debugger.aggressiveAnalysisUpdate"); 33 | 34 | m_controller = DebuggerController::GetController(parent); 35 | m_eventCallback = m_controller->RegisterEventCallback([this](const DebuggerEvent& event){ 36 | eventHandler(event); 37 | }, "Process View"); 38 | } 39 | 40 | 41 | DebuggerFileAccessor::~DebuggerFileAccessor() 42 | { 43 | if (m_controller) 44 | m_controller->RemoveEventCallback(m_eventCallback); 45 | } 46 | 47 | 48 | uint64_t DebuggerFileAccessor::GetLength() const 49 | { 50 | return m_length; 51 | } 52 | 53 | 54 | size_t DebuggerFileAccessor::Read(void *dest, uint64_t offset, size_t len) 55 | { 56 | DataBuffer buffer = m_controller->ReadMemory(offset, len); 57 | memcpy(dest, buffer.GetData(), buffer.GetLength()); 58 | 59 | return buffer.GetLength(); 60 | } 61 | 62 | 63 | size_t DebuggerFileAccessor::Write(uint64_t offset, const void *src, size_t len) 64 | { 65 | if (m_controller->WriteMemory(offset, DataBuffer(src, len))) 66 | { 67 | m_controller->GetData()->NotifyDataWritten(offset, len); 68 | return len; 69 | } 70 | 71 | return 0; 72 | } 73 | 74 | 75 | 76 | void DebuggerFileAccessor::MarkDirty() 77 | { 78 | // This hack will let the views (linear/graph) update its display 79 | if (m_aggressiveAnalysisUpdate) 80 | { 81 | m_controller->GetData()->NotifyDataWritten(0, GetLength()); 82 | } 83 | else 84 | { 85 | // This ensures or the BinaryDataListener, e.g, the linear view, refreshes its display. But it avoids any 86 | // functions get marked as update required 87 | m_controller->GetData()->NotifyDataWritten(0xdeadbeefdeadbeef, 0); 88 | } 89 | } 90 | 91 | 92 | void DebuggerFileAccessor::ForceMemoryCacheUpdate() 93 | { 94 | m_controller->GetData()->NotifyDataWritten(0, GetLength()); 95 | } 96 | 97 | 98 | void DebuggerFileAccessor::eventHandler(const DebuggerEvent &event) 99 | { 100 | switch (event.type) 101 | { 102 | case TargetStoppedEventType: 103 | // We should not call MarkDirty() in case of a TargetExitedEvent, since the debugger binary view is about to be 104 | // deleted. And it can cause a crash in certain cases. 105 | MarkDirty(); 106 | break; 107 | case ForceMemoryCacheUpdateEvent: 108 | ForceMemoryCacheUpdate(); 109 | break; 110 | default: 111 | break; 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /core/debuggerfileaccessor.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "binaryninjaapi.h" 20 | #include "debuggerevent.h" 21 | #include "refcountobject.h" 22 | 23 | using namespace BinaryNinja; 24 | 25 | namespace BinaryNinjaDebugger 26 | { 27 | class DebuggerController; 28 | 29 | class DebuggerFileAccessor: public FileAccessor 30 | { 31 | uint64_t m_length; 32 | 33 | DbgRef m_controller; 34 | size_t m_eventCallback; 35 | 36 | bool m_aggressiveAnalysisUpdate; 37 | 38 | public: 39 | DebuggerFileAccessor(BinaryView* parent); 40 | ~DebuggerFileAccessor(); 41 | bool IsValid() const override { return true; } 42 | uint64_t GetLength() const override; 43 | size_t Read(void* dest, uint64_t offset, size_t len) override; 44 | size_t Write(uint64_t offset, const void* src, size_t len) override; 45 | 46 | void MarkDirty(); 47 | void ForceMemoryCacheUpdate(); 48 | void eventHandler(const DebuggerEvent& event); 49 | }; 50 | } 51 | -------------------------------------------------------------------------------- /core/ffi_global.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | // Define macros for defining objects exposed by the API 20 | #define DECLARE_DEBUGGER_API_OBJECT(handle, cls) \ 21 | namespace BinaryNinjaDebugger { \ 22 | class cls; \ 23 | } \ 24 | struct handle \ 25 | { \ 26 | BinaryNinjaDebugger::cls* object; \ 27 | } 28 | #define IMPLEMENT_DEBUGGER_API_OBJECT(handle) \ 29 | \ 30 | private: \ 31 | handle m_apiObject; \ 32 | \ 33 | public: \ 34 | typedef handle* APIHandle; \ 35 | handle* GetAPIObject() \ 36 | { \ 37 | return &m_apiObject; \ 38 | } \ 39 | \ 40 | private: 41 | #define INIT_DEBUGGER_API_OBJECT() m_apiObject.object = this; 42 | -------------------------------------------------------------------------------- /core/semaphore.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "semaphore.h" 18 | using namespace BinaryNinjaDebugger; 19 | 20 | void Semaphore::Release() 21 | { 22 | std::unique_lock lock(m_mutex); 23 | ++m_count; 24 | m_cv.notify_one(); 25 | } 26 | 27 | 28 | void Semaphore::Wait() 29 | { 30 | std::unique_lock lock(m_mutex); 31 | while (!m_count) 32 | m_cv.wait(lock); 33 | --m_count; 34 | } 35 | -------------------------------------------------------------------------------- /core/semaphore.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | namespace BinaryNinjaDebugger { 23 | class Semaphore 24 | { 25 | std::mutex m_mutex; 26 | std::condition_variable m_cv; 27 | unsigned long m_count = 0; 28 | 29 | public: 30 | void Release(); 31 | void Wait(); 32 | }; 33 | }; // namespace BinaryNinjaDebugger 34 | -------------------------------------------------------------------------------- /debuggerui.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | icons/add.png 4 | icons/breakpoint.png 5 | icons/cancel.png 6 | icons/cctv-camera.png 7 | icons/connect.png 8 | icons/debugger.png 9 | icons/disconnect.png 10 | icons/menu.png 11 | icons/pause.png 12 | icons/remove.png 13 | icons/restart.png 14 | icons/resume.png 15 | icons/resume-reverse.png 16 | icons/settings.png 17 | icons/start.png 18 | icons/step-back.png 19 | icons/step-into.png 20 | icons/step-into-reverse.png 21 | icons/step-out.png 22 | icons/step-out-reverse.png 23 | icons/step-over.png 24 | icons/stop.png 25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/guide/corellium-remote-debugging.md: -------------------------------------------------------------------------------- 1 | # Corellium Remote Debugging 2 | 3 | [Corellium](https://www.corellium.com/) is a leading solution for virtual devices. It exposes a hypervisor-level 4 | debugger that enables the debugging of the entire device. Binary Ninja debugger has a dedicated debug adapter to 5 | connect to it. Below is a guide to set it up. 6 | 7 | 8 | ## Preparation 9 | 10 | - Create a virtual device following the Corellium documentation 11 | - In the "Connect" page, download the OpenVPN configuration file and connect to the [VPN](https://support.corellium.com/features/connect/vpn) 12 | - In the "Connect" page, find the gdb connection string, e.g., `lldb --one-line "gdb-remote 10.11.1.4:4000"`. Take 13 | note of the IP address and port 14 | - Download and install the [Debug Accelerator](https://support.corellium.com/features/connect/debug-accelerator) 15 | - Run `/path/to/debug_accelerator 10.11.1.1:4000 127.0.0.1:4000`, where the first address is the remote ip:port to 16 | connect to, and the second one is a local ip:port to listen on 17 | 18 | ## Connect to the Debugger from Binary NInja 19 | 20 | - In Menu, click "File" -> "Create New Mapped Data" 21 | - In the dialog that pops up, select an architecture that matches your target, which should be `aarch64` 22 | - In Menu, click "Debugger" -> "Connect to Remote Process..." 23 | - In the "Debug Adapter Settings" dialog, Select the `Corellium` adapter 24 | - Type in the local ip:port that the debug accelerator is operating on, e.g., `127.0.0.1:4000` 25 | - Click "Accept" 26 | 27 | Note, the above guide is for the cloud version of Corellium. If you have a 28 | [Desktop Appliance](https://support.corellium.com/environments/desktop-appliance), then you can skip the VPN connection 29 | and the debug accelerator -- the local connection is often times faster without it. 30 | 31 | -------------------------------------------------------------------------------- /docs/guide/gdbrsp-ttd.md: -------------------------------------------------------------------------------- 1 | # Time Travel Debugging (Linux) 2 | 3 | Time travel debugging (TTD) allows you to record an execution trace of a program or system and replay it back and forth. 4 | It can speed up the process of reverse engineering/vulnerability research, and deal with certain tasks that are not easy to handle in regular forward debugging. 5 | 6 | Several tools implement TTD. On Linux, Binary Ninja debugger has a GDB RSP adapter which can be used to replay/debug the 7 | trace produced by [rr](https://rr-project.org/). 8 | The combination of TTD and your familiar reverse engineer tool would hopefully supercharge the ability to time travel 9 | and make your workflow even more effective. 10 | 11 | Below is a guide to set it up. 12 | 13 | ## Install rr 14 | 15 | - Download and install the latest release from [https://github.com/rr-debugger/rr/releases](https://github.com/rr-debugger/rr/releases) 16 | 17 | ## Record an rr Trace 18 | 19 | - Record a trace with `rr your_program arg1 arg2` 20 | - This saves the trace into the default directory (`$HOME/.local/share/rr`). To specify a custom directory, 21 | use `-o target_dir` 22 | - For more options during the record, check out `rr record -h` 23 | 24 | ## Replay an rr Trace 25 | 26 | - Run `rr replay -h 0.0.0.0 -s 31337` 27 | - This will instruct rr to spawn a GDB stub and listen on port 31337 of all interfaces 28 | - It will replay the last recorded trace. To replay a different trace, specify the trace directory on the command line 29 | - For more options during the replay, check out `rr replay -h` 30 | 31 | ## Connect to the gdb stub in Binary Ninja 32 | 33 | - Open the binary file in Binary Ninja (optional) 34 | - Click Menu -> "Debugger" -> "Connect To Remote Process", the `Debug Adapter Settings` will popup 35 | - Select `GDB RSP` as the debug adapter 36 | - Type in the `IP Address` and `Port` in the previous step 37 | - Click `Accept` 38 | 39 | 40 | 41 | 42 | ## Debug the rr Trace 43 | 44 | - Once connected, the debugger should be paused within the loader (ld) 45 | - Now resume the target once, and the target should be paused at the program entry point 46 | - Most of the debugger functionalities should work in the very same way as a forward debugging 47 | - The control buttons in the debugger sidebar widget shows four new buttons for reverse debugging on the right side: 48 | - 49 | - These new buttons are in red color and flipped 50 | - You can hover over the button to see what they do and the keybindings for them 51 | -------------------------------------------------------------------------------- /docs/img/debugger/adaptersettings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/adaptersettings.png -------------------------------------------------------------------------------- /docs/img/debugger/attachtopid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/attachtopid.png -------------------------------------------------------------------------------- /docs/img/debugger/breakpointwidget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/breakpointwidget.png -------------------------------------------------------------------------------- /docs/img/debugger/contextmenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/contextmenu.png -------------------------------------------------------------------------------- /docs/img/debugger/controlbuttons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/controlbuttons.png -------------------------------------------------------------------------------- /docs/img/debugger/dbgeng_ttd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/dbgeng_ttd.png -------------------------------------------------------------------------------- /docs/img/debugger/debuggerconsole.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/debuggerconsole.png -------------------------------------------------------------------------------- /docs/img/debugger/debuggerinfo0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/debuggerinfo0.png -------------------------------------------------------------------------------- /docs/img/debugger/debuggerinfo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/debuggerinfo1.png -------------------------------------------------------------------------------- /docs/img/debugger/debuggerinfo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/debuggerinfo2.png -------------------------------------------------------------------------------- /docs/img/debugger/debuggermenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/debuggermenu.png -------------------------------------------------------------------------------- /docs/img/debugger/debugserver-dbgeng.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/debugserver-dbgeng.png -------------------------------------------------------------------------------- /docs/img/debugger/debugserver-lldb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/debugserver-lldb.png -------------------------------------------------------------------------------- /docs/img/debugger/expressionparser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/expressionparser.png -------------------------------------------------------------------------------- /docs/img/debugger/gdbrsp_ttd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/gdbrsp_ttd.png -------------------------------------------------------------------------------- /docs/img/debugger/modulewidget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/modulewidget.png -------------------------------------------------------------------------------- /docs/img/debugger/overrideip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/overrideip.png -------------------------------------------------------------------------------- /docs/img/debugger/platform-list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/platform-list.png -------------------------------------------------------------------------------- /docs/img/debugger/registerwidget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/registerwidget.png -------------------------------------------------------------------------------- /docs/img/debugger/remoteadaptersettings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/remoteadaptersettings.png -------------------------------------------------------------------------------- /docs/img/debugger/remoteprocess-gdbrsp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/remoteprocess-gdbrsp.png -------------------------------------------------------------------------------- /docs/img/debugger/remoteprocess-lldb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/remoteprocess-lldb.png -------------------------------------------------------------------------------- /docs/img/debugger/stacktracewidget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/stacktracewidget.png -------------------------------------------------------------------------------- /docs/img/debugger/stackvariable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/stackvariable.png -------------------------------------------------------------------------------- /docs/img/debugger/statuswidget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/statuswidget.png -------------------------------------------------------------------------------- /docs/img/debugger/targetterminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/targetterminal.png -------------------------------------------------------------------------------- /docs/img/debugger/threadwidgetcontextmenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/threadwidgetcontextmenu.png -------------------------------------------------------------------------------- /docs/img/debugger/ttd_buttons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/ttd_buttons.png -------------------------------------------------------------------------------- /docs/img/debugger/ttd_record.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/ttd_record.png -------------------------------------------------------------------------------- /docs/img/debugger/ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/ui.png -------------------------------------------------------------------------------- /docs/img/debugger/windows-kd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/windows-kd.png -------------------------------------------------------------------------------- /docs/img/debugger/windows_dump_file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/docs/img/debugger/windows_dump_file.png -------------------------------------------------------------------------------- /icons/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/icons/add.png -------------------------------------------------------------------------------- /icons/breakpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/icons/breakpoint.png -------------------------------------------------------------------------------- /icons/cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/icons/cancel.png -------------------------------------------------------------------------------- /icons/cctv-camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/icons/cctv-camera.png -------------------------------------------------------------------------------- /icons/connect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/icons/connect.png -------------------------------------------------------------------------------- /icons/debugger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/icons/debugger.png -------------------------------------------------------------------------------- /icons/disconnect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/icons/disconnect.png -------------------------------------------------------------------------------- /icons/menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/icons/menu.png -------------------------------------------------------------------------------- /icons/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/icons/pause.png -------------------------------------------------------------------------------- /icons/remove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/icons/remove.png -------------------------------------------------------------------------------- /icons/restart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/icons/restart.png -------------------------------------------------------------------------------- /icons/resume-reverse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/icons/resume-reverse.png -------------------------------------------------------------------------------- /icons/resume.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/icons/resume.png -------------------------------------------------------------------------------- /icons/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/icons/settings.png -------------------------------------------------------------------------------- /icons/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/icons/start.png -------------------------------------------------------------------------------- /icons/step-back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/icons/step-back.png -------------------------------------------------------------------------------- /icons/step-into-reverse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/icons/step-into-reverse.png -------------------------------------------------------------------------------- /icons/step-into.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/icons/step-into.png -------------------------------------------------------------------------------- /icons/step-out-reverse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/icons/step-out-reverse.png -------------------------------------------------------------------------------- /icons/step-out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/icons/step-out.png -------------------------------------------------------------------------------- /icons/step-over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/icons/step-over.png -------------------------------------------------------------------------------- /icons/stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/icons/stop.png -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "debugger" 3 | version = "1.0.0" 4 | description = "The official Binary Ninja debugger plugin." 5 | authors = ["Xusheng "] 6 | readme = "README.md" 7 | 8 | [tool.poetry.dependencies] 9 | python = "^3.9" 10 | pathlib = "^1.0.1" 11 | pytest = "^8.1.1" 12 | 13 | 14 | [build-system] 15 | requires = ["poetry-core"] 16 | build-backend = "poetry.core.masonry.api" 17 | -------------------------------------------------------------------------------- /scripts/build_linux: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export PATH=~/.local/bin:$PATH 3 | export PYTHONUNBUFFERED=1 4 | poetry install --sync --no-root 5 | poetry run python3 scripts/build.py "$@" 6 | -------------------------------------------------------------------------------- /scripts/build_linux-arm: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export PATH=~/.local/bin:$PATH 3 | export PYTHONUNBUFFERED=1 4 | poetry install --sync --no-root 5 | poetry run python3 scripts/build.py "$@" 6 | -------------------------------------------------------------------------------- /scripts/build_macosx: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export PATH=/usr/local/bin:~/Library/Python/3.9/bin:$PATH 3 | export PYTHONUNBUFFERED=1 4 | poetry install --sync --no-root 5 | poetry run python3 scripts/build.py "$@" 6 | -------------------------------------------------------------------------------- /scripts/build_win64.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set PYTHONUNBUFFERED=1 3 | poetry install --sync --no-root 4 | poetry run py -3 scripts\build.py %* 5 | -------------------------------------------------------------------------------- /scripts/target_llvm_version.py: -------------------------------------------------------------------------------- 1 | llvm_version = "19.1.7" 2 | msvc_build = "14.34" 3 | vs_version = "2022" -------------------------------------------------------------------------------- /test/README.md: -------------------------------------------------------------------------------- 1 | # Build and test instructions 2 | 3 | The binaries are now build by https://github.com/Vector35/debugger-test-binaries/actions. 4 | 5 | The debugger test binaries are now built by CMake. If you wish to run the unit test, there is no need to build these binaries. One only needs to build it when there are changes to the binaries. 6 | 7 | ## Run unit tests 8 | ```zsh 9 | cd test 10 | python3 debugger_test.py 11 | ``` 12 | 13 | ## macOS 14 | 15 | - arm64 16 | ```zsh 17 | cd test 18 | cmake -DARCH=arm64 . 19 | make 20 | ``` 21 | Build results are in `binaries/Darwin-arm64`. 22 | - x86_64 23 | ```zsh 24 | cd test 25 | cmake -DARCH=x86_64 . 26 | make 27 | ``` 28 | Build results are in `binaries/Darwin-x86_64`. 29 | 30 | ## Linux 31 | - x86_64 32 | ```Bash 33 | cd test 34 | cmake -DARCH=x86_64 . 35 | make 36 | ``` 37 | Build results are in `binaries/Linux-x86_64`. 38 | - x86 39 | ```Bash 40 | cd test 41 | cmake -DARCH=x86 . 42 | make 43 | ``` 44 | Build results are in `binaries/Linux-x86`. 45 | 46 | ## Windows 47 | - x86_64 48 | 49 | Open x64 Visual Studio command prompt 50 | ```cmd 51 | cd test 52 | cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DARCH=x86_64 . 53 | nmake 54 | ``` 55 | 56 | - x86 57 | Open x86 Visual Studio command prompt 58 | ```cmd 59 | cd test 60 | cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DARCH=x86 . 61 | nmake 62 | ``` 63 | 64 | [//]: # (force a build) -------------------------------------------------------------------------------- /test/binaries/Darwin-arm64/cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-arm64/cat -------------------------------------------------------------------------------- /test/binaries/Darwin-arm64/commandline_test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-arm64/commandline_test -------------------------------------------------------------------------------- /test/binaries/Darwin-arm64/do_exception: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-arm64/do_exception -------------------------------------------------------------------------------- /test/binaries/Darwin-arm64/exitcode: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-arm64/exitcode -------------------------------------------------------------------------------- /test/binaries/Darwin-arm64/getcwd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-arm64/getcwd -------------------------------------------------------------------------------- /test/binaries/Darwin-arm64/helloworld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-arm64/helloworld -------------------------------------------------------------------------------- /test/binaries/Darwin-arm64/helloworld_func: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-arm64/helloworld_func -------------------------------------------------------------------------------- /test/binaries/Darwin-arm64/helloworld_func_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-arm64/helloworld_func_pie -------------------------------------------------------------------------------- /test/binaries/Darwin-arm64/helloworld_loop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-arm64/helloworld_loop -------------------------------------------------------------------------------- /test/binaries/Darwin-arm64/helloworld_loop_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-arm64/helloworld_loop_pie -------------------------------------------------------------------------------- /test/binaries/Darwin-arm64/helloworld_objc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-arm64/helloworld_objc -------------------------------------------------------------------------------- /test/binaries/Darwin-arm64/helloworld_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-arm64/helloworld_pie -------------------------------------------------------------------------------- /test/binaries/Darwin-arm64/helloworld_recursion: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-arm64/helloworld_recursion -------------------------------------------------------------------------------- /test/binaries/Darwin-arm64/helloworld_recursion_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-arm64/helloworld_recursion_pie -------------------------------------------------------------------------------- /test/binaries/Darwin-arm64/helloworld_thread: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-arm64/helloworld_thread -------------------------------------------------------------------------------- /test/binaries/Darwin-arm64/helloworld_thread_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-arm64/helloworld_thread_pie -------------------------------------------------------------------------------- /test/binaries/Darwin-arm64/helloworld_virtual: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-arm64/helloworld_virtual -------------------------------------------------------------------------------- /test/binaries/Darwin-arm64/many_stdlib_calls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-arm64/many_stdlib_calls -------------------------------------------------------------------------------- /test/binaries/Darwin-arm64/md5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-arm64/md5 -------------------------------------------------------------------------------- /test/binaries/Darwin-arm64/nopspeed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-arm64/nopspeed -------------------------------------------------------------------------------- /test/binaries/Darwin-arm64/read_input: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-arm64/read_input -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/analysis_propagation: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/analysis_propagation -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/asmtest: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/asmtest -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/cat -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/commandline_test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/commandline_test -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/do_exception: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/do_exception -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/exitcode: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/exitcode -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/getcwd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/getcwd -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/hello: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/hello -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/helloworld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/helloworld -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/helloworld_func: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/helloworld_func -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/helloworld_func_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/helloworld_func_pie -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/helloworld_loop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/helloworld_loop -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/helloworld_loop_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/helloworld_loop_pie -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/helloworld_objc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/helloworld_objc -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/helloworld_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/helloworld_pie -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/helloworld_recursion: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/helloworld_recursion -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/helloworld_recursion_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/helloworld_recursion_pie -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/helloworld_thread: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/helloworld_thread -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/helloworld_thread_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/helloworld_thread_pie -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/helloworld_virtual: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/helloworld_virtual -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/indirect_calls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/indirect_calls -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/many_stdlib_calls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/many_stdlib_calls -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/md5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/md5 -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/missing_switch_case: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/missing_switch_case -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/nopspeed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/nopspeed -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/read_input: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/read_input -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/undiscovered_func: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/undiscovered_func -------------------------------------------------------------------------------- /test/binaries/Darwin-x86_64/undiscovered_func2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Darwin-x86_64/undiscovered_func2 -------------------------------------------------------------------------------- /test/binaries/Linux-arm64/cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-arm64/cat -------------------------------------------------------------------------------- /test/binaries/Linux-arm64/commandline_test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-arm64/commandline_test -------------------------------------------------------------------------------- /test/binaries/Linux-arm64/do_exception: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-arm64/do_exception -------------------------------------------------------------------------------- /test/binaries/Linux-arm64/exitcode: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-arm64/exitcode -------------------------------------------------------------------------------- /test/binaries/Linux-arm64/getcwd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-arm64/getcwd -------------------------------------------------------------------------------- /test/binaries/Linux-arm64/helloworld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-arm64/helloworld -------------------------------------------------------------------------------- /test/binaries/Linux-arm64/helloworld_func: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-arm64/helloworld_func -------------------------------------------------------------------------------- /test/binaries/Linux-arm64/helloworld_func_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-arm64/helloworld_func_pie -------------------------------------------------------------------------------- /test/binaries/Linux-arm64/helloworld_loop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-arm64/helloworld_loop -------------------------------------------------------------------------------- /test/binaries/Linux-arm64/helloworld_loop_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-arm64/helloworld_loop_pie -------------------------------------------------------------------------------- /test/binaries/Linux-arm64/helloworld_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-arm64/helloworld_pie -------------------------------------------------------------------------------- /test/binaries/Linux-arm64/helloworld_recursion: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-arm64/helloworld_recursion -------------------------------------------------------------------------------- /test/binaries/Linux-arm64/helloworld_recursion_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-arm64/helloworld_recursion_pie -------------------------------------------------------------------------------- /test/binaries/Linux-arm64/helloworld_thread: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-arm64/helloworld_thread -------------------------------------------------------------------------------- /test/binaries/Linux-arm64/helloworld_thread_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-arm64/helloworld_thread_pie -------------------------------------------------------------------------------- /test/binaries/Linux-arm64/helloworld_virtual: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-arm64/helloworld_virtual -------------------------------------------------------------------------------- /test/binaries/Linux-arm64/many_stdlib_calls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-arm64/many_stdlib_calls -------------------------------------------------------------------------------- /test/binaries/Linux-arm64/md5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-arm64/md5 -------------------------------------------------------------------------------- /test/binaries/Linux-arm64/nopspeed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-arm64/nopspeed -------------------------------------------------------------------------------- /test/binaries/Linux-arm64/read_input: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-arm64/read_input -------------------------------------------------------------------------------- /test/binaries/Linux-arm64/test_library: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-arm64/test_library -------------------------------------------------------------------------------- /test/binaries/Linux-x86/asmtest: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86/asmtest -------------------------------------------------------------------------------- /test/binaries/Linux-x86/cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86/cat -------------------------------------------------------------------------------- /test/binaries/Linux-x86/commandline_test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86/commandline_test -------------------------------------------------------------------------------- /test/binaries/Linux-x86/do_exception: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86/do_exception -------------------------------------------------------------------------------- /test/binaries/Linux-x86/exitcode: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86/exitcode -------------------------------------------------------------------------------- /test/binaries/Linux-x86/helloworld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86/helloworld -------------------------------------------------------------------------------- /test/binaries/Linux-x86/helloworld_func: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86/helloworld_func -------------------------------------------------------------------------------- /test/binaries/Linux-x86/helloworld_func_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86/helloworld_func_pie -------------------------------------------------------------------------------- /test/binaries/Linux-x86/helloworld_loop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86/helloworld_loop -------------------------------------------------------------------------------- /test/binaries/Linux-x86/helloworld_loop_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86/helloworld_loop_pie -------------------------------------------------------------------------------- /test/binaries/Linux-x86/helloworld_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86/helloworld_pie -------------------------------------------------------------------------------- /test/binaries/Linux-x86/helloworld_recursion: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86/helloworld_recursion -------------------------------------------------------------------------------- /test/binaries/Linux-x86/helloworld_recursion_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86/helloworld_recursion_pie -------------------------------------------------------------------------------- /test/binaries/Linux-x86/helloworld_thread: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86/helloworld_thread -------------------------------------------------------------------------------- /test/binaries/Linux-x86/helloworld_thread_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86/helloworld_thread_pie -------------------------------------------------------------------------------- /test/binaries/Linux-x86/helloworld_virtual: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86/helloworld_virtual -------------------------------------------------------------------------------- /test/binaries/Linux-x86/many_stdlib_calls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86/many_stdlib_calls -------------------------------------------------------------------------------- /test/binaries/Linux-x86/md5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86/md5 -------------------------------------------------------------------------------- /test/binaries/Linux-x86/nopspeed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86/nopspeed -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/analysis_propagation: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/analysis_propagation -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/asmtest: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/asmtest -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/cat -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/commandline_test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/commandline_test -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/do_exception: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/do_exception -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/exitcode: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/exitcode -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/hello: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/hello -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/helloworld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/helloworld -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/helloworld_func: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/helloworld_func -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/helloworld_func_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/helloworld_func_pie -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/helloworld_loop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/helloworld_loop -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/helloworld_loop_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/helloworld_loop_pie -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/helloworld_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/helloworld_pie -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/helloworld_recursion: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/helloworld_recursion -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/helloworld_recursion_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/helloworld_recursion_pie -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/helloworld_thread: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/helloworld_thread -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/helloworld_thread_pie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/helloworld_thread_pie -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/helloworld_virtual: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/helloworld_virtual -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/indirect_calls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/indirect_calls -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/many_stdlib_calls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/many_stdlib_calls -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/md5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/md5 -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/missing_switch_case: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/missing_switch_case -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/nopspeed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/nopspeed -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/undiscovered_func: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/undiscovered_func -------------------------------------------------------------------------------- /test/binaries/Linux-x86_64/undiscovered_func2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Linux-x86_64/undiscovered_func2 -------------------------------------------------------------------------------- /test/binaries/Windows-x86/asmtest.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86/asmtest.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86/cat.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86/cat.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86/commandline_test.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86/commandline_test.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86/do_exception.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86/do_exception.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86/exitcode.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86/exitcode.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86/helloworld.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86/helloworld.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86/helloworld_func.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86/helloworld_func.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86/helloworld_func_pie.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86/helloworld_func_pie.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86/helloworld_loop.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86/helloworld_loop.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86/helloworld_loop_pie.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86/helloworld_loop_pie.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86/helloworld_pie.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86/helloworld_pie.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86/helloworld_recursion.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86/helloworld_recursion.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86/helloworld_recursion_pie.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86/helloworld_recursion_pie.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86/helloworld_thread.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86/helloworld_thread.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86/helloworld_thread_pie.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86/helloworld_thread_pie.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86/helloworld_virtual.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86/helloworld_virtual.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86/many_stdlib_calls.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86/many_stdlib_calls.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86/md5.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86/md5.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86_64/asmtest.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86_64/asmtest.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86_64/cat.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86_64/cat.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86_64/commandline_test.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86_64/commandline_test.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86_64/do_exception.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86_64/do_exception.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86_64/exitcode.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86_64/exitcode.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86_64/hello.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86_64/hello.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86_64/helloworld.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86_64/helloworld.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86_64/helloworld_func.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86_64/helloworld_func.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86_64/helloworld_func_pie.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86_64/helloworld_func_pie.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86_64/helloworld_loop.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86_64/helloworld_loop.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86_64/helloworld_loop_pie.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86_64/helloworld_loop_pie.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86_64/helloworld_pie.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86_64/helloworld_pie.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86_64/helloworld_recursion.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86_64/helloworld_recursion.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86_64/helloworld_recursion_pie.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86_64/helloworld_recursion_pie.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86_64/helloworld_thread.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86_64/helloworld_thread.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86_64/helloworld_thread_pie.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86_64/helloworld_thread_pie.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86_64/helloworld_virtual.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86_64/helloworld_virtual.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86_64/indirect_calls.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86_64/indirect_calls.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86_64/many_stdlib_calls.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86_64/many_stdlib_calls.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86_64/md5.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86_64/md5.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86_64/missing_switch_case.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86_64/missing_switch_case.exe -------------------------------------------------------------------------------- /test/binaries/Windows-x86_64/undiscovered_func.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/Windows-x86_64/undiscovered_func.exe -------------------------------------------------------------------------------- /test/binaries/android-aarch64/do_exception: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/android-aarch64/do_exception -------------------------------------------------------------------------------- /test/binaries/android-aarch64/exitcode: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/android-aarch64/exitcode -------------------------------------------------------------------------------- /test/binaries/android-aarch64/helloworld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/android-aarch64/helloworld -------------------------------------------------------------------------------- /test/binaries/android-aarch64/helloworld_loop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/android-aarch64/helloworld_loop -------------------------------------------------------------------------------- /test/binaries/ios-arm64/do_exception: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/ios-arm64/do_exception -------------------------------------------------------------------------------- /test/binaries/ios-arm64/exitcode: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/ios-arm64/exitcode -------------------------------------------------------------------------------- /test/binaries/ios-arm64/helloworld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/ios-arm64/helloworld -------------------------------------------------------------------------------- /test/binaries/ios-arm64/helloworld_thread: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/binaries/ios-arm64/helloworld_thread -------------------------------------------------------------------------------- /test/debugserver-entitlements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.apple.security.cs.debugger 4 | com.apple.springboard.debugapplications 5 | run-unsigned-code 6 | get-task-allow 7 | task_for_pid-allow 8 | 9 | -------------------------------------------------------------------------------- /test/entitlements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.apple.security.get-task-allow 4 | 5 | com.apple.security.cs.disable-library-validation 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/src/asmtest_aarch64-android.s: -------------------------------------------------------------------------------- 1 | // NOTES: 2 | // kernel call: syscall number in x8, args in x0, x1, x2, ... 3 | // syscall number lookup /include/uapi/asm-generic/unistd.h 4 | // 5 | .global _start 6 | 7 | .text 8 | 9 | _start: 10 | nop 11 | bl bounce 12 | nop 13 | bl bounce 14 | nop 15 | bl bounce 16 | nop 17 | bl bounce 18 | nop 19 | bl bounce 20 | nop 21 | bl bounce 22 | nop 23 | bl bounce 24 | nop 25 | bl bounce 26 | 27 | mov x2, msglen // arg2: message length 28 | 29 | // TODO: explore in detail why this won't work 30 | //mov x1, msg // arg1: message 31 | adrp x1, msg 32 | add x1, x1, :lo12:msg 33 | 34 | mov x0, #1 // arg0: stdout 35 | 36 | mov x8, #64 // __NR_write 37 | svc #0 38 | 39 | mov x0, #0 // arg0: status 40 | mov x8, #94 // __NR_exit 41 | svc #0 42 | 43 | bounce: 44 | ret 45 | 46 | .data 47 | 48 | msg: 49 | .asciz "Hello, world!\n" 50 | 51 | msglen = . - msg 52 | 53 | -------------------------------------------------------------------------------- /test/src/asmtest_armv7-android.s: -------------------------------------------------------------------------------- 1 | .data 2 | 3 | /* Data segment: define our message string and calculate its length. */ 4 | msg: 5 | .ascii "Hello, ARM!\n" 6 | len = . - msg 7 | 8 | .text 9 | 10 | /* Our application's entry point. */ 11 | .globl _start 12 | _start: 13 | nop 14 | bl bounce 15 | nop 16 | bl bounce 17 | nop 18 | bl bounce 19 | nop 20 | bl bounce 21 | nop 22 | bl bounce 23 | nop 24 | bl bounce 25 | nop 26 | bl bounce 27 | nop 28 | bl bounce 29 | 30 | /* syscall write(int fd, const void *buf, size_t count) */ 31 | mov %r0, $1 /* fd := STDOUT_FILENO */ 32 | ldr %r1, =msg /* buf := msg */ 33 | ldr %r2, =len /* count := len */ 34 | mov %r7, $4 /* write is syscall #4 */ 35 | swi $0 /* invoke syscall */ 36 | 37 | /* syscall exit(int status) */ 38 | mov %r0, $0 /* status := 0 */ 39 | mov %r7, $1 /* exit is syscall #1 */ 40 | swi $0 /* invoke syscall */ 41 | 42 | bounce: 43 | bx %lr 44 | -------------------------------------------------------------------------------- /test/src/asmtest_x64.asm: -------------------------------------------------------------------------------- 1 | default rel 2 | 3 | %ifdef OS_IS_WINDOWS 4 | global WinMain 5 | extern ExitProcess, GetStdHandle, WriteConsoleA 6 | 7 | section .bss 8 | numCharsWritten resd 1 9 | 10 | section .text 11 | WinMain: 12 | %endif 13 | 14 | %ifdef OS_IS_LINUX 15 | global _start 16 | section .text 17 | _start: 18 | %endif 19 | 20 | %ifdef OS_IS_MACOS 21 | global start 22 | section .text 23 | start: 24 | %endif 25 | 26 | nop 27 | call bounce 28 | nop 29 | call bounce 30 | nop 31 | call bounce 32 | nop 33 | call bounce 34 | nop 35 | call bounce 36 | nop 37 | call bounce 38 | nop 39 | call bounce 40 | nop 41 | call bounce 42 | 43 | %ifdef OS_IS_WINDOWS 44 | mov ecx, -11 ; STD_OUTPUT_HANDLE 45 | call GetStdHandle 46 | 47 | push 0 48 | mov r9, numCharsWritten 49 | mov r8, msg.len 50 | mov rdx, msg 51 | mov rcx, rax 52 | call WriteConsoleA 53 | add rsp, 0x8 54 | 55 | mov rcx, 0 56 | call ExitProcess 57 | 58 | %else 59 | mov rsi, msg 60 | mov rdx, msg.len 61 | mov rdi, 1 ; stdout 62 | %endif 63 | 64 | %ifdef OS_IS_LINUX 65 | mov rax, 1 ; write 66 | syscall 67 | mov rdi, 0 ; arg0: status 68 | mov rax, 60 ; __NR_exit 69 | syscall 70 | %endif 71 | 72 | %ifdef OS_IS_MACOS 73 | mov rax, 0x2000004 ; write 74 | syscall 75 | mov rax, 0x2000001 ; exit 76 | mov rdi, 0 77 | syscall 78 | %endif 79 | 80 | bounce: 81 | retn 82 | 83 | section .data 84 | msg: 85 | db "Hello, world!", 0x0a 86 | .len: equ $ - msg 87 | -------------------------------------------------------------------------------- /test/src/asmtest_x86.asm: -------------------------------------------------------------------------------- 1 | default rel 2 | 3 | %ifdef OS_IS_WINDOWS 4 | global WinMain 5 | 6 | extern _GetStdHandle@4 7 | extern _WriteConsoleA@20 8 | extern _ExitProcess@4 9 | 10 | section .bss 11 | numCharsWritten resd 1 12 | 13 | section .text 14 | WinMain: 15 | %endif 16 | 17 | %ifdef OS_IS_LINUX 18 | global _start 19 | section .text 20 | _start: 21 | %endif 22 | 23 | nop 24 | call bounce 25 | nop 26 | call bounce 27 | nop 28 | call bounce 29 | nop 30 | call bounce 31 | nop 32 | call bounce 33 | nop 34 | call bounce 35 | nop 36 | call bounce 37 | nop 38 | call bounce 39 | 40 | %ifdef OS_IS_WINDOWS 41 | push -11 ; STD_OUTPUT_HANDLE 42 | call _GetStdHandle@4 43 | 44 | push 0 45 | push numCharsWritten 46 | push msglen 47 | push msg 48 | push eax 49 | call _WriteConsoleA@20 50 | add esp, 0x8 51 | 52 | push 0 53 | call _ExitProcess@4 54 | %endif 55 | 56 | %ifdef OS_IS_LINUX 57 | mov edx, msglen ; arg2: message length 58 | mov ecx, msg ; arg1: message 59 | mov ebx, 1 ; arg0: stdout 60 | mov eax, 4 ; __NR_write 61 | int 0x80 62 | 63 | mov ebx, 0 ; arg0: status 64 | mov eax, 1 ; __NR_exit 65 | int 0x80 66 | %endif 67 | 68 | bounce: 69 | ret 70 | 71 | section .data 72 | msg: db "Hello, world!", 0x0a, 0 73 | msglen: equ $ - msg 74 | -------------------------------------------------------------------------------- /test/src/cat.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int ac, char **av) 4 | { 5 | while (1) { 6 | int ch = fgetc(stdin); 7 | if (ch == EOF && (feof(stdin) || ferror(stdin))) { 8 | break; 9 | } 10 | fputc(ch, stdout); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /test/src/commandline_test.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int ac, char **av) 4 | { 5 | printf("Arguments: \n"); 6 | for (int i = 0; i < ac; i ++) { 7 | printf("%s\n", av[i]); 8 | } 9 | 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /test/src/do_exception.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | typedef int (*PFOO)(void); 6 | 7 | int main(int ac, char **av) 8 | { 9 | printf("start\n"); 10 | 11 | if(!strcmp(av[1], "segfault")) { 12 | printf("accessing from 0xDEADBEEF\n"); 13 | return *(int *)0xDEADBEEF; 14 | } 15 | 16 | if(!strcmp(av[1], "illegalinstr")) { 17 | #if defined(ARCH_IS_X64) 18 | printf("X64 bad instruction\n"); 19 | unsigned char buf[] = { 20 | 0x66, 0x06, // push es on x86, invalid in x64 21 | 0x0f, 0xb9, // ud2b 22 | 0x0f, 0x0b, // ud2 23 | 0xfe, 0xf0, 24 | 0x90, 25 | 0x90 26 | #elif defined(ARCH_IS_X86) 27 | printf("X86 bad instruction\n"); 28 | unsigned char buf[] = { 29 | 0x0f, 0x0b // ud2 30 | #elif defined(ARCH_IS_ARMV7) 31 | printf("ARMV7 bad instruction\n"); 32 | unsigned char buf[] = { 33 | 0xf0, 0xde, 0xf0, 0xe7, // little endian 0xe7f0def0 34 | 0xe7, 0xf0, 0xde, 0xf0 // big endian 35 | #elif defined(ARCH_IS_AARCH64) 36 | printf("AARCH64 bad instruction\n"); 37 | unsigned char buf[] = { 38 | // https://developer.arm.com/docs/ddi0596/a/a64-base-instructions-alphabetic-order/udf-permanently-undefined 39 | 0x00, 0x00, 0x00, 0x00 40 | #endif 41 | }; 42 | 43 | PFOO bar = (PFOO)buf; 44 | return bar(); 45 | } 46 | 47 | if(!strcmp(av[1], "divzero")) { 48 | printf("dividing by zero\n"); 49 | int foo = 31337; 50 | float result = 0; 51 | int i = 9; 52 | while(i >= 0) { 53 | printf("dividing by %d\n", i); 54 | result = foo/i; 55 | i -= 1; 56 | printf("result is: %f\n", result); 57 | } 58 | } 59 | 60 | printf("end\n"); 61 | return 0; 62 | } 63 | -------------------------------------------------------------------------------- /test/src/execute_test.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/src/exitcode.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int ac, char **av) 5 | { 6 | int rc = atoi(av[1]); 7 | printf("returning %d\n", rc); 8 | return rc; 9 | } 10 | -------------------------------------------------------------------------------- /test/src/hello_x64.asm: -------------------------------------------------------------------------------- 1 | default rel 2 | 3 | %ifdef OS_IS_WINDOWS 4 | global WinMain 5 | extern ExitProcess, GetStdHandle, WriteConsoleA 6 | 7 | section .bss 8 | numCharsWritten resd 1 9 | 10 | section .text 11 | WinMain: 12 | %endif 13 | 14 | %ifdef OS_IS_LINUX 15 | global _start 16 | section .text 17 | _start: 18 | %endif 19 | 20 | %ifdef OS_IS_MACOS 21 | global start 22 | section .text 23 | start: 24 | %endif 25 | 26 | %ifdef OS_IS_WINDOWS 27 | mov ecx, -11 ; STD_OUTPUT_HANDLE 28 | call GetStdHandle 29 | 30 | push 0 31 | mov r9, numCharsWritten 32 | mov r8, msg.len 33 | mov rdx, msg 34 | mov rcx, rax 35 | call WriteConsoleA 36 | add rsp, 0x8 37 | 38 | mov rcx, 0 39 | call ExitProcess 40 | 41 | %else 42 | lea rsi, [msg] 43 | mov rdx, msg.len 44 | mov rdi, 1 ; stdout 45 | %endif 46 | 47 | %ifdef OS_IS_LINUX 48 | mov rax, 1 ; write 49 | syscall 50 | mov rdi, 0 ; arg0: status 51 | mov rax, 60 ; __NR_exit 52 | syscall 53 | %endif 54 | 55 | %ifdef OS_IS_MACOS 56 | mov rax, 0x2000004 ; write 57 | syscall 58 | mov rax, 0x2000001 ; exit 59 | mov rdi, 0 60 | syscall 61 | %endif 62 | 63 | msg: 64 | db "Hello, world!", 0x0a 65 | .len: equ $ - msg 66 | -------------------------------------------------------------------------------- /test/src/helloworld.c: -------------------------------------------------------------------------------- 1 | // tests: cmdline arguments, process return value, stdout 2 | 3 | #include 4 | #include 5 | 6 | int main(int argc, char **argv) 7 | { 8 | int i; 9 | char path[1024] = {}; 10 | 11 | printf("Hello, world!\n"); 12 | if (getcwd(path, sizeof(path))) 13 | { 14 | printf("cwd: %s\n", path); 15 | } 16 | else 17 | { 18 | printf("fail to get cwd\n"); 19 | } 20 | 21 | printf("argc: %d\n", argc); 22 | for(i=0; i 2 | 3 | int hello(int a) 4 | { 5 | printf("Hello, world! %d\n", a); 6 | return a; 7 | } 8 | 9 | int main(int ac, char **av) 10 | { 11 | hello(0); 12 | hello(1); 13 | hello(2); 14 | hello(3); 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /test/src/helloworld_ios: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/test/src/helloworld_ios -------------------------------------------------------------------------------- /test/src/helloworld_loop.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #if defined(_WIN32) || defined(_WIN64) 4 | #include 5 | #define PIDFUNC _getpid 6 | #else 7 | #include 8 | #define PIDFUNC getpid 9 | #endif 10 | 11 | int main(int ac, char **av) 12 | { 13 | int i; 14 | for(i=0; 1; i++) { 15 | int process_id = PIDFUNC(); 16 | 17 | printf("Hello, world! pid:%d i:%d\n", process_id, i); 18 | int j; 19 | for(j=0; j<100000000; ++j) 20 | i = i*7; 21 | } 22 | return 11; 23 | } 24 | -------------------------------------------------------------------------------- /test/src/helloworld_objc.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | int main() { 4 | NSLog(@"Hello, world!"); 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /test/src/helloworld_recursion.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int fib(int a) 5 | { 6 | if (a == 0 || a == 1) { 7 | return 1; 8 | } 9 | return fib(a - 1) + fib(a - 2); 10 | } 11 | 12 | int main(int ac, char **av) 13 | { 14 | if (ac == 1) { 15 | for (int i = 0; i < 50; i ++) { 16 | printf("The %dth fibonacci number is %d\n", i, fib(i)); 17 | } 18 | } else { 19 | printf("The %dth fibonacci number is %d\n", atoi(av[1]), fib(atoi(av[1]))); 20 | } 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /test/src/helloworld_thread.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #if defined(_WIN32) || defined(_WIN64) 5 | #define OS_IS_WINDOWS 6 | #endif 7 | 8 | #if defined(OS_IS_WINDOWS) 9 | #include 10 | #else 11 | #include 12 | #include 13 | #include 14 | #endif 15 | 16 | #if defined(OS_IS_WINDOWS) 17 | DWORD WINAPI ThreadFunc(void* vargp) 18 | #define SLEEP1SEC Sleep(1000) 19 | #else 20 | void *thread_func(void *vargp) 21 | //#define SLEEP1SEC sleep(1) 22 | #define SLEEP1SEC for(int i=0; i<99999999; ++i) { foo *= 3; } 23 | #endif 24 | 25 | { 26 | int i; 27 | int myid = *(int *)vargp; 28 | srand(myid); 29 | for(i=0; i<1000; ++i) { 30 | printf("I'm thread %d.\n", myid); 31 | int foo = 7; 32 | /* stop at random rip, visible in debugger */ 33 | switch(rand()%10) { 34 | case 0: printf("rolled 0\n"); SLEEP1SEC; break; 35 | case 1: printf("rolled 1\n"); SLEEP1SEC; break; 36 | case 2: printf("rolled 2\n"); SLEEP1SEC; break; 37 | case 3: printf("rolled 3\n"); SLEEP1SEC; break; 38 | case 4: printf("rolled 4\n"); SLEEP1SEC; break; 39 | case 5: printf("rolled 5\n"); SLEEP1SEC; break; 40 | case 6: printf("rolled 6\n"); SLEEP1SEC; break; 41 | case 7: printf("rolled 7\n"); SLEEP1SEC; break; 42 | case 8: printf("rolled 8\n"); SLEEP1SEC; break; 43 | case 9: printf("rolled 9\n"); SLEEP1SEC; break; 44 | } 45 | } 46 | 47 | #if defined(OS_IS_WINDOWS) 48 | return 0; 49 | #else 50 | return NULL; 51 | #endif 52 | } 53 | 54 | int main(int ac, char **av) 55 | { 56 | printf("Before Thread\n"); 57 | 58 | #if defined(OS_IS_WINDOWS) 59 | DWORD ids[4] = {0, 1, 2, 3}; 60 | HANDLE hThreadArray[4]; 61 | hThreadArray[0] = CreateThread(NULL, 0, ThreadFunc, (void *)(ids+0), 0, NULL); 62 | hThreadArray[1] = CreateThread(NULL, 0, ThreadFunc, (void *)(ids+1), 0, NULL); 63 | hThreadArray[2] = CreateThread(NULL, 0, ThreadFunc, (void *)(ids+2), 0, NULL); 64 | hThreadArray[3] = CreateThread(NULL, 0, ThreadFunc, (void *)(ids+3), 0, NULL); 65 | WaitForMultipleObjects(4, hThreadArray, TRUE, INFINITE); 66 | #else 67 | int ids[4] = {0, 1, 2, 3}; 68 | pthread_t thread_id[4]; 69 | pthread_create(&thread_id[0], NULL, thread_func, (void *)(ids+0)); 70 | pthread_create(&thread_id[1], NULL, thread_func, (void *)(ids+1)); 71 | pthread_create(&thread_id[2], NULL, thread_func, (void *)(ids+2)); 72 | pthread_create(&thread_id[3], NULL, thread_func, (void *)(ids+3)); 73 | pthread_join(thread_id[0], NULL); 74 | pthread_join(thread_id[1], NULL); 75 | pthread_join(thread_id[2], NULL); 76 | pthread_join(thread_id[3], NULL); 77 | #endif 78 | 79 | return 12; 80 | } 81 | -------------------------------------------------------------------------------- /test/src/helloworld_virtual.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | class Foo { 5 | public: 6 | virtual ~Foo() {} 7 | virtual void bar() = 0; 8 | }; 9 | 10 | class Bar : public Foo { 11 | public: 12 | virtual void bar() { 13 | printf("Bar!\n"); 14 | } 15 | }; 16 | 17 | class Baz : public Bar { 18 | public: 19 | virtual void bar() { 20 | printf("Baz!\n"); 21 | } 22 | }; 23 | 24 | int main(int ac, char **av) 25 | { 26 | Foo* foo = new Baz(); 27 | foo->bar(); 28 | delete foo; 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /test/src/indirect_calls_x64.asm: -------------------------------------------------------------------------------- 1 | ; The point here is to test the ability to pass runtime information to analysis. 2 | ; 3 | ; The same `call ebx` is executed 4 times, see label ".dispatch". 4 | ; The first two times are with functions identified by analysis. 5 | ; The second two times evade analysis and require runtime information. 6 | ; Binja should make functions in the second two cases and add comments of runtime 7 | ; annotation option is enabled. 8 | 9 | default rel 10 | 11 | %ifdef OS_IS_LINUX 12 | global _start 13 | section .text 14 | _start: 15 | %endif 16 | 17 | %ifdef OS_IS_MACOS 18 | global start, junk, mapper 19 | section .text 20 | start: 21 | %endif 22 | 23 | %ifdef OS_IS_WINDOWS 24 | global WinMain 25 | extern ExitProcess, GetStdHandle, WriteConsoleA 26 | section .text 27 | WinMain: 28 | %endif 29 | 30 | mov rcx, 4 ; <------- LOOP VAR 31 | 32 | .next: 33 | push rcx 34 | 35 | .test4: 36 | cmp rcx, 4 37 | jne .test3 38 | lea rbx, [sub_00] 39 | jmp .dispatch 40 | 41 | .test3: 42 | cmp rcx, 3 43 | jne .test2 44 | lea rbx, [sub_01] 45 | jmp .dispatch 46 | 47 | .test2: 48 | cmp rcx, 2 49 | jne .test1 50 | lea rbx, [junk] 51 | mov rdi, 0x60 ; -> 0x30 52 | call mapper 53 | add rbx, rax 54 | jmp .dispatch 55 | 56 | .test1: 57 | cmp rcx, 1 58 | lea rbx, [junk] 59 | mov rdi, 0xC6 ; -> 0x63 60 | call mapper 61 | add rbx, rax 62 | 63 | .dispatch: 64 | call rbx ; <-------- HERE 65 | 66 | .check: 67 | pop rcx 68 | loop .next 69 | 70 | ; exit 71 | 72 | %ifdef OS_IS_LINUX 73 | mov rdi, 0 ; arg0: status 74 | mov rax, 60 ; __NR_exit 75 | syscall 76 | %endif 77 | 78 | %ifdef OS_IS_MACOS 79 | mov rax, 0x2000001 ; exit 80 | mov rdi, 0 81 | syscall 82 | %endif 83 | 84 | %ifdef OS_IS_WINDOWS 85 | mov rcx, 0 86 | call ExitProcess 87 | %endif 88 | 89 | ret 90 | 91 | sub_00: 92 | ret 93 | 94 | sub_01: 95 | nop 96 | ret 97 | 98 | junk: 99 | ; junk 100 | db 0xEF, 0x3D, 0x53, 0x7C, 0xFB, 0x80, 0x3B, 0x28 101 | db 0x15, 0xD1, 0xA2, 0xCD, 0x5E, 0x7E, 0xBC, 0xE1 102 | db 0xC6, 0x1B, 0x63, 0x05, 0xB7, 0xD3, 0xBA, 0x3B 103 | db 0x39, 0xCA, 0x46, 0xA1, 0x32, 0xD9, 0x8A, 0xB5 104 | db 0x8F, 0xD6, 0xFA, 0xAE, 0x08, 0x2D, 0xD5, 0x6F 105 | db 0x1E, 0xD6, 0xB8, 0x72, 0xA9, 0x8D, 0x86, 0xE8 106 | 107 | ; junk + 0x30 108 | ; hidden function ; sub_02() 109 | db 0x90 ; nop 110 | db 0x90 ; nop 111 | db 0xC3 ; ret 112 | 113 | ; junk + 0x33 114 | db 0xB4, 0xDE, 0xF0, 0x6B, 0x54, 0x40, 0x08, 0x46 115 | db 0xF6, 0xAC, 0xDD, 0x82, 0x8C, 0x74, 0x2C, 0x7F 116 | db 0xBD, 0x0B, 0xC1, 0xBA, 0x12, 0x1F, 0xD0, 0x7C 117 | db 0x44, 0xFF, 0x43, 0x5F, 0xC6, 0x85, 0xF3, 0x23 118 | db 0x6B, 0x65, 0x41, 0x2C, 0xB4, 0x4A, 0x5E, 0x24 119 | db 0x35, 0xBA, 0x57, 0x76, 0x18, 0xAB, 0xE0, 0x51 120 | 121 | ; junk + 0x63 122 | ; hidden function ; sub_03() 123 | db 0x90 ; nop 124 | db 0x90 ; nop 125 | db 0x90 ; nop 126 | db 0xC3 ; ret 127 | 128 | db 0xB9, 0x57, 0x18, 0x13, 0x61, 0xB0, 0x86, 0xBF 129 | db 0x1F, 0x6B, 0xB7, 0x72, 0x07, 0x35, 0xB1, 0x02 130 | db 0x7E, 0x6A, 0x2E, 0x1B, 0x7A, 0x0B, 0xEB, 0xDA 131 | db 0x05, 0xCF, 0xC9, 0xBD, 0x9E, 0xB6, 0x07, 0xBF 132 | 133 | mapper: 134 | mov rax, rdi ; arg0: number to map 135 | shr rax, 1 136 | ret 137 | -------------------------------------------------------------------------------- /test/src/many_stdlib_calls.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int ac, char **av) { 4 | for (int i = 0; i < 10; i ++) { 5 | printf("\n"); 6 | printf("\n"); 7 | printf("\n"); 8 | printf("\n"); 9 | printf("\n"); 10 | printf("\n"); 11 | printf("\n"); 12 | printf("\n"); 13 | printf("\n"); 14 | printf("\n"); 15 | printf("\n"); 16 | printf("\n"); 17 | printf("\n"); 18 | printf("\n"); 19 | printf("\n"); 20 | printf("\n"); 21 | printf("\n"); 22 | printf("\n"); 23 | printf("\n"); 24 | printf("\n"); 25 | printf("\n"); 26 | printf("\n"); 27 | printf("\n"); 28 | printf("\n"); 29 | printf("\n"); 30 | printf("\n"); 31 | printf("\n"); 32 | printf("\n"); 33 | printf("\n"); 34 | printf("\n"); 35 | printf("\n"); 36 | printf("\n"); 37 | } 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /test/src/md5/Makefile-linux: -------------------------------------------------------------------------------- 1 | all: md5_x64-linux 2 | 3 | md5_x64-linux: md5driver.c md5c.c global.h md5.h 4 | gcc -g -DMD=5 md5driver.c md5c.c -o md5_x64-linux 5 | -------------------------------------------------------------------------------- /test/src/md5/Makefile-macos: -------------------------------------------------------------------------------- 1 | all: md5_x64-macos 2 | 3 | md5_x64-macos: md5driver.c md5c.c global.h md5.h 4 | gcc -DMD=5 md5driver.c md5c.c -o md5_x64-macos 5 | -------------------------------------------------------------------------------- /test/src/md5/global.h: -------------------------------------------------------------------------------- 1 | /* GLOBAL.H - RSAREF types and constants 2 | */ 3 | 4 | #ifndef PROTOTYPES 5 | #define PROTOTYPES 0 6 | #endif 7 | 8 | #include 9 | 10 | /* POINTER defines a generic pointer type */ 11 | typedef uint8_t *POINTER; 12 | 13 | /* UINT2 defines a two byte word */ 14 | typedef uint16_t UINT2; 15 | 16 | /* UINT4 defines a four byte word */ 17 | typedef uint32_t UINT4; 18 | 19 | /* PROTO_LIST is defined depending on how PROTOTYPES is defined above. 20 | If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it 21 | returns an empty list. 22 | */ 23 | #if PROTOTYPES 24 | #define PROTO_LIST(list) list 25 | #else 26 | #define PROTO_LIST(list) () 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /test/src/md5/md5.h: -------------------------------------------------------------------------------- 1 | /* MD5.H - header file for MD5C.C 2 | */ 3 | 4 | /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All 5 | rights reserved. 6 | 7 | License to copy and use this software is granted provided that it 8 | is identified as the "RSA Data Security, Inc. MD5 Message-Digest 9 | Algorithm" in all material mentioning or referencing this software 10 | or this function. 11 | 12 | License is also granted to make and use derivative works provided 13 | that such works are identified as "derived from the RSA Data 14 | Security, Inc. MD5 Message-Digest Algorithm" in all material 15 | mentioning or referencing the derived work. 16 | 17 | RSA Data Security, Inc. makes no representations concerning either 18 | the merchantability of this software or the suitability of this 19 | software for any particular purpose. It is provided "as is" 20 | without express or implied warranty of any kind. 21 | 22 | These notices must be retained in any copies of any part of this 23 | documentation and/or software. 24 | */ 25 | 26 | /* MD5 context. */ 27 | typedef struct { 28 | UINT4 state[4]; /* state (ABCD) */ 29 | UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ 30 | unsigned char buffer[64]; /* input buffer */ 31 | } MD5_CTX; 32 | 33 | void MD5Init PROTO_LIST ((MD5_CTX *)); 34 | void MD5Update PROTO_LIST 35 | ((MD5_CTX *, unsigned char *, unsigned int)); 36 | void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *)); 37 | 38 | -------------------------------------------------------------------------------- /test/src/missing_switch_case_x64.asm: -------------------------------------------------------------------------------- 1 | ; Demonstrate runtime information informing analysis. 2 | ; 3 | ; The switch statement has 4 legitimate cases and 4 secret cases. 4 | ; Analysis will statically find the 4 legitimate. 5 | ; Analysis will learn the other 4 while stepping through the table dispatch at runtime. 6 | 7 | default rel 8 | 9 | %ifdef OS_IS_LINUX 10 | global _start 11 | section .text 12 | _start: 13 | %endif 14 | 15 | %ifdef OS_IS_MACOS 16 | global start 17 | section .text 18 | start: 19 | %endif 20 | 21 | %ifdef OS_IS_WINDOWS 22 | global WinMain 23 | extern ExitProcess, GetStdHandle, WriteConsoleA 24 | section .text 25 | WinMain: 26 | %endif 27 | 28 | start: 29 | ; get pointer past switch constraint (which binja static analyzed) 30 | lea rbx, [function_with_switch] 31 | mov edi, 14 32 | call mapper ; returns 7 33 | add rbx, rax ; skip over switch constraint 34 | 35 | ; call secret cases 36 | mov rcx, 4 37 | call rbx 38 | mov rcx, 5 39 | call rbx 40 | mov rcx, 6 41 | call rbx 42 | mov rcx, 7 43 | call rbx 44 | 45 | ; call legit cases 46 | mov rdi, 0 47 | call function_with_switch 48 | mov rdi, 1 49 | call function_with_switch 50 | mov rdi, 2 51 | call function_with_switch 52 | mov rdi, 3 53 | call function_with_switch 54 | 55 | %ifdef OS_IS_LINUX 56 | mov rdi, 0 ; arg0: status 57 | mov rax, 60 ; __NR_exit 58 | syscall 59 | %endif 60 | 61 | %ifdef OS_IS_MACOS 62 | mov rax, 0x2000001 ; exit 63 | mov rdi, 0 64 | syscall 65 | %endif 66 | 67 | %ifdef OS_IS_WINDOWS 68 | mov rcx, 0 69 | call ExitProcess 70 | %endif 71 | 72 | ; exit (so Binja knows end-of-function) 73 | ret 74 | 75 | function_with_switch: 76 | ; 00000000: 0x48, 0x89, 0xf9 77 | mov rcx, rdi ; arg0: 0,1,2,3 78 | ; 00000003: 0x48, 0x83, 0xe1, 0x03 79 | and rcx, 0x3 80 | ; 00000007: <--- jumping here bypasses the constraint 81 | 82 | lea rax, [.jump_table] 83 | movsx rdx, dword[rax+rcx*4] 84 | add rdx, rax 85 | jmp rdx 86 | 87 | .case0: 88 | mov rax, 0 89 | jmp .switch_end 90 | 91 | .case1: 92 | mov rax, 1 93 | jmp .switch_end 94 | 95 | .case2: 96 | mov rax, 2 97 | jmp .switch_end 98 | 99 | .case3: 100 | mov rax, 3 101 | jmp .switch_end 102 | 103 | .case4: 104 | mov rax, 4 105 | jmp .switch_end 106 | 107 | .case5: 108 | mov rax, 5 109 | jmp .switch_end 110 | 111 | .case6: 112 | mov rax, 6 113 | jmp .switch_end 114 | 115 | .case7: 116 | mov rax, 7 117 | jmp .switch_end 118 | 119 | .switch_end: 120 | ret 121 | 122 | .jump_table: 123 | dd function_with_switch.case0 - .jump_table 124 | dd function_with_switch.case1 - .jump_table 125 | dd function_with_switch.case2 - .jump_table 126 | dd function_with_switch.case3 - .jump_table 127 | ; these entries should be invisible/illegal to binja because of the "and 3" constraint 128 | dd function_with_switch.case4 - .jump_table 129 | dd function_with_switch.case5 - .jump_table 130 | dd function_with_switch.case6 - .jump_table 131 | dd function_with_switch.case7 - .jump_table 132 | 133 | ; evade data flow: return given number integer divided by 2 134 | mapper: 135 | mov rax, rdi 136 | shr rax, 1 137 | ret 138 | 139 | -------------------------------------------------------------------------------- /test/src/nopspeed.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | typedef uint64_t (*sc_fn)(); 8 | 9 | sc_fn gen_sc_fn(unsigned char *nops, uint64_t nop_len, uint64_t total_nop_bytes) { 10 | unsigned char *sc = malloc(total_nop_bytes + 0x100); 11 | uint64_t size = 0; 12 | 13 | // mfence 14 | sc[size++] = 0x0f; 15 | sc[size++] = 0xae; 16 | sc[size++] = 0xf0; 17 | 18 | // lfence 19 | sc[size++] = 0x0f; 20 | sc[size++] = 0xae; 21 | sc[size++] = 0xe8; 22 | 23 | // rdtsc 24 | sc[size++] = 0x0f; 25 | sc[size++] = 0x31; 26 | 27 | // push rax 28 | sc[size++] = 0x50; 29 | // push rdx 30 | sc[size++] = 0x52; 31 | 32 | while (size < total_nop_bytes) { 33 | for (int i = 0; i < nop_len; i ++) { 34 | sc[size++] = nops[i]; 35 | } 36 | } 37 | 38 | // rdtsc 39 | sc[size++] = 0x0f; 40 | sc[size++] = 0x31; 41 | 42 | // shl rdx, 0x20 43 | sc[size++] = 0x48; 44 | sc[size++] = 0xc1; 45 | sc[size++] = 0xe2; 46 | sc[size++] = 0x20; 47 | 48 | // xor rdx, rax 49 | sc[size++] = 0x48; 50 | sc[size++] = 0x31; 51 | sc[size++] = 0xc2; 52 | 53 | // pop rcx 54 | sc[size++] = 0x59; 55 | // pop rax 56 | sc[size++] = 0x58; 57 | 58 | // shl rcx, 0x20 59 | sc[size++] = 0x48; 60 | sc[size++] = 0xc1; 61 | sc[size++] = 0xe1; 62 | sc[size++] = 0x20; 63 | 64 | // xor rcx, rax 65 | sc[size++] = 0x48; 66 | sc[size++] = 0x31; 67 | sc[size++] = 0xc1; 68 | 69 | // sub rdx, rcx 70 | sc[size++] = 0x48; 71 | sc[size++] = 0x29; 72 | sc[size++] = 0xca; 73 | 74 | // mov rax, rcx 75 | sc[size++] = 0x48; 76 | sc[size++] = 0x89; 77 | sc[size++] = 0xd0; 78 | 79 | // ret 80 | sc[size++] = 0xc3; 81 | 82 | void *ptr = mmap(0, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE, 0, 0); 83 | 84 | if (ptr == MAP_FAILED) { 85 | perror("mmap"); 86 | exit(1); 87 | } 88 | 89 | memcpy(ptr, sc, size); 90 | 91 | free(sc); 92 | 93 | return ptr; 94 | } 95 | 96 | int main() { 97 | unsigned char nops[16][15] = { 98 | {0x90} 99 | , {0x66,0x90} 100 | , {0x0f,0x1f,0x00} 101 | , {0x0f,0x1f,0x40,0x00} 102 | , {0x0f,0x1f,0x44,0x00,0x00} 103 | , {0x66,0x0f,0x1f,0x44,0x00,0x00} 104 | , {0x0f,0x1f,0x80,0x00,0x00,0x00,0x00} 105 | , {0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00} 106 | , {0x66,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00} 107 | , {0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00} 108 | , {0x66,0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00} 109 | , {0x66,0x66,0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00} 110 | , {0x66,0x66,0x66,0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00} 111 | , {0x66,0x66,0x66,0x66,0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00} 112 | , {0x66,0x66,0x66,0x66,0x66,0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00} 113 | }; 114 | 115 | int total_nop_bytes = 0x800000; 116 | 117 | for (int i = 0; i < 15; i++) { 118 | sc_fn ptr = gen_sc_fn(nops[i], i + 1, total_nop_bytes); 119 | 120 | uint64_t sum = 0; 121 | uint64_t runs = 0; 122 | 123 | for (int j = 0; j < 1000; j ++) { 124 | uint64_t time = ptr(); 125 | sum += time; 126 | runs ++; 127 | } 128 | double avg = (double)sum / (double)runs; 129 | printf("0x%x bytes of nops of length %d took %f cycles on avg\n", total_nop_bytes, i + 1, avg); 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /test/src/read_input.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | char buffer[20]; 7 | // Disable the buffering so we can see the output immediately 8 | setvbuf(stdout, NULL, _IONBF, 0); 9 | printf("Please type an integer:\n"); 10 | fgets(buffer, sizeof(buffer), stdin); 11 | int result = atoi(buffer); 12 | printf("You typed: %d\n", result); 13 | return 0; 14 | } -------------------------------------------------------------------------------- /test/src/rm_func_starts.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # remove mach-o function starts by setting the size of the LUT in the load command to size 0 4 | # offs+0: cmd (0x26 == LC_FUNCTION_STARTS) 5 | # offs+4: cmdsize (0x10) 6 | # offs+8: LUT offset 7 | # offs+C: LUT size <---- HERE 8 | 9 | import sys 10 | from struct import unpack 11 | 12 | data = None 13 | with open(sys.argv[1], 'rb') as fp: 14 | data = fp.read() 15 | 16 | assert data[0:4] == b'\xCF\xFA\xED\xFE' 17 | assert data[4:8] == b'\x07\x00\x00\x01' # CPU_TYPE_X86_X64 18 | ncmds = unpack(' 48 25 | call mapper 26 | add rbx, rax 27 | call rbx 28 | 29 | ; calls ecret function #2 30 | lea rbx, [junk] 31 | mov rdi, 284 ; -> 142 32 | call mapper 33 | add rbx, rax 34 | call rbx 35 | 36 | ; done, exit 37 | mov rax, 0x2000001 ; exit 38 | mov rdi, 0 39 | syscall 40 | ret 41 | 42 | print_00: 43 | lea rsi, [.msg_start] 44 | lea rdx, [.done] 45 | sub rdx, rsi 46 | mov rdi, 1 ; stdout 47 | mov rax, 0x2000004 ; write 48 | syscall 49 | jmp .done 50 | .msg_start: 51 | db "I'm print_00!", 0x0a 52 | .done: 53 | ret 54 | 55 | print_01: 56 | mov rsi, .msg_start 57 | mov rdx, .done 58 | sub rdx, rsi 59 | mov rdi, 1 ; stdout 60 | mov rax, 0x2000004 ; write 61 | syscall 62 | jmp .done 63 | .msg_start: 64 | db "I'm print_01!", 0x0a 65 | .done: 66 | ret 67 | 68 | junk: 69 | ; junk 70 | db 0xEF, 0x3D, 0x53, 0x7C, 0xFB, 0x80, 0x3B, 0x28, 71 | db 0x15, 0xD1, 0xA2, 0xCD, 0x5E, 0x7E, 0xBC, 0xE1, 72 | db 0xC6, 0x1B, 0x63, 0x05, 0xB7, 0xD3, 0xBA, 0x3B, 73 | db 0x39, 0xCA, 0x46, 0xA1, 0x32, 0xD9, 0x8A, 0xB5, 74 | db 0x8F, 0xD6, 0xFA, 0xAE, 0x08, 0x2D, 0xD5, 0x6F, 75 | db 0x1E, 0xD6, 0xB8, 0x72, 0xA9, 0x8D, 0x86, 0xE8 76 | 77 | ; junk + 0x30 78 | ; hidden function 79 | db 0x48, 0x8D, 0x35, 0x18, 0x00, 0x00, 0x00, ; lea rsi, [.msg_start] 80 | db 0x48, 0x8D, 0x15, 0x1F, 0x00, 0x00, 0x00, ; lea rdx, [.done] 81 | db 0x48, 0x29, 0xF2 ; sub rdx, rsi 82 | db 0xBF, 0x01, 0x00, 0x00, 0x00 ; mov rdi, 1 ; stdout 83 | db 0xB8, 0x04, 0x00, 0x00, 0x02 ; mov rax, 0x2000004 ; write 84 | db 0x0F, 0x05 ; syscall 85 | db 0xEB, 0x0E ; jmp .done 86 | ; .msg_start: "YOU FOUND ME1" 87 | db 0x59, 0x4F, 0x55, 0x20, 0x46, 0x4F, 0x55, 0x4E, 0x44, 0x20, 0x4D, 0x45, 0x31, 0x0a 88 | ; .done: 89 | db 0xC3 ; ret 90 | 91 | ; junk + 0x5e 92 | db 0xB4, 0xDE, 0xF0, 0x6B, 0x54, 0x40, 0x08, 0x46, 93 | db 0xF6, 0xAC, 0xDD, 0x82, 0x8C, 0x74, 0x2C, 0x7F, 94 | db 0xBD, 0x0B, 0xC1, 0xBA, 0x12, 0x1F, 0xD0, 0x7C, 95 | db 0x44, 0xFF, 0x43, 0x5F, 0xC6, 0x85, 0xF3, 0x23, 96 | db 0x6B, 0x65, 0x41, 0x2C, 0xB4, 0x4A, 0x5E, 0x24, 97 | db 0x35, 0xBA, 0x57, 0x76, 0x18, 0xAB, 0xE0, 0x51 98 | 99 | ; junk + 0x8e 100 | ; hidden function 101 | db 0x48, 0x8D, 0x35, 0x18, 0x00, 0x00, 0x00, ; lea rsi, [.msg_start] 102 | db 0x48, 0x8D, 0x15, 0x1F, 0x00, 0x00, 0x00, ; lea rdx, [.done] 103 | db 0x48, 0x29, 0xF2 ; sub rdx, rsi 104 | db 0xBF, 0x01, 0x00, 0x00, 0x00 ; mov rdi, 1 ; stdout 105 | db 0xB8, 0x04, 0x00, 0x00, 0x02 ; mov rax, 0x2000004 ; write 106 | db 0x0F, 0x05 ; syscall 107 | db 0xEB, 0x0E ; jmp .done 108 | ; .msg_start: "YOU FOUND ME2" 109 | db 0x59, 0x4F, 0x55, 0x20, 0x46, 0x4F, 0x55, 0x4E, 0x44, 0x20, 0x4D, 0x45, 0x32, 0x0a 110 | ; .done: 111 | db 0xC3 ; ret 112 | 113 | ; evade data flow: return given number integer divided by 2 114 | mapper: 115 | mov rax, rdi ; arg0: number to map 116 | shr rax, 1 117 | ret 118 | -------------------------------------------------------------------------------- /test/src/undiscovered_func_x64.asm: -------------------------------------------------------------------------------- 1 | default rel 2 | 3 | %ifdef OS_IS_WINDOWS 4 | global WinMain 5 | extern ExitProcess 6 | 7 | section .text 8 | WinMain: 9 | %endif 10 | 11 | %ifdef OS_IS_LINUX 12 | global _start 13 | section .text 14 | _start: 15 | %endif 16 | 17 | %ifdef OS_IS_MACOS 18 | global start 19 | section .text 20 | start: 21 | %endif 22 | 23 | call undiscovered 24 | 25 | %ifdef OS_IS_WINDOWS 26 | mov rcx, 0 27 | call ExitProcess 28 | %endif 29 | 30 | %ifdef OS_IS_LINUX 31 | mov rdi, 0 ; arg0: status 32 | mov rax, 60 ; __NR_exit 33 | syscall 34 | %endif 35 | 36 | %ifdef OS_IS_MACOS 37 | mov rax, 0x2000001 ; exit 38 | mov rdi, 0 39 | syscall 40 | %endif 41 | 42 | retn 43 | 44 | undiscovered: 45 | ; lea rax, [rip] 46 | db 0x48, 0x8d, 0x05, 0x00, 0x00, 0x00, 0x00 47 | add rax, 6 48 | ; Fake call to rax 49 | push rax 50 | retn 51 | ; Unlabelled code that binja does not discover automatically 52 | mov rax, 0x1234 53 | mov rbx, 0x5678 54 | retn 55 | 56 | section .data 57 | -------------------------------------------------------------------------------- /ui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.9...3.15 FATAL_ERROR) 2 | 3 | project(debuggerui) 4 | 5 | set(CMAKE_AUTOMOC ON) 6 | set(CMAKE_AUTORCC ON) 7 | find_package(Qt6 COMPONENTS Core Gui Widgets REQUIRED) 8 | 9 | file(GLOB SOURCES *.cpp *.h ../debuggerui.qrc) 10 | list(FILTER SOURCES EXCLUDE REGEX moc_.*) 11 | list(FILTER SOURCES EXCLUDE REGEX qrc_.*) 12 | if (NOT WIN32) 13 | list(REMOVE_ITEM SOURCES ${PROJECT_SOURCE_DIR}/ttdrecord.h) 14 | list(REMOVE_ITEM SOURCES ${PROJECT_SOURCE_DIR}/ttdrecord.cpp) 15 | endif () 16 | 17 | if(DEMO) 18 | add_library(debuggerui STATIC ${SOURCES}) 19 | else() 20 | add_library(debuggerui SHARED ${SOURCES}) 21 | endif() 22 | 23 | if(BN_INTERNAL_BUILD) 24 | set_target_properties(debuggerui PROPERTIES 25 | LIBRARY_OUTPUT_DIRECTORY ${BN_CORE_PLUGIN_DIR} 26 | RUNTIME_OUTPUT_DIRECTORY ${BN_CORE_PLUGIN_DIR}) 27 | else() 28 | set_target_properties(debuggerui PROPERTIES 29 | LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out/plugins 30 | RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out/plugins 31 | ) 32 | endif() 33 | 34 | set_target_properties(debuggerui PROPERTIES 35 | CXX_STANDARD 17 36 | CXX_STANDARD_REQUIRED ON 37 | CXX_VISIBILITY_PRESET hidden 38 | VISIBILITY_INLINES_HIDDEN ON 39 | POSITION_INDEPENDENT_CODE ON 40 | ) 41 | 42 | target_link_libraries(debuggerui debuggerapi binaryninjaui Qt6::Core Qt6::Gui Qt6::Widgets) 43 | 44 | -------------------------------------------------------------------------------- /ui/adaptersettings.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include "inttypes.h" 26 | #include "binaryninjaapi.h" 27 | #include "viewframe.h" 28 | #include "fontsettings.h" 29 | #include "debuggerapi.h" 30 | #include "settingsview.h" 31 | 32 | using namespace BinaryNinjaDebuggerAPI; 33 | 34 | class AdapterSettingsDialog : public QDialog 35 | { 36 | Q_OBJECT 37 | 38 | private: 39 | DbgRef m_controller; 40 | QComboBox* m_adapterEntry; 41 | SettingsView* m_settingsView; 42 | QStackedWidget* m_stack; 43 | QMap m_viewMap; 44 | QLabel* m_noSettingsLabel; 45 | 46 | QWidget* getWidgetForAdapter(const QString& adapter); 47 | 48 | public: 49 | AdapterSettingsDialog(QWidget* parent, DbgRef controller, const std::string& highlightGroup = ""); 50 | 51 | private Q_SLOTS: 52 | void selectAdapter(const QString& adapter); 53 | void apply(); 54 | }; 55 | -------------------------------------------------------------------------------- /ui/codedatarenderer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "codedatarenderer.h" 18 | using namespace BinaryNinja; 19 | 20 | 21 | CodeDataRenderer::CodeDataRenderer() {} 22 | 23 | 24 | bool CodeDataRenderer::IsValidForData( 25 | BinaryView* data, uint64_t addr, Type* type, std::vector>& context) 26 | { 27 | auto sym = data->GetSymbolByAddress(addr); 28 | if (!sym) 29 | return false; 30 | 31 | auto name = sym->GetFullName(); 32 | if (name.substr(0, 14) != "BN_CODE_start_") 33 | return false; 34 | 35 | return type->GetClass() == ArrayTypeClass; 36 | } 37 | 38 | 39 | std::vector CodeDataRenderer::GetLinesForData(BinaryView* data, uint64_t addr, Type* type, 40 | const std::vector& prefix, size_t width, std::vector>& context, 41 | const std::string&) 42 | { 43 | std::vector result; 44 | DisassemblyTextLine contents; 45 | 46 | auto sym = data->GetSymbolByAddress(addr); 47 | if (!sym) 48 | return result; 49 | 50 | auto name = sym->GetFullName(); 51 | if (name.substr(0, 14) != "BN_CODE_start_") 52 | return result; 53 | 54 | if (type->GetClass() != ArrayTypeClass) 55 | return result; 56 | 57 | auto codeSize = type->GetElementCount(); 58 | auto arch = data->GetDefaultArchitecture(); 59 | if (!arch) 60 | return result; 61 | auto buffer = data->ReadBuffer(addr, codeSize); 62 | if (buffer.GetLength() == 0) 63 | return result; 64 | 65 | size_t totalRead = 0; 66 | while (totalRead < codeSize) 67 | { 68 | uint64_t lineAddr = addr + totalRead; 69 | size_t length = codeSize - totalRead; 70 | std::vector insnTokens; 71 | auto ok = arch->GetInstructionText((uint8_t*)buffer.GetDataAt(totalRead), lineAddr, length, insnTokens); 72 | if ((!ok) || (insnTokens.empty())) 73 | { 74 | insnTokens = {InstructionTextToken(TextToken, "??")}; 75 | length = arch->GetInstructionAlignment(); 76 | if (length == 0) 77 | length = 1; 78 | } 79 | 80 | contents.addr = lineAddr; 81 | contents.tokens = insnTokens; 82 | 83 | result.push_back(contents); 84 | totalRead += length; 85 | } 86 | 87 | return result; 88 | } 89 | -------------------------------------------------------------------------------- /ui/codedatarenderer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "binaryninjaapi.h" 20 | 21 | class CodeDataRenderer : public BinaryNinja::DataRenderer 22 | { 23 | public: 24 | CodeDataRenderer(); 25 | virtual bool IsValidForData(BinaryNinja::BinaryView* data, uint64_t addr, BinaryNinja::Type* type, 26 | std::vector>& context) override; 27 | virtual std::vector GetLinesForData(BinaryNinja::BinaryView* data, uint64_t addr, 28 | BinaryNinja::Type* type, const std::vector& prefix, size_t width, 29 | std::vector>& context, const std::string& language) override; 30 | }; -------------------------------------------------------------------------------- /ui/controlswidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include "binaryninjaapi.h" 25 | #include "uicontext.h" 26 | #include "debuggerapi.h" 27 | 28 | using namespace BinaryNinjaDebuggerAPI; 29 | 30 | 31 | class DebugControlsWidget : public QToolBar 32 | { 33 | Q_OBJECT 34 | 35 | private: 36 | std::string m_name; 37 | DbgRef m_controller; 38 | 39 | QAction* m_actionRun; 40 | QAction* m_actionAttachPid; 41 | QAction* m_actionRestart; 42 | QAction* m_actionQuit; 43 | QAction* m_actionDetach; 44 | QAction* m_actionPause; 45 | QAction* m_actionResume; 46 | QAction* m_actionGoBack; 47 | QAction* m_actionStepInto; 48 | QAction* m_actionStepIntoBack; 49 | QAction* m_actionStepOver; 50 | QAction* m_actionStepOverBack; 51 | QAction* m_actionStepReturn; 52 | QAction* m_actionStepReturnBack; 53 | 54 | QAction* m_actionSettings; 55 | 56 | bool canExec(); 57 | bool canConnect(); 58 | 59 | QIcon getColoredIcon(const QString& iconPath, const QColor& color); 60 | QString getToolTip(const QString& name); 61 | 62 | public: 63 | DebugControlsWidget(QWidget* parent, const std::string name, BinaryViewRef data); 64 | virtual ~DebugControlsWidget(); 65 | 66 | void setStartingEnabled(bool enabled); 67 | void setStoppingEnabled(bool enabled); 68 | void setSteppingEnabled(bool enabled); 69 | void setReverseSteppingEnabled(bool enabled); 70 | 71 | void updateButtons(); 72 | 73 | public Q_SLOTS: 74 | void performLaunch(); 75 | void performAttachPID(); 76 | void performRestart(); 77 | void performQuit(); 78 | void performDetach(); 79 | 80 | void performPause(); 81 | void performResume(); 82 | void performGoReverse(); 83 | void performStepInto(); 84 | void performStepIntoReverse(); 85 | void performStepOver(); 86 | void performStepOverReverse(); 87 | void performStepReturn(); 88 | void performStepReturnReverse(); 89 | 90 | void performSettings(); 91 | }; 92 | -------------------------------------------------------------------------------- /ui/debugadapterscriptingprovider.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "binaryninjaapi.h" 20 | #include "debuggerapi.h" 21 | #include "uitypes.h" 22 | 23 | class DebugAdapterScriptingInstance : public ScriptingInstance 24 | { 25 | private: 26 | Ref m_data; 27 | DebuggerControllerRef m_controller = nullptr; 28 | size_t m_debuggerEventCallback = -1; 29 | BNScriptingProviderInputReadyState m_readyStatus; 30 | 31 | public: 32 | DebugAdapterScriptingInstance(ScriptingProvider* provider); 33 | ~DebugAdapterScriptingInstance(); 34 | 35 | virtual BNScriptingProviderExecuteResult ExecuteScriptInput(const std::string& input); 36 | virtual BNScriptingProviderExecuteResult ExecuteScriptInputFromFilename(const std::string& filename); 37 | 38 | virtual void SetCurrentBinaryView(BinaryView* view); 39 | }; 40 | 41 | 42 | class DebugAdapterScriptingProvider : public ScriptingProvider 43 | { 44 | public: 45 | DebugAdapterScriptingProvider(); 46 | 47 | virtual Ref CreateNewInstance(); 48 | virtual bool LoadModule(const std::string& repository, const std::string& module, bool force); 49 | virtual bool InstallModules(const std::string& modules); 50 | }; 51 | 52 | 53 | void RegisterDebugAdapterScriptingProvider(); 54 | -------------------------------------------------------------------------------- /ui/debuggerwidget.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include "debuggerwidget.h" 22 | #include "ui.h" 23 | 24 | using namespace BinaryNinjaDebuggerAPI; 25 | using namespace BinaryNinja; 26 | using namespace std; 27 | 28 | 29 | DebuggerWidget::DebuggerWidget(const QString& name, ViewFrame* view, BinaryViewRef data) : 30 | SidebarWidget(name), m_view(view) 31 | { 32 | m_controller = DebuggerController::GetController(data); 33 | 34 | QVBoxLayout* layout = new QVBoxLayout(this); 35 | layout->setContentsMargins(0, 0, 0, 0); 36 | layout->setSpacing(0); 37 | layout->setAlignment(Qt::AlignTop); 38 | 39 | m_splitter = new QSplitter(Qt::Vertical, this); 40 | m_splitter->setChildrenCollapsible(true); 41 | 42 | m_controlsWidget = new DebugControlsWidget(this, "Controls", data); 43 | 44 | m_tabs = new QTabWidget(this); 45 | 46 | m_registersWidget = new DebugRegistersContainer(m_view, data, m_menu); 47 | m_breakpointsWidget = new DebugBreakpointsWidget(m_view, data, m_menu); 48 | 49 | m_tabs->addTab(m_registersWidget, "Registers"); 50 | m_tabs->addTab(m_breakpointsWidget, "Breakpoints"); 51 | 52 | m_splitter->addWidget(m_controlsWidget); 53 | m_splitter->addWidget(m_tabs); 54 | 55 | layout->addWidget(m_splitter); 56 | setLayout(layout); 57 | 58 | m_ui = DebuggerUI::GetForViewFrame(view); 59 | connect(m_ui, &DebuggerUI::debuggerEvent, this, &DebuggerWidget::uiEventHandler); 60 | } 61 | 62 | 63 | DebuggerWidget::~DebuggerWidget() {} 64 | 65 | 66 | void DebuggerWidget::notifyFontChanged() 67 | { 68 | m_registersWidget->updateFonts(); 69 | m_breakpointsWidget->updateFonts(); 70 | } 71 | 72 | 73 | void DebuggerWidget::updateContent() 74 | { 75 | m_registersWidget->updateContent(); 76 | } 77 | 78 | 79 | void DebuggerWidget::uiEventHandler(const DebuggerEvent& event) 80 | { 81 | m_controlsWidget->updateButtons(); 82 | switch (event.type) 83 | { 84 | case TargetStoppedEventType: 85 | // These updates ensure the widgets become empty after the target stops 86 | case DetachedEventType: 87 | case ActiveThreadChangedEvent: 88 | case RegisterChangedEvent: 89 | updateContent(); 90 | break; 91 | case RelativeBreakpointAddedEvent: 92 | case AbsoluteBreakpointAddedEvent: 93 | case RelativeBreakpointRemovedEvent: 94 | case AbsoluteBreakpointRemovedEvent: 95 | m_breakpointsWidget->updateContent(); 96 | break; 97 | default: 98 | break; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /ui/debuggerwidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include "inttypes.h" 26 | #include "binaryninjaapi.h" 27 | #include "viewframe.h" 28 | #include "fontsettings.h" 29 | #include "theme.h" 30 | #include "expandablegroup.h" 31 | #include "stackwidget.h" 32 | #include "breakpointswidget.h" 33 | #include "registerswidget.h" 34 | #include "moduleswidget.h" 35 | #include "controlswidget.h" 36 | #include "ui.h" 37 | #include "debuggerapi.h" 38 | 39 | class DebuggerUI; 40 | 41 | class DebuggerWidget : public SidebarWidget 42 | { 43 | Q_OBJECT; 44 | 45 | ViewFrame* m_view; 46 | DbgRef m_controller; 47 | 48 | QSplitter* m_splitter; 49 | QTabWidget* m_tabs; 50 | 51 | DebugControlsWidget* m_controlsWidget; 52 | DebugRegistersContainer* m_registersWidget; 53 | DebugBreakpointsWidget* m_breakpointsWidget; 54 | 55 | DebuggerUI* m_ui; 56 | 57 | //void shouldBeVisible() 58 | 59 | virtual void notifyFontChanged() override; 60 | 61 | private slots: 62 | void uiEventHandler(const DebuggerEvent& event); 63 | 64 | public: 65 | DebuggerWidget(const QString& name, ViewFrame* view, BinaryViewRef data); 66 | ~DebuggerWidget(); 67 | 68 | void updateContent(); 69 | }; 70 | 71 | 72 | class DebuggerWidgetType : public SidebarWidgetType 73 | { 74 | public: 75 | DebuggerWidgetType(const QImage& icon, const QString& name) : SidebarWidgetType(icon, name) {} 76 | 77 | bool isInReferenceArea() const override { return false; } 78 | 79 | SidebarWidget* createWidget(ViewFrame* frame, BinaryViewRef data) override 80 | { 81 | return new DebuggerWidget("Debugger", frame, data); 82 | } 83 | }; 84 | -------------------------------------------------------------------------------- /ui/renderlayer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "binaryninjaapi.h" 20 | 21 | using namespace BinaryNinja; 22 | 23 | 24 | class DebuggerRenderLayer : public RenderLayer 25 | { 26 | public: 27 | DebuggerRenderLayer(); 28 | 29 | void ApplyToBlock(Ref block, std::vector& lines) override; 30 | void ApplyToHighLevelILBody(Ref function, std::vector &lines) override; 31 | }; 32 | 33 | 34 | void RegisterRenderLayers(); 35 | -------------------------------------------------------------------------------- /ui/statusbar.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include "binaryninjaapi.h" 26 | #include "viewframe.h" 27 | #include "fontsettings.h" 28 | #include "debuggerapi.h" 29 | 30 | 31 | class DebuggerStatusBarWidget : public QWidget 32 | { 33 | Q_OBJECT 34 | 35 | QWidget* m_parent; 36 | ViewFrame* m_view; 37 | BinaryNinjaDebuggerAPI::DbgRef m_debugger; 38 | QLabel* m_status; 39 | 40 | size_t m_debuggerEventCallback; 41 | 42 | void setStatusText(const QString& text); 43 | 44 | public: 45 | DebuggerStatusBarWidget(QWidget* parent, ViewFrame* view, BinaryViewRef debugger); 46 | ~DebuggerStatusBarWidget(); 47 | 48 | void notifyFontChanged(); 49 | 50 | signals: 51 | void debuggerEvent(const BinaryNinjaDebuggerAPI::DebuggerEvent& event); 52 | 53 | private slots: 54 | void updateStatusText(const BinaryNinjaDebuggerAPI::DebuggerEvent& event); 55 | }; 56 | 57 | class DebuggerStatusBarContainer : public QWidget 58 | { 59 | ViewFrame* m_currentFrame; 60 | QHash m_consoleMap; 61 | 62 | QStackedWidget* m_consoleStack; 63 | 64 | //! Get the current active DebuggerConsole. Returns nullptr in the event of an error 65 | //! or if there is no active ChatBox. 66 | DebuggerStatusBarWidget* currentConsole() const; 67 | 68 | //! Delete the DebuggerConsole for the given view. 69 | void freeDebuggerConsoleForView(QObject*); 70 | 71 | public: 72 | DebuggerStatusBarContainer(); 73 | 74 | //! Send text to the actively-focused ChatBox. If there is no active ChatBox, 75 | //! no action will be taken. 76 | void sendText(const QString& msg) const; 77 | 78 | void notifyViewChanged(ViewFrame*); 79 | }; 80 | -------------------------------------------------------------------------------- /ui/targetscriptingprovier.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "targetscriptingprovier.h" 18 | 19 | using namespace BinaryNinja; 20 | using namespace BinaryNinjaDebuggerAPI; 21 | 22 | static TargetScriptingProvider* g_targetScriptingProvider = nullptr; 23 | 24 | TargetScriptingProvider::TargetScriptingProvider() : ScriptingProvider("Target", "target") {} 25 | 26 | 27 | Ref TargetScriptingProvider::CreateNewInstance() 28 | { 29 | return new TargetScriptingInstance(this); 30 | } 31 | 32 | 33 | bool TargetScriptingProvider::LoadModule(const std::string& repository, const std::string& module, bool force) 34 | { 35 | return false; 36 | } 37 | 38 | 39 | bool TargetScriptingProvider::InstallModules(const std::string& modules) 40 | { 41 | return false; 42 | } 43 | 44 | 45 | TargetScriptingInstance::TargetScriptingInstance(ScriptingProvider* provider) : ScriptingInstance(provider) 46 | { 47 | m_readyStatus = NotReadyForInput; 48 | } 49 | 50 | 51 | TargetScriptingInstance::~TargetScriptingInstance() 52 | { 53 | if (m_controller) 54 | m_controller->RemoveEventCallback(m_debuggerEventCallback); 55 | } 56 | 57 | 58 | void TargetScriptingInstance::SetCurrentBinaryView(BinaryNinja::BinaryView* view) 59 | { 60 | if (m_data.operator!=(view)) 61 | { 62 | m_data = view; 63 | if (m_data) 64 | { 65 | if (m_controller) 66 | m_controller->RemoveEventCallback(m_debuggerEventCallback); 67 | 68 | m_controller = DebuggerController::GetController(view); 69 | if (m_controller) 70 | { 71 | m_debuggerEventCallback = m_controller->RegisterEventCallback( 72 | [&](const DebuggerEvent& event) { 73 | if (event.type == StdoutMessageEventType) 74 | { 75 | const std::string message = event.data.messageData.message; 76 | Output(message); 77 | } 78 | }, 79 | "Target Console"); 80 | } 81 | } 82 | else 83 | { 84 | if (m_controller) 85 | { 86 | m_controller->RemoveEventCallback(m_debuggerEventCallback); 87 | m_controller = nullptr; 88 | m_debuggerEventCallback = -1; 89 | } 90 | } 91 | } 92 | 93 | BNScriptingProviderInputReadyState newReadyStatus = NotReadyForInput; 94 | if (m_data && m_controller) 95 | newReadyStatus = ReadyForScriptExecution; 96 | else 97 | newReadyStatus = NotReadyForInput; 98 | 99 | if (newReadyStatus != m_readyStatus) 100 | { 101 | m_readyStatus = newReadyStatus; 102 | InputReadyStateChanged(m_readyStatus); 103 | } 104 | } 105 | 106 | 107 | BNScriptingProviderExecuteResult TargetScriptingInstance::ExecuteScriptInput(const std::string& input) 108 | { 109 | if (m_controller) 110 | { 111 | m_controller->WriteStdin(input); 112 | return SuccessfulScriptExecution; 113 | } 114 | return InvalidScriptInput; 115 | } 116 | 117 | 118 | BNScriptingProviderExecuteResult TargetScriptingInstance::ExecuteScriptInputFromFilename(const std::string& filename) 119 | { 120 | return SuccessfulScriptExecution; 121 | } 122 | 123 | 124 | void RegisterTargetScriptingProvider() 125 | { 126 | static TargetScriptingProvider provider; 127 | ScriptingProvider::Register(&provider); 128 | g_targetScriptingProvider = &provider; 129 | } 130 | -------------------------------------------------------------------------------- /ui/targetscriptingprovier.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "binaryninjaapi.h" 20 | #include "debuggerapi.h" 21 | #include "uitypes.h" 22 | 23 | class TargetScriptingInstance : public ScriptingInstance 24 | { 25 | private: 26 | Ref m_data; 27 | DebuggerControllerRef m_controller = nullptr; 28 | size_t m_debuggerEventCallback = -1; 29 | BNScriptingProviderInputReadyState m_readyStatus; 30 | 31 | public: 32 | TargetScriptingInstance(ScriptingProvider* provider); 33 | ~TargetScriptingInstance(); 34 | 35 | virtual BNScriptingProviderExecuteResult ExecuteScriptInput(const std::string& input); 36 | virtual BNScriptingProviderExecuteResult ExecuteScriptInputFromFilename(const std::string& filename); 37 | 38 | virtual void SetCurrentBinaryView(BinaryView* view); 39 | }; 40 | 41 | 42 | class TargetScriptingProvider : public ScriptingProvider 43 | { 44 | public: 45 | TargetScriptingProvider(); 46 | 47 | virtual Ref CreateNewInstance(); 48 | virtual bool LoadModule(const std::string& repository, const std::string& module, bool force); 49 | virtual bool InstallModules(const std::string& modules); 50 | }; 51 | 52 | 53 | void RegisterTargetScriptingProvider(); 54 | -------------------------------------------------------------------------------- /ui/ttdrecord.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include "inttypes.h" 26 | #include "binaryninjaapi.h" 27 | #include "viewframe.h" 28 | #include "fontsettings.h" 29 | #include "debuggerapi.h" 30 | 31 | using namespace BinaryNinjaDebuggerAPI; 32 | 33 | class TTDRecordDialog : public QDialog 34 | { 35 | Q_OBJECT 36 | 37 | private: 38 | DbgRef m_controller = nullptr; 39 | QLineEdit* m_pathEntry; 40 | QLineEdit* m_workingDirectoryEntry; 41 | QLineEdit* m_argumentsEntry; 42 | QLineEdit* m_outputDirectory; 43 | QCheckBox* m_launchWithoutTracing; 44 | 45 | public: 46 | TTDRecordDialog(QWidget* parent, BinaryView* data); 47 | void DoTTDTrace(); 48 | std::string GetTTDRecorderPath(); 49 | 50 | private Q_SLOTS: 51 | void apply(); 52 | }; 53 | -------------------------------------------------------------------------------- /ui/ui.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include "binaryninjaapi.h" 25 | #include "uicontext.h" 26 | #include "debuggerwidget.h" 27 | #include "debuggerapi.h" 28 | #include "statusbar.h" 29 | #include "uitypes.h" 30 | 31 | // Each UIContext has exactly one GlobalDebuggerUI. One GlobalDebuggerUI can contain multiple DebuggerUI. 32 | class GlobalDebuggerUI : public QObject 33 | { 34 | Q_OBJECT 35 | 36 | private: 37 | UIContext* m_context; 38 | QMainWindow* m_window; 39 | DebuggerStatusBarContainer* m_status; 40 | bool m_displayingGlobalAreaWidgets; 41 | 42 | static void CreateGlobalAreaWidgets(UIContext* context); 43 | static void CloseGlobalAreaWidgets(UIContext* context); 44 | 45 | void installTTD(const UIActionContext& ctxt); 46 | 47 | public: 48 | GlobalDebuggerUI(UIContext* context); 49 | ~GlobalDebuggerUI(); 50 | 51 | static void InitializeUI(); 52 | 53 | static GlobalDebuggerUI* CreateForContext(UIContext* context); 54 | static GlobalDebuggerUI* GetForContext(UIContext* context); 55 | static void RemoveForContext(UIContext* context); 56 | 57 | void SetActiveFrame(ViewFrame* frame); 58 | 59 | void SetupMenu(UIContext* context); 60 | 61 | void SetDisplayingGlobalAreaWidgets(bool display); 62 | }; 63 | 64 | 65 | class DebuggerUI : public QObject 66 | { 67 | Q_OBJECT 68 | 69 | private: 70 | UIContext* m_context; 71 | DbgRef m_controller; 72 | 73 | size_t m_eventCallback; 74 | 75 | public: 76 | DebuggerUI(UIContext* context, DebuggerControllerRef controller); 77 | ~DebuggerUI(); 78 | 79 | static DebuggerUI* CreateForViewFrame(ViewFrame* frame); 80 | static DebuggerUI* GetForViewFrame(ViewFrame* frame); 81 | static void DeleteForViewFrame(ViewFrame* frame); 82 | 83 | void navigateDebugger(uint64_t address); 84 | void openDebuggerSideBar(ViewFrame* frame = nullptr); 85 | void navigateToCurrentIP(); 86 | void navigateToMappedAddress(); 87 | void checkFocusDebuggerConsole(); 88 | 89 | signals: 90 | void debuggerEvent(const DebuggerEvent& event); 91 | 92 | private slots: 93 | void updateUI(const DebuggerEvent& event); 94 | }; 95 | -------------------------------------------------------------------------------- /ui/uinotification.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "uicontext.h" 20 | 21 | class NotificationListener : UIContextNotification 22 | { 23 | static NotificationListener* m_instance; 24 | 25 | public: 26 | virtual void OnContextOpen(UIContext* context) override; 27 | virtual void OnContextClose(UIContext* context) override; 28 | virtual bool OnBeforeOpenDatabase(UIContext* context, FileMetadataRef metadata) override; 29 | virtual bool OnAfterOpenDatabase(UIContext* context, FileMetadataRef metadata, BinaryViewRef data) override; 30 | virtual bool OnBeforeOpenFile(UIContext* context, FileContext* file) override; 31 | virtual void OnAfterOpenFile(UIContext* context, FileContext* file, ViewFrame* frame) override; 32 | virtual bool OnBeforeSaveFile(UIContext* context, FileContext* file, ViewFrame* frame) override; 33 | virtual void OnAfterSaveFile(UIContext* context, FileContext* file, ViewFrame* frame) override; 34 | virtual bool OnBeforeCloseFile(UIContext* context, FileContext* file, ViewFrame* frame) override; 35 | virtual void OnAfterCloseFile(UIContext* context, FileContext* file, ViewFrame* frame) override; 36 | virtual void OnViewChange(UIContext* context, ViewFrame* frame, const QString& type) override; 37 | virtual void OnAddressChange( 38 | UIContext* context, ViewFrame* frame, View* view, const ViewLocation& location) override; 39 | virtual bool GetNameForFile(UIContext* context, FileContext* file, QString& name) override; 40 | virtual bool GetNameForPath(UIContext* context, const QString& path, QString& name) override; 41 | 42 | virtual void OnContextMenuCreated(UIContext* context, View* view, Menu& menu) override; 43 | static void init(); 44 | }; -------------------------------------------------------------------------------- /ui/uitypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020-2025 Vector 35 Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "debuggerapi.h" 20 | 21 | typedef BinaryNinjaDebuggerAPI::DbgRef DebuggerControllerRef; -------------------------------------------------------------------------------- /vendor/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/debugger/093dd49026b8973f9a8d92c40a2f4cc818e510c2/vendor/.gitkeep -------------------------------------------------------------------------------- /vendor/pugixml/pugiconfig.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * pugixml parser - version 1.11 3 | * -------------------------------------------------------- 4 | * Copyright (C) 2006-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) 5 | * Report bugs and download new versions at https://pugixml.org/ 6 | * 7 | * This library is distributed under the MIT License. See notice at the end 8 | * of this file. 9 | * 10 | * This work is based on the pugxml parser, which is: 11 | * Copyright (C) 2003, by Kristen Wegner (kristen@tima.net) 12 | */ 13 | 14 | #ifndef HEADER_PUGICONFIG_HPP 15 | #define HEADER_PUGICONFIG_HPP 16 | 17 | // Uncomment this to enable wchar_t mode 18 | // #define PUGIXML_WCHAR_MODE 19 | 20 | // Uncomment this to enable compact mode 21 | // #define PUGIXML_COMPACT 22 | 23 | // Uncomment this to disable XPath 24 | // #define PUGIXML_NO_XPATH 25 | 26 | // Uncomment this to disable STL 27 | // #define PUGIXML_NO_STL 28 | 29 | // Uncomment this to disable exceptions 30 | // #define PUGIXML_NO_EXCEPTIONS 31 | 32 | // Set this to control attributes for public classes/functions, i.e.: 33 | // #define PUGIXML_API __declspec(dllexport) // to export all public symbols from DLL 34 | // #define PUGIXML_CLASS __declspec(dllimport) // to import all classes from DLL 35 | // #define PUGIXML_FUNCTION __fastcall // to set calling conventions to all public functions to fastcall 36 | // In absence of PUGIXML_CLASS/PUGIXML_FUNCTION definitions PUGIXML_API is used instead 37 | 38 | // Tune these constants to adjust memory-related behavior 39 | // #define PUGIXML_MEMORY_PAGE_SIZE 32768 40 | // #define PUGIXML_MEMORY_OUTPUT_STACK 10240 41 | // #define PUGIXML_MEMORY_XPATH_PAGE_SIZE 4096 42 | 43 | // Tune this constant to adjust max nesting for XPath queries 44 | // #define PUGIXML_XPATH_DEPTH_LIMIT 1024 45 | 46 | // Uncomment this to switch to header-only version 47 | // #define PUGIXML_HEADER_ONLY 48 | 49 | // Uncomment this to enable long long support 50 | // #define PUGIXML_HAS_LONG_LONG 51 | 52 | #endif 53 | 54 | /** 55 | * Copyright (c) 2006-2020 Arseny Kapoulkine 56 | * 57 | * Permission is hereby granted, free of charge, to any person 58 | * obtaining a copy of this software and associated documentation 59 | * files (the "Software"), to deal in the Software without 60 | * restriction, including without limitation the rights to use, 61 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 62 | * copies of the Software, and to permit persons to whom the 63 | * Software is furnished to do so, subject to the following 64 | * conditions: 65 | * 66 | * The above copyright notice and this permission notice shall be 67 | * included in all copies or substantial portions of the Software. 68 | * 69 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 70 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 71 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 72 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 73 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 74 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 75 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 76 | * OTHER DEALINGS IN THE SOFTWARE. 77 | */ 78 | --------------------------------------------------------------------------------