[all-commits] [llvm/llvm-project] 82de8d: [lldb] Clarify StructuredDataImpl ownership

Pavel Labath via All-commits all-commits at lists.llvm.org
Mon Dec 13 12:06:14 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 82de8df26f15778793dc6b1526e14779f435f2e1
      https://github.com/llvm/llvm-project/commit/82de8df26f15778793dc6b1526e14779f435f2e1
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2021-12-13 (Mon, 13 Dec 2021)

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

  Log Message:
  -----------
  [lldb] Clarify StructuredDataImpl ownership

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.

Differential Revision: https://reviews.llvm.org/D114791




More information about the All-commits mailing list