Skip to content

Commit 4f7db16

Browse files
authored
Dump stack trace data (#635)
2 parents 1cff6d0 + 24d71c6 commit 4f7db16

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

‎etw-reader/examples/dump.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,29 @@ fn main() {
186186
metadata_start += metadata_size as usize;
187187
}
188188
}
189+
Etw::EVENT_HEADER_EXT_TYPE_STACK_TRACE64 => {
190+
// see ProcessExtendedData in TraceLog.cs from perfview
191+
println!("extended: STACK_TRACE64");
192+
let data: &[u8] = unsafe {
193+
std::slice::from_raw_parts(
194+
i.DataPtr as *const u8,
195+
i.DataSize as usize,
196+
)
197+
};
198+
let match_id = u64::from_ne_bytes(
199+
<[u8; 8]>::try_from(&data[0..8]).unwrap(),
200+
);
201+
println!(" match_id: {}", match_id);
202+
let mut address_start = 8;
203+
while address_start < data.len() {
204+
let address = u64::from_ne_bytes(
205+
<[u8; 8]>::try_from(&data[address_start..address_start + 8])
206+
.unwrap(),
207+
);
208+
println!(" address: {:x}", address);
209+
address_start += 8;
210+
}
211+
}
189212
_ => {
190213
println!("extended: {:?}", i);
191214
}

0 commit comments

Comments
 (0)