mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-22 01:21:59 +08:00
GP-6331: oops
GP-6331: lose the param GP-6331: better GP-6331: fields GP-6331: version
This commit is contained in:
@@ -1065,14 +1065,9 @@ def ghidra_trace_put_inferiors(*, is_mi: bool, **kwargs) -> None:
|
||||
put_inferiors()
|
||||
|
||||
|
||||
def put_available(availables: Optional[List[util.Available]] = None) -> List[util.Available]:
|
||||
def put_available() -> List[util.Available]:
|
||||
trace = STATE.require_trace()
|
||||
inf = gdb.selected_inferior()
|
||||
if availables is None:
|
||||
try:
|
||||
availables = util.AVAILABLE_INFO_READER.get_availables()
|
||||
except Exception:
|
||||
availables = []
|
||||
availables = util.AVAILABLE_INFO_READER.get_availables()
|
||||
keys = []
|
||||
for proc in availables:
|
||||
ppath = AVAILABLE_PATTERN.format(pid=proc.pid)
|
||||
|
||||
@@ -1473,7 +1473,7 @@ def ghidra_trace_put_processes(debugger: lldb.SBDebugger, command: str,
|
||||
put_processes()
|
||||
|
||||
|
||||
def put_available(availables: Optional[List[util.Available]] = None) -> List[util.Available]:
|
||||
def put_available() -> List[util.Available]:
|
||||
trace = STATE.require_trace()
|
||||
availables = util.AVAILABLE_INFO_READER.get_availables()
|
||||
keys = []
|
||||
@@ -1482,8 +1482,12 @@ def put_available(availables: Optional[List[util.Available]] = None) -> List[uti
|
||||
procobj = trace.create_object(ppath)
|
||||
keys.append(AVAILABLE_KEY_PATTERN.format(pid=proc.pid))
|
||||
procobj.set_value('PID', proc.pid)
|
||||
procobj.set_value('Name', proc.name)
|
||||
procobj.set_value('_display', f'{proc.pid} {proc.command}')
|
||||
if isinstance(proc, util.Available):
|
||||
procobj.set_value('Name', proc.name)
|
||||
procobj.set_value('_display', f'{proc.pid} {proc.command}')
|
||||
else:
|
||||
procobj.set_value('Name', proc.name())
|
||||
procobj.set_value('_display', f'{proc.pid} {proc.name()}')
|
||||
procobj.insert()
|
||||
trace.proxy_object_path(AVAILABLES_PATH).retain_values(keys)
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ def _compute_lldb_ver() -> LldbVersion:
|
||||
|
||||
|
||||
LLDB_VERSION = _compute_lldb_ver()
|
||||
if LLDB_VERSION.major < 18:
|
||||
import psutil
|
||||
|
||||
GNU_DEBUGDATA_PREFIX = ".gnu_debugdata for "
|
||||
|
||||
@@ -196,14 +198,18 @@ class AvailableInfoReader(object):
|
||||
availables = []
|
||||
platform = get_debugger().GetPlatformAtIndex(0)
|
||||
err = lldb.SBError()
|
||||
proclist = platform.GetAllProcesses(err)
|
||||
for i in range(0, proclist.GetSize()):
|
||||
info = lldb.SBProcessInfo()
|
||||
success = proclist.GetProcessInfoAtIndex(i, info)
|
||||
if success:
|
||||
a = self.available_from_sbprocinfo(info)
|
||||
availables.append(a)
|
||||
return availables
|
||||
# Quite a hack, but only needed for type annotations
|
||||
if hasattr(platform, 'GetAllProcesses'):
|
||||
proclist = platform.GetAllProcesses(err)
|
||||
for i in range(0, proclist.GetSize()):
|
||||
info = lldb.SBProcessInfo()
|
||||
success = proclist.GetProcessInfoAtIndex(i, info)
|
||||
if success:
|
||||
a = self.available_from_sbprocinfo(info)
|
||||
availables.append(a)
|
||||
return availables
|
||||
else:
|
||||
return psutil.process_iter()
|
||||
|
||||
|
||||
def _choose_available_info_reader() -> AvailableInfoReader:
|
||||
|
||||
Reference in New Issue
Block a user