{"record":{"id":"7199fb03a50e978a","repo":"NationalSecurityAgency/ghidra","slug":"usage-ghidra-trace-install-hooks","errorCode":null,"errorMessage":"Usage: ghidra trace install-hooks","messagePattern":"Usage: ghidra trace install-hooks","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/commands.py","lineNumber":1983,"sourceCode":"        put_threads()\n        put_frames()\n        put_breakpoints()\n        put_watchpoints()\n        put_available()\n\n\n@convert_errors\ndef ghidra_trace_install_hooks(debugger: lldb.SBDebugger, command: str,\n                               result: lldb.SBCommandReturnObject,\n                               internal_dict: Dict[str, Any]) -> None:\n    \"\"\"Install hooks to trace in Ghidra.\n\n    Usage: ghidra trace install-hooks\n    \"\"\"\n\n    args = shlex.split(command)\n    if len(args) != 0:\n        raise RuntimeError(\"Usage: ghidra trace install-hooks\")\n\n    hooks.install_hooks()\n\n\n@convert_errors\ndef ghidra_trace_remove_hooks(debugger: lldb.SBDebugger, command: str,\n                              result: lldb.SBCommandReturnObject,\n                              internal_dict: Dict[str, Any]) -> None:\n    \"\"\"Remove hooks to trace in Ghidra.\n\n    Usage: ghidra trace remove-hooks\n\n    Using this directly is not recommended, unless it seems the hooks are\n    preventing lldb or other extensions from operating. Removing hooks will break\n    trace synchronization until they are replaced.\n    \"\"\"\n\n    args = shlex.split(command)","sourceCodeStart":1965,"sourceCodeEnd":2001,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/commands.py#L1965-L2001","documentation":"Raised by ghidra_trace_install_hooks when any argument is given. install-hooks registers the LLDB event hooks that keep the Ghidra trace synchronized; it is parameterless (commands.py:1983). Typically you use sync-enable instead, which installs hooks automatically.","triggerScenarios":"Appending flags like `ghidra trace install-hooks force` or a process specifier, or stray text.","commonSituations":"Users try to scope hooks to a process or pass options; hooks are global. Re-installing over existing hooks is generally harmless.","solutions":["Run bare: `ghidra trace install-hooks`.","Prefer `ghidra trace sync-enable` for normal workflows — it installs hooks and enables the current process in one step."],"exampleFix":"// before\nghidra trace install-hooks force\n// after\nghidra trace install-hooks","handlingStrategy":"validation","validationCode":"assert len(command.split()) == 0, \"install-hooks takes no arguments\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Hooks are global; no per-process scoping.","Prefer sync-enable for the normal workflow."],"tags":["lldb","ghidra","cli-usage","debugger-agent","hooks"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}