[Lldb-commits] [lldb] [lldb] Fix Intel PT plugin compile errors (PR #77252)

Nicholas Mosier via lldb-commits lldb-commits at lists.llvm.org
Mon Jan 8 07:37:33 PST 2024


================
@@ -85,6 +85,11 @@ double DecodedThread::NanosecondsRange::GetInterpolatedTime(
   return interpolate(next_range->nanos);
 }
 
+DecodedThread::TraceItemStorage::TraceItemStorage(
+    const TraceItemStorage &other) {
+  std::memcpy(this, &other, sizeof *this);
----------------
nmosier wrote:

`DecodedThread` does know which member is being used (it uses `enum TraceItemKind` to tag the union); however, it stores the tag separately in `DecodedThread::m_item_kinds` for space/alignment reasons.
I added this copy constructor for use by `std::vector<TraceItemStorage> DecodedThread::m_trace_data`; without it, it raises a compile error because it doesn't know how to copy/move `TraceItemStorage` elements when resizing the vector. This means that we can't add a second TraceItemKind argument to the copy constructor, because std::vector<TraceItemStorage> won't know how to use that.

https://github.com/llvm/llvm-project/pull/77252


More information about the lldb-commits mailing list