XRef
Documentation menu
xrefcode.com / docs / cli / layout

$ xref layout

On this page
  1. Usage
  2. Arguments and options
  3. Examples
  4. --reg rdi
  5. --reg rdi --callees
  6. --reg rsi
  7. --reg rdi
  8. Reading the output
  9. Limits
  10. Provenance

Reconstructed struct field layout accessed via an argument register (and optionally callees receiving it).

Usage

xref layout [OPTIONS] <ADDR>

Arguments and options

Arguments

<ADDR>
Function address or symbol name.

Options

--reg <REG>
Parameter or general-purpose register holding the struct pointer.
default rdi
--callees
Follow direct/slot calls one hop where the struct pointer is forwarded.

Examples

All examples were recorded on public binaries; see Provenance.

--reg rdi

Command
$ xref -b xref.stripped layout 0xc7d60 --reg rdi
Output
layout of rdi in 0xc7d60..0xc7fbf:
  +0       size  8  u64   r:0  w:1
  +8       size  8  u64   r:0  w:1
  +10      size  8  u64   r:0  w:1
3 fields (min span 0x18)
other pointer args: rsi (1 fields)  (use --reg <REG>)
stderr
xref: load 458.9µs, total 1.5ms

--reg rdi --callees

Command
$ xref -b xref.stripped layout 0xc7d60 --reg rdi --callees
Output
layout of rdi in 0xc7d60..0xc7fbf:
  +0       size  8  u64   r:0  w:1
  +8       size  8  u64   r:0  w:1
  +10      size  8  u64   r:0  w:1
3 fields (min span 0x18)
other pointer args: rsi (1 fields)  (use --reg <REG>)
stderr
xref: load 605.6µs, total 1.7ms

--reg rsi

Command
$ xref -b xref.stripped layout 0xc7d60 --reg rsi
Output
layout of rsi in 0xc7d60..0xc7fbf:
  +18      size  0  &sub  r:0  w:0   lea:1
1 fields (min span 0x19)
other pointer args: rdi (3 fields)  (use --reg <REG>)
stderr
xref: load 471.6µs, total 1.5ms

--reg rdi

Command
$ xref -b xref.stripped layout 0x9a8a0 --reg rdi
Output
layout of rdi in 0x9a8a0..0x9a97a:
  +0       size  8  u64   r:1  w:0   stride=0x8
  +8       size  8  u64   r:1  w:0
  +10      size  8  u64   r:1  w:0
  +18      size  8  u64   r:1  w:0
4 fields (min span 0x20)
stderr
xref: load 478.3µs, total 1.6ms

Reading the output

Limits

Provenance

Recorded with a development build of xref after 0.4.0 on Linux x86-64, on xref.stripped = a stripped xref build (the binary of the home-page examples). Output is unchanged except that whitespace at the end of each line and empty lines at the end of the output are removed; long outputs are cut where marked.

Source: docs/cli/layout.md · generated for the site; edit the Markdown, not this page.