Skip to content

Introduce rr dump --json, dump trace in JSONL, one object per line - #4092

Open
timo wants to merge 1 commit into
rr-debugger:masterfrom
timo:rr_dump_json_format
Open

Introduce rr dump --json, dump trace in JSONL, one object per line#4092
timo wants to merge 1 commit into
rr-debugger:masterfrom
timo:rr_dump_json_format

Conversation

@timo

@timo timo commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Combines with some of the other flags:

  • --syscallbuf adds a syscalls key
  • --mmaps adds a maps key
  • --task_events adds a task_events key`
  • --recorded-metadata adds a metadata key

Furthermore, also passing --raw will add extra output to some of the above:

  • syscallbuf_flush_raw key with the header of a syscallbuf flush
  • raw key with the syscall data for each syscall
  • raw key with mmap record data to mmaps entries

On top of all that, a --no-regs flag is introduced that skips outputting
register values in the regular, the raw, or the json output.

This also moves write_hex_string from being a static function inside
GdbServerConnection to live in src/util.cc instead.

Here's some example output:

https://gist.github.com/timo/d6dd3b2762d78a9ee468b3cb554fa6b9

Open questions:

  • Currently, some functions are duplicated as a _json variant, some functions check flags.json_dump in-line. Is there a preference?
  • The current dump function ignores when frame.event().record_extra_regs() is true; do we care about that?
  • The initial thing that caused me (well, really dzaima) to look into the code in the first place was that the header of --raw still has three entries in it that correspond to field that are not being output any more. Is that for a separate pull request, or fine to include here?
  • The help for the command says that --raw outputs in a different format, and --json makes the same claim, so it's not obvious that they can be combined. The current behaviour of --raw and --json together may want to get a different flag and then --raw could conflict with --json
    • there could instead be a --format=raw/--format=json option instead? though a short flag for json would be nice

@timo
timo force-pushed the rr_dump_json_format branch from 2543682 to 9b1ee6c Compare August 14, 2026 15:30
@timo
timo marked this pull request as ready for review August 14, 2026 15:31
@timo
timo force-pushed the rr_dump_json_format branch 3 times, most recently from cf05bfc to ad998be Compare August 14, 2026 16:07
Combines with some of the other flags:
* `--syscallbuf` adds a `syscalls` key
* `--mmaps` adds a `maps` key
* `--task_events` adds a `task_events` key
* `--recorded-metadata` adds a `metadata` key

Furthermore, also passing `--raw` will add extra output to some of the above:
* `syscallbuf_flush_raw` key with the header of a syscallbuf flush
* `raw` key with the syscall data for each syscall
* `raw` key with mmap record data to mmaps entries

On top of all that, a `--no-regs` flag is introduced that skips outputting
register values in the regular, the raw, or the json output.

This also moves write_hex_string from being a static function inside
GdbServerConnection to live in src/util.cc instead.
@timo
timo force-pushed the rr_dump_json_format branch from ad998be to b458af5 Compare August 14, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant