Skip to content

Commit

Permalink
cppexport bug fix for Ghidra 10.3.3 breaking api change, fixes #10
Browse files Browse the repository at this point in the history
  • Loading branch information
clearbluejar committed Sep 8, 2023
1 parent d220291 commit a07babb
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions ghidrecomp/decompile.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ def decompile_to_single_file(path: Path,
else:
monitor = ConsoleTaskMonitor().DUMMY

decompiler = CppExporter(create_header, create_file, emit_types, exclude_tags, tags)
try:
# Ghidra CppExporter before 10.3.3 and later
decompiler = CppExporter(None,create_header, create_file, emit_types, exclude_tags, tags)
except TypeError:
# Ghidra CppExporter before 10.3.3
decompiler = CppExporter(create_header, create_file, emit_types, exclude_tags, tags)

decompiler.export(c_file, prog, prog.getMemory(), monitor)


Expand Down Expand Up @@ -200,6 +206,9 @@ def decompile(args: Namespace):
if skip_count > 0:
print(f'Skipped {skip_count} functions that failed to match any of {args.filters}')

decompilations = []
callgraphs = []

if args.cppexport:
print(f"Decompiling {len(all_funcs)} functions using Ghidra's CppExporter")
c_file = Path(args.output_path) / Path(bin_path.name + '.c')
Expand All @@ -211,10 +220,7 @@ def decompile(args: Namespace):
print(f'Decompiling {len(all_funcs)} functions using {thread_count} threads')

decompilers = setup_decompliers(program, thread_count)

completed = 0
decompilations = []
callgraphs = []

# Decompile all files
start = time()
Expand Down

0 comments on commit a07babb

Please sign in to comment.