@@ -22,6 +22,11 @@ namespace stf {
22
22
vlen_config_ = STFRecord::make<VLenConfigRecord>(vlen);
23
23
}
24
24
25
+ // cppcheck-suppress unusedFunction
26
+ void STFWriter::setHeaderProcessID (uint32_t hw_thread_id, uint32_t pid, uint32_t tid) {
27
+ initial_process_id_ = STFRecord::make<ProcessIDExtRecord>(hw_thread_id, pid, tid);
28
+ }
29
+
25
30
void STFWriter::flushHeader () {
26
31
stf_assert (!header_finalized_, " Cannot write anything else to the header after it has been finalized" );
27
32
@@ -69,6 +74,12 @@ namespace stf {
69
74
trace_features_written_ = true ;
70
75
}
71
76
77
+ // Initial process ID is optional
78
+ if (!initial_process_id_written_ && initial_process_id_) {
79
+ *this << *initial_process_id_;
80
+ initial_process_id_written_ = true ;
81
+ }
82
+
72
83
if (!initial_pc_written_ && initial_pc_) {
73
84
stf_assert (isa_written_, " ISA record must come before FORCE_PC record" );
74
85
stf_assert (initial_iem_written_, " IEM record must come before FORCE_PC record" );
@@ -156,6 +167,7 @@ namespace stf {
156
167
((wrote_page_table_walk_ || wrote_reg_) && desc == descriptors::internal::Descriptor::STF_INST_PC_TARGET) ||
157
168
(wrote_page_table_walk_ && desc == descriptors::internal::Descriptor::STF_INST_REG) ||
158
169
(desc == descriptors::internal::Descriptor::STF_COMMENT) ||
170
+ (desc == descriptors::internal::Descriptor::STF_PROCESS_ID_EXT) ||
159
171
(desc == descriptors::internal::Descriptor::STF_FORCE_PC),
160
172
" Attempted out of order write. " << desc << " should come before " << last_desc_);
161
173
switch (desc) {
@@ -169,10 +181,10 @@ namespace stf {
169
181
case descriptors::internal::Descriptor::STF_ISA:
170
182
case descriptors::internal::Descriptor::STF_TRACE_INFO:
171
183
case descriptors::internal::Descriptor::STF_TRACE_INFO_FEATURE:
172
- case descriptors::internal::Descriptor::STF_PROCESS_ID_EXT:
173
184
case descriptors::internal::Descriptor::STF_VLEN_CONFIG:
174
185
case descriptors::internal::Descriptor::STF_END_HEADER:
175
186
stf_assert (!headerFinalized (), " Attempted to write " << desc << " record outside of the header" ); // FALLTHRU
187
+ case descriptors::internal::Descriptor::STF_PROCESS_ID_EXT:
176
188
case descriptors::internal::Descriptor::STF_INST_IEM:
177
189
case descriptors::internal::Descriptor::STF_FORCE_PC:
178
190
stf_assert (headerStarted (), " Attempted to write " << desc << " before the header has started" );
0 commit comments