-
Notifications
You must be signed in to change notification settings - Fork 22
Patching and Updating
TODO. These are rough notes for now.
In Ghidra repo directory with updated repo
new_sha=abcdef123
git checkout ${new_sha}
git checkout -b rebasing
# Go through patches from this repo `HEAD` directory one at a time until getting to
# automated patches. Fix any conflicts.
git am -3 <normal patches>
# Automated patches should still try to apply but we will reset everything.
# Trying to apply makes it easier to keep commit info like author and message
git am -3 <automated_patch>
git restore --staged .
git restore .
# Now we run the tool on a fresh set of files
<tool>
git add <changed files>
# Commit with same message
git am --continue
# Continue applying manual patches as before, and fix any conflicts.
git am -3 <normal patches>
# Rewrite patches
git format-patch -o <path_to>/sleigh/src/patches/HEAD ${new_sha}..HEADAlso see https://github.com/lifting-bits/sleigh/pull/167 for some explanation, particularly this comment https://github.com/lifting-bits/sleigh/pull/167#issuecomment-1479765517
git log --no-merges <old>..<new> -- Ghidra/Features/Decompiler/src/decompile Ghidra/Processors ":(exclude)*.java"
where old is the older commit and new is the newer commit. We also skip merge commits (--no-merges) because they can be noisy. We also limit git to only look at the paths that affect the decompiler (paths after --). We also ignore commits that only touch Java files.
Sometimes cron updates pile up while fixing issues. To run the updater script manually, clone the Ghidra repo somewhere (we'll use src/ghidra in this example), and checkout the new Ghidra commit you would like to compare the current CMake Ghidra HEAD commit and run the script:
python3 ./scripts/update_ghidra_head.py --ghidra-repo ./src/ghidraYou will be able to see all the modified files, and the script will update the CMake files as necessary, like it does in CI. You will need to create the PR yourself though.