isle/tools/ghidra_scripts
jonschz d869d565c2
Fix Ghidra import script re-importing unchanged functions (#1035)
* feat: Reuse enums instead of recreating them every time

* feat: Support verifying return values larger than 4 bytes

* feat: Ignore `__$ReturnUdt` in template functions

* run formatter

---------

Co-authored-by: jonschz <jonschz@users.noreply.github.com>
2024-06-16 08:50:32 -04:00
..
lego_util Fix Ghidra import script re-importing unchanged functions (#1035) 2024-06-16 08:50:32 -04:00
import_functions_and_types_from_pdb.py Support stubs in function import (#1034) 2024-06-16 07:13:19 -04:00
README.md Add Ghidra function import script (#909) 2024-06-09 08:41:24 -04:00

Ghidra Scripts

The scripts in this directory provide additional functionality in Ghidra, e.g. imports of symbols and types from the PDB debug symbol file.

Setup

Ghidrathon

Since these scripts and its dependencies are written in Python 3, Ghidrathon must be installed first. Follow the instructions and install a recent build (these scripts were tested with Python 3.12 and Ghidrathon v4.0.0).

Script Directory

  • In Ghidra, Open Window -> Script Manager.
  • Click the Manage Script Directories button on the top right.
  • Click the Add (Plus icon) button and select this file's parent directory.
  • Close the window and click the Refresh button.
  • This script should now be available under the folder LEGO1.

Virtual environment

As of now, there must be a Python virtual environment set up under $REPOSITORY_ROOT/.venv, and the dependencies of isledecomp must be installed there, see here.

Development

  • Type hints for Ghidra (optional): Download a recent release from https://github.com/VDOO-Connected-Trust/ghidra-pyi-generator, unpack it somewhere, and pip install that directory in this virtual environment. This provides types and headers for Python. Be aware that some of these files contain errors - in particular, from typing import overload seems to be missing everywhere, leading to spurious type errors.
  • Note that the imported modules persist across multiple runs of the script (see here). If you indend to modify an imported library, you have to use import importlib; importlib.reload(${library}) or restart Ghidra for your changes to have any effect. Unfortunately, even that is not perfectly reliable, so you may still have to restart Ghidra for some changes in isledecomp to be applied.