{"record":{"id":"b808bfe423005bf6","repo":"NationalSecurityAgency/ghidra","slug":"usage-ghidra-trace-get-obj-path","errorCode":null,"errorMessage":"Usage: ghidra trace get-obj PATH","messagePattern":"Usage: ghidra trace get-obj PATH","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/commands.py","lineNumber":1310,"sourceCode":"    trace, tx = STATE.require_tx()\n    trace.proxy_object_path(path).retain_values(keys, kinds=options.kinds)\n\n\n@convert_errors\ndef ghidra_trace_get_obj(debugger: lldb.SBDebugger, command: str,\n                         result: lldb.SBCommandReturnObject,\n                         internal_dict: Dict[str, Any]) -> None:\n    \"\"\"Get an object descriptor by its canonical path.\n\n    Usage: ghidra trace get-obj PATH\n\n    This isn't the most informative, but it will at least confirm whether an\n    object exists and provide its id.\n    \"\"\"\n\n    args = shlex.split(command)\n    if len(args) != 1:\n        raise RuntimeError(\"Usage: ghidra trace get-obj PATH\")\n    path = args[0]\n\n    trace = STATE.require_trace()\n    object = trace.get_object(path)\n    result.PutCString(f\"{object.id}\\t{object.path}\")\n\n\n@convert_errors\ndef ghidra_trace_get_values(debugger: lldb.SBDebugger, command: str,\n                            result: lldb.SBCommandReturnObject,\n                            internal_dict: Dict[str, Any]) -> None:\n    \"\"\"List all values matching a given path pattern.\n\n    Usage: ghidra trace get-values PATTERN\n\n    PATTERN is a path where blanks indicate wild cards. Beware, this may seem a\n    little odd, esp., when the final key is a wild card. Here are some examples:\n","sourceCodeStart":1292,"sourceCodeEnd":1328,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/commands.py#L1292-L1328","documentation":"Usage error raised by ghidra_trace_get_obj when the token count is not exactly 1. get_obj looks up a single object descriptor by canonical PATH and prints its id and path; it confirms existence of one object.","triggerScenarios":"Zero tokens; multi-token unquoted path; passing a wildcard pattern (use get-values for patterns); passing flags.","commonSituations":"User passes a pattern like Processes[] expecting wildcard matching (get_obj does not pattern-match); user forgets to quote a bracketed path.","solutions":["Pass exactly one canonical PATH token (no wildcards).","Quote the command so PATH stays one token.","For wildcard/pattern queries, use 'ghidra trace get-values PATTERN' instead."],"exampleFix":"// before\nghidra trace get-obj Processes[]\n// after\nghidra trace get-obj Processes[0]","handlingStrategy":"validation","validationCode":"import shlex\n\ndef validate_get_obj(command: str) -> None:\n    if len(shlex.split(command)) != 1:\n        raise ValueError('get-obj needs exactly one PATH token (no wildcards)')","typeGuard":"def is_canonical_path(tok: str) -> bool:\n    # canonical paths use explicit indices, not blanks/wildcards\n    return '[' in tok and '[]' not in tok","tryCatchPattern":"try:\n    ghidra_trace_get_obj(debugger, command, result, internal_dict)\nexcept RuntimeError as e:\n    if str(e).startswith('Usage:'):\n        result.SetError(str(e))\n    else:\n        raise","preventionTips":["Pass one canonical PATH with explicit indices.","Use get-values for wildcard patterns.","Quote bracketed paths."],"tags":["ghidra-trace","argument-validation","object-tree","cli-usage"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}