dynamorio icon indicating copy to clipboard operation
dynamorio copied to clipboard

i#6751 trace_entry_t: pretty printer

Open edeiana opened this issue 1 year ago • 0 comments

A sequence of trace_entry_t records is what we use for on-disk representation of traces. To keep traces compact, the fields in the trace_entry_t struct are overloaded (i.e., they mean different things depending on the value of other fields in the struct).

We disambiguate this overloading with this "record_view" tool, which pretty prints trace_entry_t records, explicitly stating the meaning of each field for a specific trace_entry_t. The tool pretty prints one trace_entry_t record per line to std::cerr.

It can be invoked with: drrun -t drmemtrace -tool internal_record_view -infile path/to/trace.zip. Note that -sim_refs/-skip_refs NUMBER to print/skip the first NUMBER of trace_entry_t records is supported (useful for large traces).

To test the correctness of the printed values we compare them with the raw data using: zcat path/to/trace.zip | od -A x -t x2 -w12 | awk '{printf "%s | %s %s %s%s%s%s\n", $1, $2, $3, $7, $6, $5, $4}' as described here: https://dynamorio.org/page_debug_memtrace.html#autotoc_md136.

TODO: add unit tests (+ improve printing of marker values? + improve output formatting/spacing?).

Issue: #6751

edeiana avatar Apr 11 '24 01:04 edeiana