NationalSecurityAgency/ghidra · error · ValueError

PDP byte order unsupported

Error message

PDP byte order unsupported

What it means

ValueError raised by get_byte_order() when the target data reports lldb.eByteOrderPDP (PDP-11 middle-endian). The Ghidra trace layer only supports big- and little-endian, so PDP-endian data cannot be faithfully serialized and is rejected outright.

Source

Thrown at Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/commands.py:1086

def to_int_list(value: lldb.SBValue) -> List[int]:
    n = value.GetNumChildren()
    return [int(value.GetChildAtIndex(i).GetValueAsUnsigned())
            for i in range(0, n)]


def to_short_list(value: lldb.SBValue) -> List[int]:
    n = value.GetNumChildren()
    return [int(value.GetChildAtIndex(i).GetValueAsUnsigned())
            for i in range(0, n)]


def get_byte_order(order: int) -> Literal['big', 'little']:
    if order == lldb.eByteOrderBig:
        return 'big'
    elif order == lldb.eByteOrderLittle:
        return 'little'
    elif order == lldb.eByteOrderPDP:
        raise ValueError("PDP byte order unsupported")
    else:
        raise ValueError(f"Unrecognized order: {order}")


def data_to_int(data: lldb.SBData) -> int:
    order = get_byte_order(data.byte_order)
    return int.from_bytes(data.uint8s, order)


def data_to_reg_bytes(data: lldb.SBData) -> bytes:
    order = get_byte_order(data.byte_order)
    if order == 'little':
        return bytes(reversed(data.uint8s))
    return bytes(data.uint8s)


def eval_value(expr: str, schema: Optional[sch.Schema] = None) -> Tuple[Union[
        bool, int, float, bytes, Tuple[str, Address], List[bool], List[int],

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Use a target that reports big- or little-endian byte order.
  2. If controlling an emulator, configure it to expose a supported endianness.
  3. Patch get_byte_order to synthesize a best-effort ordering only if you can tolerate incorrect byte layout (not recommended).
Defensive patterns

Strategy: validation

Validate before calling

import lldb

def supports_byte_order(data: 'lldb.SBData') -> bool:
    return data.byte_order in (lldb.eByteOrderBig, lldb.eByteOrderLittle)

Type guard

def is_supported_order(order: int) -> bool:
    import lldb
    return order in (lldb.eByteOrderBig, lldb.eByteOrderLittle)

Try / catch

try:
    order = get_byte_order(data.byte_order)
except ValueError:
    # skip recording this value; target endianness unsupported
    return None

Prevention

When it happens

Trigger: Inspecting/recording memory or register values on a target whose SBData.byte_order equals eByteOrderPDP. This typically only appears on legacy PDP-11 or certain emulated middle-endian cores.

Common situations: Connecting LLDB to a niche/emulated target that advertises PDP byte order; misconfigured emulator exposing PDP endianness for an otherwise little-endian guest.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/b7e4905e5edd5fa8. Report an issue: GitHub.