Merge remote-tracking branch 'origin/Ghidra_11.1'

This commit is contained in:
Ryan Kurtz 2024-05-24 12:54:10 -04:00
commit 36d24a12d2
5 changed files with 31 additions and 6 deletions

View File

@ -57,7 +57,7 @@ def get_arch():
try:
type = util.dbg.get_actual_processor_type()
except Exception:
print("Error getting actual processor type.")
#print("Error getting actual processor type.")
return "Unknown"
if type is None:
return "x86_64"

View File

@ -257,7 +257,6 @@ def ghidra_trace_create(command=None, initial_break=True, timeout=DbgEng.WAIT_IN
dbg._client.CreateProcess(command, DbgEng.DEBUG_PROCESS)
if initial_break:
dbg._control.AddEngineOptions(DbgEng.DEBUG_ENGINITIAL_BREAK)
dbg.wait(timeout)
if start_trace:
ghidra_trace_start(command)

View File

@ -201,7 +201,7 @@ def on_debuggee_changed(*args):
@log_errors
def on_session_status_changed(*args):
print("ON_STATUS_CHANGED: args={}".format(args))
# print("ON_STATUS_CHANGED: args={}".format(args))
trace = commands.STATE.trace
if trace is None:
return

View File

@ -455,7 +455,8 @@ def selected_process():
return dbg._base._systems.GetCurrentProcessSystemId()
return dbg._base._systems.GetCurrentProcessId()
except exception.E_UNEXPECTED_Error:
return None
# NB: we're intentionally returning 0 instead of None
return 0
@dbg.eng_thread

View File

@ -858,7 +858,7 @@ def ghidra_trace_putreg(debugger, command, result, internal_dict):
bank = regs.GetFirstValueByName(group)
putreg(frame, bank)
return
for i in range(0, regs.GetSize()):
bank = regs.GetValueAtIndex(i)
putreg(frame, bank)
@ -1637,7 +1637,32 @@ def ghidra_trace_put_environment(debugger, command, result, internal_dict):
put_environment()
def should_update_regions():
'''
It's possible some targets don't support regions.
There is also a bug in LLDB that can cause its gdb-remote client
to drop support. We need to account for this second case while
still ensuring we populate the full range for targets that
genuinely don't support it.
'''
# somewhat crappy heuristic to distinguish remote from local
tgt = util.get_target()
if tgt.GetNumModules() == 0:
# Target genuinely doesn't support regions.
# Will update with full_mem
return True
# Target does support it, but bug might be in play
# probe address 0. Should get the invalid region
proc = util.get_process()
info = lldb.SBMemoryRegionInfo()
result = proc.GetMemoryRegionInfo(0, info)
return result.Success()
def put_regions():
if not should_update_regions():
return
proc = util.get_process()
try:
regions = util.REGION_INFO_READER.get_regions()
@ -1975,7 +2000,7 @@ def ghidra_trace_sync_synth_stopped(debugger, command, result, internal_dict):
"""
hooks.on_stop(None) # Pass a fake event
@convert_errors
def ghidra_util_wait_stopped(debugger, command, result, internal_dict):