[Lldb-commits] [PATCH] D103588: [trace] Create a top-level instruction class

walter erquinigo via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 10 18:32:02 PDT 2021


wallace updated this revision to Diff 351329.
wallace added a comment.
Herald added a subscriber: mgorny.

Following @vsk 's feedback, I made the following changes:

- Create a ThreadTrace class, that contains the trace for a specific thread and offers the TraverseInstructions method and other getters like GetInstructionType and GetInstructionSize. This effectively moves some code from the Trace.h class to this new class, which has a few advantanges:
  - It's easier to expose an SBAPI for instructions and its data storage with a corresponding SBThreadTrace class. Having only SBTrace is not enough for that.
  - A ThreadTrace can potentially outlive a stop id in the case of a live process, which could be useful if the user wants to compare traces or two different points in the execution of a process.
- I'm keeping the vector<IntelPTInstruction> class for now as an internal representation, but now there's more freedom to change it because the top level API in ThreadTrace makes no assumptions on the data, except that it's indexed.
- I removed some deprecated code and improved some comments.

As a side note, I was chatting with some teammates and we'll explore storing decoded intel pt traces on disk, which later lldb will mmap and use as its storage. The accessors exposed in this diff are generic enough to handle that case as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103588

Files:
  lldb/include/lldb/Target/ThreadTrace.h
  lldb/include/lldb/Target/Trace.h
  lldb/include/lldb/lldb-enumerations.h
  lldb/include/lldb/lldb-forward.h
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt
  lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp
  lldb/source/Plugins/Trace/intel-pt/DecodedThread.h
  lldb/source/Plugins/Trace/intel-pt/IntelPTDecoder.cpp
  lldb/source/Plugins/Trace/intel-pt/IntelPTDecoder.h
  lldb/source/Plugins/Trace/intel-pt/ThreadTraceIntelPT.cpp
  lldb/source/Plugins/Trace/intel-pt/ThreadTraceIntelPT.h
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
  lldb/source/Target/Trace.cpp
  lldb/test/API/commands/trace/TestTraceDumpInstructions.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103588.351329.patch
Type: text/x-patch
Size: 41889 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210611/ed9a4221/attachment-0001.bin>


More information about the lldb-commits mailing list