Files
ghidra/Ghidra/Debug/Debugger-agent-lldb/data/InstructionsForPatchingLLDB.txt
2021-10-07 12:47:18 -04:00

31 lines
1.6 KiB
Plaintext

This directory include a fragment of the LLVM lldb source tree with modifications to generate Java JNI wrappers for the Scripting Bridge API via SWIG. Some of these are source modifications, some compilation instructions, some add exports. To use lldb with Ghidra, you will need to:
(A) Download and build lldb following the standard guidelines from https://lldb.llvm.org
(B) Modify the lldb code along the lines of the included code and rebuild
(C) Copy the resulting liblldb.dylib (for macOS) or liblldb.so (for Linux) into the system directory
The SWIG-generated Java files that form the JNI interface have already been included as class files in the Ghidra jars. That said, if the exported API has changed and caused a mismatch, they may need to be replaced and recompiled. The Ghidra versions live in Ghidra/Debug/Debugger-agent-lldb/src/main/java/SWIG.
The CMake changes live in:
- lldb/CMakeLists.txt
- lldb/bindings/CMakeLists.txt
- lldb/bindings/java/CMakeLists.txt (new)
- lldb/source/API/CMakeLists.txt
Most of the changes involve adding LLDB_ENABLE_JAVA, in line with LLDB_ENABLE_LUA and LLDB_ENABLE_PYTHON. The same templates are used for all three.
A minor change to lldb/source/API/SBDebugger.cpp adds LLDB_ENABLE_JAVA to the config options.
Extra export patterns have been added to:
- lldb/source/API/liblldb.exports
- lldb/source/API/liblldb.private-exports
to accommodate the Java patterns.
Two new .swig files have been added, which may be copied over as is:
- lldb/bindings/java/java.swig
- lldb/bindings/java/java-typemaps.swig
The latter adds access for ByteArrays.
Finally, lldb/cmake/modules/FindJavaAndSwig.cmake has been added as the generator.