[Lldb-commits] [PATCH] D124858: [trace][intelpt] Support system-wide tracing [4] - Support per core tracing on lldb-server

Jakob Johnson via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed May 11 05:11:59 PDT 2022


jj10306 added inline comments.


================
Comment at: lldb/source/Plugins/Process/Linux/IntelPTCollector.h:152-156
+  IntelPTPerThreadProcessTraceUP m_per_thread_process_trace_up;
+  /// Cores traced due to per-core "process tracing". Only one active
+  /// "process tracing" instance is allowed for a single process.
+  /// This might be \b nullptr.
+  IntelPTMultiCoreTraceUP m_per_core_process_trace_up;
----------------
wallace wrote:
> jj10306 wrote:
> > So these are mutually exclusive tight?
> yes, I'll leave a comment about that here
this could be overkill, but potentially we could use a union here to enforce this invariant and a boolean flag/enum to determine which process tracing "handler" is being used
```
bool is_per_core_process_tracing_enabled; // used to determine how to interpret the union
union {
  IntelPTPerThreadProcessTraceUP m_per_thread_process_trace_up;
  IntelPTMultiCoreTraceUP m_per_core_process_trace_up;

};
```
imo this is much more clearly expresses the invariant of only one of the process tracing "handles" being non null at a time.
wdyt?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124858/new/

https://reviews.llvm.org/D124858



More information about the lldb-commits mailing list