Created
August 5, 2022 20:41
-
-
Save psifertex/cda157f7d5eb3caa233b16dddd30f6ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Untested, but could be used to generate a script to annotate a binary for GDB | |
# Run this script inside of the snippet editor to create a shell script | |
output = "#!/bin/bash\n" | |
for sym in bv.get_symbols(): | |
flags = ",global" | |
if sym.type == SymbolType.FunctionSymbol: | |
flags += ",function" | |
output += f"objcopy input --add-symbol {sym.name}=.text:{hex(sym.address)}{flags} output; mv output input;\n" | |
outputfile = get_save_filename_input("script command") | |
if outputfile: | |
with open(outputfile, "w", encoding="utf-8") as f: | |
f.write(output) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment