From 1962ab10ef2e74443d6aa0a7af7299ffff7023a4 Mon Sep 17 00:00:00 2001 From: Karol Mazurek Date: Tue, 10 Jun 2025 18:53:50 +0200 Subject: [PATCH] Enhance trace_iokit command to utilize the current LLDB target/process if no PID or executable path is specified --- X. NU/custom/drivers/iokit_tracer.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/X. NU/custom/drivers/iokit_tracer.py b/X. NU/custom/drivers/iokit_tracer.py index fbde5de..3e684c0 100644 --- a/X. NU/custom/drivers/iokit_tracer.py +++ b/X. NU/custom/drivers/iokit_tracer.py @@ -153,7 +153,15 @@ def trace_iokit(debugger, command, result, internal_dict): print(f"Attached to PID {pid}. IOKit tracer is active.") debugger.HandleCommand('continue') else: result.PutCString(f"Error: Failed to attach to PID {pid}") - else: result.PutCString("Error: Specify --pid or --executable_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 or --executable_path , or attach to a process first.") def __lldb_init_module(debugger, internal_dict): """Registers the 'trace_iokit' command with LLDB."""