DynamoRIO
|
This page contains tips for troubleshooting issues when using the DrCacheSim tool's offline memory address traces.
Thread Interleaving Granularity
Each thread has a 32K buffer and when it fills up, or when a system call is about to be executed, the buffer is written out to a per-thread file with a header attached which has a timestamp and cpu identifier. Thus the thread interleaving and cpu scheduling can be reconstructed with a granularity of these buffers.
Viewing binary trace files
Viewing raw, pre-processed files
Each offline_entry_t struct is 8 bytes, so it's easy to view the records as 8-byte entries:
Of course, if the raw file is compressed, it must first be uncompressed. Use unlz4
for lz4-compressed raw files.
Cheat sheet:
- c040000000000004 is a header (offline version 4; type 0x40==OFFLINE_FILE_TYPE_ARCH_X86_64)
- c100000000000000 is a footer
- 8* is a timestamp
- 6* is a pid
- 4* is a tid
- 2* are PC entries
- a* is an arm iflush
- c2* is a marker
- c203* is a cpu id
- c20a* is the cache line size
- c212* is the page size
- c200* is kernel event; c201* is kernel xfer
Viewing post-processed files
trace_entry_t is 12 bytes and is turned into memref_t by reader_t and its subclasses. To view the 12-byte entries I use od
or hexdump
to split into 6 2-byte entries and then combine the final 4 into an 8-byte little-endian field using awk
:
The printed columns are "offset | type size addr". Type cheat sheet (from trace_type_t enum):
- 0x19 header
- 0x16 thread
- 0x18 pid
- 0x1c marker: 2=timestamp; 3=cpuid; 0xc=version; 9=filetype
- 0x0a instr (non-cti)
- 0x0e direct call
- 0x00 load
- 0x01 store
- 0x1d non-fetched instr
- 0x1a footer
- 0x2f instr encoding
type_is_instr: 0xa-0x10 + 0x1e
For .zip files, the data is split into the component files within the archive, in order. Each component repeats enough information (the final timestamp + cpu from the prior chunk, instruction encodings, etc.) to avoid having to examing prior chunks. Extract each component file in turn to view the data. For example:
Viewing instruction disassembly
You can use the view
analysis tool with skip_refs
and sim_refs
parameters to select a window, or for small traces you can re-post-process with drraw2trace
with high verbosity (-verbose 4
is good).