{"record":{"id":"4efe363cb1472623","repo":"NationalSecurityAgency/ghidra","slug":"usage-ghidra-trace-put-regions","errorCode":null,"errorMessage":"Usage: ghidra trace put-regions","messagePattern":"Usage: ghidra trace put-regions","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/commands.py","lineNumber":1763,"sourceCode":"        regobj.set_value('Offset', hex(r.offset))\n        regobj.set_value('Object File', r.objfile)\n        regobj.insert()\n    trace.proxy_object_path(\n        MEMORY_PATTERN.format(procnum=proc.GetProcessID())).retain_values(keys)\n\n\n@convert_errors\ndef ghidra_trace_put_regions(debugger: lldb.SBDebugger, command: str,\n                             result: lldb.SBCommandReturnObject,\n                             internal_dict: Dict[str, Any]) -> None:\n    \"\"\"Read the memory map, if applicable, and write to the trace's Regions.\n\n    Usage: ghidra trace put-regions\n    \"\"\"\n\n    args = shlex.split(command)\n    if len(args) != 0:\n        raise RuntimeError(\"Usage: ghidra trace put-regions\")\n\n    trace, tx = STATE.require_tx()\n    with trace.client.batch() as b:\n        put_regions()\n\n\ndef put_modules() -> None:\n    target = util.get_target()\n    proc = util.get_process()\n    modules = util.MODULE_INFO_READER.get_modules()\n    trace = STATE.require_trace()\n    mapper = trace.extra.require_mm()\n    mod_keys = []\n    for mk, m in modules.items():\n        mpath = MODULE_PATTERN.format(procnum=proc.GetProcessID(), modpath=mk)\n        modobj = trace.create_object(mpath)\n        mod_keys.append(MODULE_KEY_PATTERN.format(modpath=mk))\n        modobj.set_value('Name', m.name)","sourceCodeStart":1745,"sourceCodeEnd":1781,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/commands.py#L1745-L1781","documentation":"Raised by ghidra_trace_put_regions when any argument is supplied. put-regions reads the target's memory map (where supported) and writes Regions into the trace; it is parameterless (commands.py:1763). Some targets don't support regions, handled separately in should_query_regions.","triggerScenarios":"Appending a region name, address range, or filter token, e.g. `ghidra trace put-regions 0x1000`, or stray text.","commonSituations":"Users want to publish a single region or filter unmapped areas and pass a selector. The command always publishes the whole memory map for the current process.","solutions":["Invoke bare: `ghidra trace put-regions`.","If regions come back empty, check should_query_regions() / LLDB gdb-remote region bug, not command arguments."],"exampleFix":"// before\nghidra trace put-regions stack\n// after\nghidra trace put-regions","handlingStrategy":"validation","validationCode":"assert len(command.split()) == 0, \"put-regions takes no arguments\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["put-regions publishes the whole memory map — no region filter.","If regions are empty, investigate target/protocol support, not args."],"tags":["lldb","ghidra","cli-usage","debugger-agent","memory-regions"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}