File tree Expand file tree Collapse file tree 2 files changed +7
-13
lines changed
contrib/plugins/bap-tracing Expand file tree Collapse file tree 2 files changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -65,8 +65,8 @@ the BAP-frames repository.
65
65
| ... | ... | ... | |
66
66
| T-0x10 | uint64_t | sizeof(frame_n-1) | |
67
67
| T-0x8 | type(frame_n-1) | frame_n-1 | |
68
- | T+0 | uint64_t | m = number of TOC entries | TOC index begin |
68
+ | T+0 | uint64_t | m = number of frames per TOC entry | TOC index begin |
69
69
| T+0x8 | uint64_t | offset toc_entry(0) | |
70
70
| T+0x10 | uint64_t | offset toc_entry(1) | |
71
71
| ... | ... | ... | |
72
- | T+0x8+(0x8* m) | uint64_t | offset toc_entry(m-1 ) | |
72
+ | T+0x8+(0x8* ceil(n/m)) | uint64_t | offset toc_entry(ceil(n/m) ) | |
Original file line number Diff line number Diff line change @@ -221,17 +221,11 @@ static void plugin_exit(qemu_plugin_id_t id, void *udata) {
221
221
222
222
// Write the TOC index
223
223
SEEK (toc_index_offset );
224
- uint64_t m = state .toc_entries_offsets -> len ;
225
- WRITE (m );
226
-
227
- for (size_t i = 0 ; i < m - 1 ; ++ i ) {
228
- // All except the last address in state.toc_entries_offsets
229
- // point to an entry. The last one points to nothing, because
230
- // we first push the offset and then push the frames later
231
- // when the buffer is full.
232
- // When we dumped the last frames above it lastly
233
- // pushed an additional offset.
234
- // This one we skip here with m - 1.
224
+ WRITE (frames_per_toc_entry );
225
+ size_t add = state .total_num_frames % frames_per_toc_entry != 0 ? 1 : 0 ;
226
+ size_t entries = ((state .total_num_frames ) / frames_per_toc_entry ) + add ;
227
+
228
+ for (size_t i = 0 ; i < entries ; ++ i ) {
235
229
uint64_t toc_entry_off =
236
230
g_array_index (state .toc_entries_offsets , uint64_t , i );
237
231
WRITE (toc_entry_off );
You can’t perform that action at this time.
0 commit comments