NationalSecurityAgency/ghidra · error · RuntimeError
Usage: ghidra trace get-values-rng ADDRESS LENGTH
Error message
Usage: ghidra trace get-values-rng ADDRESS LENGTH
What it means
Usage error raised by ghidra_trace_get_values_rng when the token count is not exactly 2. The command lists ADDRESS/RANGE values intersecting [ADDRESS, ADDRESS+LENGTH); both ADDRESS and LENGTH must be supplied.
Source
Thrown at Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/commands.py:1360
values = wait(trace.get_values(pattern))
print_tabular_values(values, result.PutCString)
@convert_errors
def ghidra_trace_get_values_rng(debugger: lldb.SBDebugger, command: str,
result: lldb.SBCommandReturnObject,
internal_dict: Dict[str, Any]) -> None:
"""List all values intersecting a given address range.
Usage: ghidra trace get-values-rng ADDRESS LENGTH
This can only retrieve values of type ADDRESS or RANGE.
NOTE: Even in batch mode, this request will block for the result.
"""
args = shlex.split(command)
if len(args) != 2:
raise RuntimeError("Usage: ghidra trace get-values-rng ADDRESS LENGTH")
address = args[0]
length = args[1]
trace = STATE.require_trace()
start, end = eval_range(address, length)
if start is None or end is None:
return
proc = util.get_process()
base, addr = trace.extra.require_mm().map(proc, start)
# Do not create the space. We're querying. No tx.
values = wait(trace.get_values_intersecting(addr.extend(end - start)))
print_tabular_values(values, result.PutCString)
def activate(path: Optional[str] = None) -> None:
trace = STATE.require_trace()
if path is None:
proc = util.get_process()View on GitHub (pinned to d5f144c24d)
Solutions
- Pass exactly two tokens: ADDRESS LENGTH.
- Use explicit numeric literals for both, since evaluation depends on LLDB expression resolution and a stopped target.
- Note this command blocks for the result even in batch mode; ensure the target is in a queryable state.
Example fix
// before ghidra trace get-values-rng 0x10000 // after ghidra trace get-values-rng 0x10000 0x40
Defensive patterns
Strategy: validation
Validate before calling
import shlex
def validate_get_values_rng(command: str) -> None:
if len(shlex.split(command)) != 2:
raise ValueError('get-values-rng needs exactly ADDRESS LENGTH') Try / catch
try:
ghidra_trace_get_values_rng(debugger, command, result, internal_dict)
except RuntimeError as e:
if str(e).startswith('Usage:'):
result.SetError(str(e))
else:
raise Prevention
- Pass exactly ADDRESS LENGTH (no PAGES).
- Use explicit numeric literals and a stopped target.
- Remember this command blocks even in batch mode.
When it happens
Trigger: Passing one token or 3+; omitting LENGTH; adding flags; quoting issues that split ADDRESS or LENGTH.
Common situations: User passes only an address expecting a default length; user adds a PAGES argument (not supported here); user copy-pastes a putmem-style 3-token command.
Related errors
- Usage: ghidra trace putmem ADDRESS LENGTH [PAGES]
- Usage: ghidra trace putval EXPRESSION [PAGES]
- Usage: ghidra trace putmem ADDRESS LENGTH STATE [PAGES]
- Usage: ghidra trace delmem ADDRESS LENGTH
- Usage: ghidra trace putreg [GROUP]
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/6b07c8d921f954de.
Report an issue: GitHub.