[Lldb-commits] [PATCH] D114791: [lldb] Clarify StructuredDataImpl ownership

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 30 05:37:33 PST 2021


labath created this revision.
labath added reviewers: JDevlieghere, mib, jingham.
Herald added a subscriber: yaxunl.
labath requested review of this revision.
Herald added a project: LLDB.

StructuredDataImpl ownership semantics is unclear at best. Various
structures were holding a non-owning pointer to it, with a comment that
the object is owned somewhere else. From what I was able to gather that
"somewhere else" was the SBStructuredData object, but I am not sure that
all created object eventually made its way there. (It wouldn't matter
even if they did, as we are leaking most of our SBStructuredData
objects.)

Since StructuredDataImpl is just a collection of two (shared) pointers,
there's really no point in elaborate lifetime management, so this patch
replaces all StructuredDataImpl pointers with actual objects or
unique_ptrs to it. This makes it much easier to resolve SBStructuredData
leaks in a follow-up patch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114791

Files:
  lldb/bindings/lua/lua-wrapper.swig
  lldb/bindings/python/python-wrapper.swig
  lldb/include/lldb/API/SBStructuredData.h
  lldb/include/lldb/Breakpoint/BreakpointResolverScripted.h
  lldb/include/lldb/Core/StructuredDataImpl.h
  lldb/include/lldb/Interpreter/ScriptInterpreter.h
  lldb/include/lldb/Target/Target.h
  lldb/include/lldb/Target/ThreadPlanPython.h
  lldb/source/API/SBStructuredData.cpp
  lldb/source/API/SBThreadPlan.cpp
  lldb/source/Breakpoint/BreakpointResolverScripted.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp
  lldb/source/Target/Target.cpp
  lldb/source/Target/Thread.cpp
  lldb/source/Target/ThreadPlanPython.cpp
  lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114791.390672.patch
Type: text/x-patch
Size: 31025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211130/f9b8dc5e/attachment-0001.bin>


More information about the lldb-commits mailing list