{"record":{"id":"91d2e53f19f51310","repo":"NationalSecurityAgency/ghidra","slug":"usage-ghidra-trace-put-threads","errorCode":null,"errorMessage":"Usage: ghidra trace put-threads","messagePattern":"Usage: ghidra trace put-threads","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/commands.py","lineNumber":1890,"sourceCode":"            procnum=proc.GetProcessID(), tnum=t.GetThreadID())\n        tobj = trace.proxy_object_path(tpath)\n    else:\n        tobj = None\n    trace.proxy_object_path('').set_value('_event_thread', tobj)\n\n\n@convert_errors\ndef ghidra_trace_put_threads(debugger: lldb.SBDebugger, command: str,\n                             result: lldb.SBCommandReturnObject,\n                             internal_dict: Dict[str, Any]) -> None:\n    \"\"\"Put the current process's threads into the Ghidra trace.\n\n    Usage: ghidra trace put-threads\n    \"\"\"\n\n    args = shlex.split(command)\n    if len(args) != 0:\n        raise RuntimeError(\"Usage: ghidra trace put-threads\")\n\n    trace, tx = STATE.require_tx()\n    with trace.client.batch() as b:\n        put_threads()\n\n\ndef put_frames() -> None:\n    proc = util.get_process()\n    trace = STATE.require_trace()\n    mapper = trace.extra.require_mm()\n    t = util.selected_thread()\n    if t is None:\n        return\n    keys = []\n    for i in range(0, t.GetNumFrames()):\n        f = t.GetFrameAtIndex(i)\n        fpath = FRAME_PATTERN.format(\n            procnum=proc.GetProcessID(), tnum=t.GetThreadID(), level=f.GetFrameID())","sourceCodeStart":1872,"sourceCodeEnd":1908,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/commands.py#L1872-L1908","documentation":"Raised by ghidra_trace_put_threads when any argument is given. put_threads publishes the current process's threads into the trace; the command is parameterless (commands.py:1890).","triggerScenarios":"Passing a thread id or index, e.g. `ghidra trace put-threads 2`, or trailing text after the command.","commonSituations":"Users assume a thread selector like LLDB's `thread list`; the agent publishes all threads for the current process.","solutions":["Invoke bare: `ghidra trace put-threads`.","To focus a thread, select it in LLDB (thread select) then use put-frames; put-threads itself takes no selector."],"exampleFix":"// before\nghidra trace put-threads 2\n// after\nghidra trace put-threads","handlingStrategy":"validation","validationCode":"assert len(command.split()) == 0, \"put-threads takes no arguments\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["put-threads publishes all threads of the current process.","Use 'thread select' in LLDB to change selection, not an arg here."],"tags":["lldb","ghidra","cli-usage","debugger-agent","threads"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}