Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed compatibility for ghidrathon and jython #65

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions GhidraPython/goresym_rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def _entry_addr_estimator(hints):

func = max(candidates, key=lambda f: len(f["FullName"]))

fm = currentProgram().getFunctionManager()
fm = getCurrentProgram().getFunctionManager()
for f in fm.getFunctions(True):
if f.getName() == "entry":
return f.getEntryPoint().getOffset()-func["Start"]
Expand All @@ -63,7 +63,7 @@ def _entry_addr_estimator(hints):

def _pclntab_estimator(hints):
# Expected pclntab name per exec format
exec_fmt = currentProgram().getMetadata()["Executable Format"]
exec_fmt = getCurrentProgram().getMetadata()["Executable Format"]
pclntabs = []
block_name = ".text"
if exec_fmt == "Executable and Linking Format (ELF)":
Expand All @@ -85,11 +85,11 @@ def _pclntab_estimator(hints):

# Check if pclntab is present
for p in pclntabs:
pclntab = currentProgram().getMemory().getBlock(p)
pclntab = getCurrentProgram().getMemory().getBlock(p)
if pclntab is not None:
# With pclntab, offset should be a matter of TabMeta VA
tmva = hints["TabMeta"]["VA"]
text = currentProgram().getMemory().getBlock(block_name)
text = getCurrentProgram().getMemory().getBlock(block_name)
return text.getStart().getOffset()-tmva

return None
Expand All @@ -101,7 +101,7 @@ def _func_map_estimator(hints):
grs_funcs = {f["FullName"]: f for f in hfuncs}

# Match function lists and collect possible offsets
fm = currentProgram().getFunctionManager()
fm = getCurrentProgram().getFunctionManager()
for f in fm.getFunctions(True):
name = f.getName()
if "FUN_" in name or name == "entry":
Expand Down Expand Up @@ -140,7 +140,7 @@ def rename_funcs(items, offset, simulate=False):
if not iterable(items):
return 0, 0

fm = currentProgram().getFunctionManager()
fm = getCurrentProgram().getFunctionManager()
rename_counter, create_counter = 0, 0
for func in items:
try:
Expand Down
Loading