@@ -21,3 +21,41 @@ cd build
2121../configure --enable-plugins --target-list=< target>
2222make
2323```
24+
25+ ## Trace format
26+
27+ The generated trace consists of three parts: the header,
28+ the frame entries and a table of content (TOC).
29+ The TOC allows for faster indexing into the logged frames.
30+
31+ Each frame entry starts with the size of the frame, followed by the actual frame data.
32+ A fixed number of frame entries are grouped together to one _ entry_ in the TOC.
33+
34+ The TOC is stored at the end.
35+
36+ For specifics about the frame contents, please refer
37+ to the [ definitions] ( https://github.com/BinaryAnalysisPlatform/bap-frames/tree/master/piqi ) in
38+ the BAP-frames repository.
39+
40+ ** Format**
41+
42+ | Offset | Type | Field | Trace section |
43+ | --------| ------| -------| ------|
44+ | 0x0 | uint64_t | magic number (7456879624156307493LL) | Header begin |
45+ | 0x8 | uint64_t | trace version number | |
46+ | 0x10 | uint64_t | frame_architecture | |
47+ | 0x18 | uint64_t | frame_machine, 0 for unspecified. | |
48+ | 0x20 | uint64_t | n = number of frames per TOC entry. | |
49+ | 0x28 | uint64_t | T = offset to TOC index. | |
50+ | 0x30 | uint64_t | sizeof(frame_0) | TOC begin |
51+ | 0x38 | meta_frame | frame_0 | |
52+ | 0x40 | uint64_t | sizeof(frame_1) | |
53+ | 0x48 | type(frame_1) | frame_1 | |
54+ | ... | ... | ... | |
55+ | T-0x10 | uint64_t | sizeof(frame_n-1) | |
56+ | T-0x8 | type(frame_n-1) | frame_n-1 | |
57+ | T+0 | uint64_t | m = number of TOC entries | TOC index begin |
58+ | T+0x8 | uint64_t | offset toc_entry(0) | |
59+ | T+0x10 | uint64_t | offset toc_entry(1) | |
60+ | ... | ... | ... | |
61+ | T+0x8+(0x8* m) | uint64_t | offset toc_entry(m-1) | |
0 commit comments