[Lldb-commits] [PATCH] D128543: [trace] Improve the TraceCursor iteration API

Jakob Johnson via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 28 04:52:19 PDT 2022


jj10306 accepted this revision.
jj10306 added a comment.
This revision is now accepted and ready to land.

lgtm, thanks for making the cursor traversal much cleaner



================
Comment at: lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp:228-231
-  // We insert a fake error signaling an empty trace if needed becasue the
-  // TraceCursor requires non-empty traces.
-  if (m_instruction_ips.empty())
-    AppendError(createStringError(inconvertibleErrorCode(), "empty trace"));
----------------
nice, the new approach is much cleaner


================
Comment at: lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp:38
+void TraceCursorIntelPT::Next() {
+  m_pos += IsForwards() ? 1 : -1;
 
----------------
should only do this increment or decrement if `HasValue()` is true? otherwise (in theory) this value could wrap around if it's incremented/decremented too many times?


================
Comment at: lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp:40
 
+  {
+    // We try to go to a neighbor tsc range that might contain the current pos
----------------
why is this new scope introduced here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128543



More information about the lldb-commits mailing list