Introduce rr dump --json, dump trace in JSONL, one object per line - #4092
Introduce rr dump --json, dump trace in JSONL, one object per line#4092timo wants to merge 1 commit into
rr dump --json, dump trace in JSONL, one object per line#4092Conversation
2543682 to
9b1ee6c
Compare
cf05bfc to
ad998be
Compare
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.
ad998be to
b458af5
Compare
rocallahan
left a comment
There was a problem hiding this comment.
I think this is basically fine as-is, just some minor comments. Sorry for the delay, I've been traveling.
| namespace rr { | ||
|
|
||
| struct JsonArrayAtKeyWriter { | ||
| public: |
There was a problem hiding this comment.
Don't need public:, it's the default for struct
|
|
||
| namespace rr { | ||
|
|
||
| struct JsonArrayAtKeyWriter { |
There was a problem hiding this comment.
Document what this struct is for and what its parts mean
| fprintf(out, " "); | ||
| for (unsigned long i = 0; i < record->size; ++i) { | ||
| fprintf(out, "%2.2x", *(record_ptr + (uintptr_t)i)); | ||
| auto record_out = std::vector<char>(); |
There was a problem hiding this comment.
make this std::string.
| bool key_written = false; | ||
| bool write_comma = false; | ||
|
|
||
| void ensure_key(FILE *out, const char *key) { |
There was a problem hiding this comment.
This is weird. Why would the caller not know if a key has been emitted yet?
|
Sorry for the delay, I was traveling.
No, I think having a mix like you have is OK.
No, at least, definitely not in this PR.
Separate PR please.
Yeah I think it doesn't really make sense to combine them and we shouldn't support that.
I'm OK with having one flag per format. |
Combines with some of the other flags:
--syscallbufadds asyscallskey--mmapsadds amapskey--task_eventsadds atask_eventskey`--recorded-metadataadds ametadatakeyFurthermore, also passing
--rawwill add extra output to some of the above:syscallbuf_flush_rawkey with the header of a syscallbuf flushrawkey with the syscall data for each syscallrawkey with mmap record data to mmaps entriesOn top of all that, a
--no-regsflag is introduced that skips outputtingregister 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:
flags.json_dumpin-line. Is there a preference?frame.event().record_extra_regs()is true; do we care about that?--rawstill 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?--rawoutputs in a different format, and--jsonmakes the same claim, so it's not obvious that they can be combined. The current behaviour of--rawand--jsontogether may want to get a different flag and then--rawcould conflict with--json--format=raw/--format=jsonoption instead? though a short flag for json would be nice