[Lldb-commits] [PATCH] D85158: [intel-pt] Refactor 3: refactor PTDecoder into SBPTProcess

walter erquinigo via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 3 13:48:57 PDT 2020


wallace created this revision.
wallace added reviewers: clayborg, kusmour.
Herald added subscribers: lldb-commits, mgorny.
Herald added a project: LLDB.
wallace requested review of this revision.
Herald added a subscriber: JDevlieghere.

Depends on D85070 <https://reviews.llvm.org/D85070>.
I don't think PTDecoder is structured very well, and the name is also misleading,
and it doesn't just "decode". Given that the Python API generation has been
broken for a long time and that one of my recent patches fix it, I assume
there's no problem in changing the API, as there has been no users.

A first fundamental change I want to do is to stop having PTDecoder as a top
level class that receives an SBProcess for any action it needs to do. The
existing way requires  a good amount of boilerplate code here and there with
little to no benefit. 
Instead, I'm renaming it into SBPTProcess. I think the SB is consistent with the
LLDB SB API, and this class now directly manages one SBProcess. This means that
whenever you want to trace or decode an SBProcess, you create a SBPTProcess
class, which is easier to reason about in an OOP way.

I've updated the test accordingly, and I've noticed that the code is now much
simpler, with less faiture points and checks.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85158

Files:
  lldb/test/API/tools/intel-features/intel-pt/test/TestIntelPTSimpleBinary.py
  lldb/tools/intel-features/intel-pt/include/intel-pt/API/PTDecoder.h
  lldb/tools/intel-features/intel-pt/include/intel-pt/API/SBPTProcess.h
  lldb/tools/intel-features/intel-pt/include/intel-pt/API/cli-wrapper-pt.h
  lldb/tools/intel-features/intel-pt/include/intel-pt/Core/Decoder.h
  lldb/tools/intel-features/intel-pt/include/intel-pt/Core/PTProcess.h
  lldb/tools/intel-features/intel-pt/interface/PTDecoder.i
  lldb/tools/intel-features/intel-pt/interface/SBPTProcess.i
  lldb/tools/intel-features/intel-pt/source/API/CMakeLists.txt
  lldb/tools/intel-features/intel-pt/source/API/PTDecoder.cpp
  lldb/tools/intel-features/intel-pt/source/API/SBPTProcess.cpp
  lldb/tools/intel-features/intel-pt/source/API/cli-wrapper-pt.cpp
  lldb/tools/intel-features/intel-pt/source/Core/CMakeLists.txt
  lldb/tools/intel-features/intel-pt/source/Core/Decoder.cpp
  lldb/tools/intel-features/intel-pt/source/Core/PTProcess.cpp
  lldb/tools/intel-features/scripts/lldb-intel-features.swig

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85158.282718.patch
Type: text/x-patch
Size: 59566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200803/e7c0cab7/attachment-0001.bin>


More information about the lldb-commits mailing list