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

$ xref variant

On this page
  1. Usage
  2. Arguments and options
  3. Examples
  4. Variant 0xc7fc0 2
  5. Reading the output
  6. Limits
  7. Provenance

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>
An address inside the function.
<INDICES>...
Enum variant 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.

Command
$ xref -b xref.stripped variant 0xc7fc0 2
Output
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_"
stderr
xref: load 492.6µs, total 907.4µs

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/variant.md · generated for the site; edit the Markdown, not this page.