[all-commits] [llvm/llvm-project] 387250: [lldb] Don't hand out UnwindPlan::Row shared_ptrs ...

Pavel Labath via All-commits all-commits at lists.llvm.org
Mon Feb 24 23:59:20 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3872503d6eb3eed7f2b2db13daad27307369f0be
      https://github.com/llvm/llvm-project/commit/3872503d6eb3eed7f2b2db13daad27307369f0be
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2025-02-25 (Tue, 25 Feb 2025)

  Changed paths:
    M lldb/include/lldb/Symbol/UnwindPlan.h
    M lldb/include/lldb/Target/RegisterContextUnwind.h
    M lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
    M lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
    M lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
    M lldb/source/Symbol/FuncUnwinders.cpp
    M lldb/source/Symbol/UnwindPlan.cpp
    M lldb/source/Target/RegisterContextUnwind.cpp
    M lldb/unittests/UnwindAssembly/ARM64/TestArm64InstEmulation.cpp
    M lldb/unittests/UnwindAssembly/PPC64/TestPPC64InstEmulation.cpp
    M lldb/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp

  Log Message:
  -----------
  [lldb] Don't hand out UnwindPlan::Row shared_ptrs (#128181)

The whole unwind plan is already stored in a shared pointer, and there's
no need to persist Rows individually. If there's ever a need to do that,
there are at least two options:
- copy the row (they're not that big, and they're being copied left and
right during construction already)
- use the shared_ptr subobject constructor to create a shared_ptr which
points to a Row but holds the entire unwind plan alive

This also changes all of the getter functions to return const Row
pointers, which is important for safety because all of these objects are
cached and potentially accessed from multiple threads. (Technically one
could hand out `shared_ptr<const Row>`s, but we don't have a habit of
doing that.)

As a next step, I'd like to remove the internal UnwindPlan usages of the
shared pointer, but I'm doing this separately to gauge feedback, and
also because the patch got rather big.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list