PTAL - any and all feedback is welcome!
I found that I had to finalize the previous packet and create a new one in order to add interned data to the trace packet, but I'm open to suggestions if there's a better way.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
void EtwConsumer::HandleStackWalkEvent(const EVENT_HEADER& header,naisu
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Nice!
InterningIndex<TypeList<uintptr_t>, SizeList<1024>> interned_frames_;See my comment re. pointer_size below. This would need to be uint64_t to work in all cases.
InterningIndex<TypeList<size_t>, SizeList<1024>> interned_callstacks_;Interned data needs to reset on EtwSystemDataSource::WillClearIncrementalState, so it gets emitted again.
// Read and validate the contents of `packet_data`.
base::BufferIterator<const uint8_t> iterator{packet_data};
auto qpc_timestamp = *iterator.CopyObject<uint64_t>();
auto process_id = *iterator.CopyObject<uint32_t>();
auto thread_id = *iterator.CopyObject<uint32_t>();This is missing the typical bound check:
```
if (packet_data.size() < kMinimumSize) {
return false;
}
```
base::span<const uintptr_t> call_stack =
iterator.Span<const uintptr_t>(remaining_bytes / pointer_size);I think this incorrectly assumes "Stack" members are uintptr_t, but they are documented as pointer_size.
To correctly handle this while keeping the zero copy impl, you could do a template <class T> HandleStackWalkEventImpl() and then
```
if (pointer_size == sizeof(uint32_t)) {
HandleStackWalkEventImpl<uint32_t>(...);
) else {
HandleStackWalkEventImpl<uint64_t>(...);
}
```
packet_handle_ = trace_writer_->NewTracePacket();I think we need to unconditionally set SEQ_NEEDS_INCREMENTAL_STATE, since the packet may be reused for stackwalk after interned data was emitted in a previous packet.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |