mirror of
https://github.com/Karmaz95/Snake_Apple.git
synced 2026-08-15 21:40:18 +02:00
Enhance trace_iokit command to utilize the current LLDB target/process if no PID or executable path is specified
This commit is contained in:
@@ -153,7 +153,15 @@ def trace_iokit(debugger, command, result, internal_dict):
|
|||||||
print(f"Attached to PID {pid}. IOKit tracer is active.")
|
print(f"Attached to PID {pid}. IOKit tracer is active.")
|
||||||
debugger.HandleCommand('continue')
|
debugger.HandleCommand('continue')
|
||||||
else: result.PutCString(f"Error: Failed to attach to PID {pid}")
|
else: result.PutCString(f"Error: Failed to attach to PID {pid}")
|
||||||
else: result.PutCString("Error: Specify --pid <PID> or --executable_path <path>")
|
else:
|
||||||
|
# Try to use the currently selected target and process
|
||||||
|
target = debugger.GetSelectedTarget()
|
||||||
|
process = target.GetProcess() if target else None
|
||||||
|
if target and process and process.IsValid() and process.GetState() in [lldb.eStateStopped, lldb.eStateRunning]:
|
||||||
|
setup_breakpoints(target)
|
||||||
|
print("Using current LLDB target/process. IOKit tracer is active.")
|
||||||
|
else:
|
||||||
|
result.PutCString("Error: Specify --pid <PID> or --executable_path <path>, or attach to a process first.")
|
||||||
|
|
||||||
def __lldb_init_module(debugger, internal_dict):
|
def __lldb_init_module(debugger, internal_dict):
|
||||||
"""Registers the 'trace_iokit' command with LLDB."""
|
"""Registers the 'trace_iokit' command with LLDB."""
|
||||||
|
|||||||
Reference in New Issue
Block a user