summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/vm/eventpipeconfiguration.cpp6
-rw-r--r--src/vm/eventpipeeventinstance.cpp9
2 files changed, 12 insertions, 3 deletions
diff --git a/src/vm/eventpipeconfiguration.cpp b/src/vm/eventpipeconfiguration.cpp
index fb264e2bc3..7ce06badff 100644
--- a/src/vm/eventpipeconfiguration.cpp
+++ b/src/vm/eventpipeconfiguration.cpp
@@ -336,7 +336,7 @@ EventPipeEventInstance* EventPipeConfiguration::BuildEventMetadataEvent(EventPip
const GUID &providerID = sourceEvent.GetProvider()->GetProviderID();
unsigned int eventID = sourceEvent.GetEventID();
unsigned int eventVersion = sourceEvent.GetEventVersion();
- unsigned int instancePayloadSize = sizeof(providerID) + sizeof(eventID) + sizeof(eventVersion) + payloadLength;
+ unsigned int instancePayloadSize = sizeof(providerID) + sizeof(eventID) + sizeof(eventVersion) + sizeof(payloadLength) + payloadLength;
// Allocate the payload.
BYTE *pInstancePayload = new BYTE[instancePayloadSize];
@@ -356,6 +356,10 @@ EventPipeEventInstance* EventPipeConfiguration::BuildEventMetadataEvent(EventPip
memcpy(currentPtr, &eventVersion, sizeof(eventVersion));
currentPtr += sizeof(eventVersion);
+ // Write the size of the metadata.
+ memcpy(currentPtr, &payloadLength, sizeof(payloadLength));
+ currentPtr += sizeof(payloadLength);
+
// Write the incoming payload data.
memcpy(currentPtr, pPayloadData, payloadLength);
diff --git a/src/vm/eventpipeeventinstance.cpp b/src/vm/eventpipeeventinstance.cpp
index dc84c04178..4527ed5b26 100644
--- a/src/vm/eventpipeeventinstance.cpp
+++ b/src/vm/eventpipeeventinstance.cpp
@@ -101,6 +101,7 @@ void EventPipeEventInstance::FastSerialize(FastSerializer *pSerializer, StreamLa
sizeof(m_threadID) + // Thread ID
sizeof(m_timeStamp) + // TimeStamp
m_dataLength + // Event payload data length
+ sizeof(unsigned int) + // Prepended stack payload size in bytes
m_stackContents.GetSize(); // Stack payload size
// Write the size of the event to the file.
@@ -121,10 +122,14 @@ void EventPipeEventInstance::FastSerialize(FastSerializer *pSerializer, StreamLa
pSerializer->WriteBuffer(m_pData, m_dataLength);
}
+ // Write the size of the stack in bytes.
+ unsigned int stackSize = m_stackContents.GetSize();
+ pSerializer->WriteBuffer((BYTE*)&stackSize, sizeof(stackSize));
+
// Write the stack if present.
- if(m_stackContents.GetSize() > 0)
+ if(stackSize > 0)
{
- pSerializer->WriteBuffer(m_stackContents.GetPointer(), m_stackContents.GetSize());
+ pSerializer->WriteBuffer(m_stackContents.GetPointer(), stackSize);
}
}