[Lldb-commits] [PATCH] D88769: [trace] Scaffold "thread trace dump instructions"

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 9 01:55:23 PDT 2020


labath added a comment.

I was waiting for the dependant patch to take shape. This looks ok to me -- just one small design question.



================
Comment at: lldb/include/lldb/Target/Target.h:1120
+  ///   The trace object. It might be undefined.
+  lldb::TraceSP &GetTrace();
+
----------------
`const TraceSP &` ?


================
Comment at: lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp:61
+                                     const std::vector<TargetSP> &targets) {
+  TraceSP trace_instance(new TraceIntelPT(pt_cpu, targets));
+  for (const TargetSP &target_sp : targets)
----------------
auto trace_instance = std::make_shared<TraceIntelPT>(...)


================
Comment at: lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp:63
+  for (const TargetSP &target_sp : targets)
+    target_sp->SetTrace(trace_instance->shared_from_this());
+
----------------
`SetTrace(trace_instance)`


================
Comment at: lldb/source/Target/Thread.cpp:1617-1627
+void Thread::DumpTraceInstructions(Stream &s, size_t count,
+                                   size_t start_position) const {
+  if (!GetProcess()->GetTarget().GetTrace()) {
+    s << "error: no trace in this target\n";
+    return;
+  }
+  s.Printf("thread #%u: tid = %" PRIu64 ", total instructions = 1000\n",
----------------
Given the intended design of having one process (and thread) class serve multiple trace types, can this function do anything useful besides calling into the Trace object to perform trace-specific dumping ?

And if it cannot, couldn't we just skip it have have callers call the relevant Trace method directly?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88769



More information about the lldb-commits mailing list