$ xref variant
On this page
Jump-table arms of the function containing an address for enum variant indices, with the texts they name.
Resolves relative jump tables into variant arm ranges, string literals per arm, reverse instruction-to-arm ownership, and constant error returns.
Usage
xref variant <ADDR> <INDICES>...
Arguments and options
Arguments
<ADDR><INDICES>...Examples
All examples were recorded on public binaries; see Provenance.
Variant 0xc7fc0 2
Jump-table arms for variant index 2 inside 0xc7fc0 and the string literals referenced in each arm.
$ xref -b xref.stripped variant 0xc7fc0 2
table 0xc030 variant 2 (0x2) arm 0xc80b0..0xc80f0
table 0xc080 variant 2 (0x2) arm 0xcbf99..0xcc060
table 0xc06c variant 2 (0x2) arm 0xce1f1..0xd0a9d "goto L_" "if (" "goto L_" "if (" "if (" "goto L_" "if (" "L_" "goto L_" "goto L_" "L_" "start of range should be a character boundaryInvalid ELF section" "123456789dqwz" "while (" "} while (" " " " " "} while (" "start of range should be a character boundaryInvalid ELF section" "start of range should be a character boundaryInvalid ELF section"
table 0xc058 variant 2 (0x2) arm 0xcd528..0xcd52c
table 0xc044 variant 2 (0x2) arm 0xcdf32..0xce1c9 "goto L_"xref: load 492.6µs, total 907.4µs
Reading the output
- One line per jump table of the function: the table, the variant index, the arm range, and the string literals the arm references (in code order).
Limits
- Strings are listed as referenced bytes from
.rodata; long previews can run into neighbouring data.
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/variant.md · generated for the site; edit the Markdown, not this page.