[all-commits] [llvm/llvm-project] 8b46bd: [lldb] Skip plugin teardown when exiting without T...

Jonas Devlieghere via All-commits all-commits at lists.llvm.org
Fri Jun 5 17:10:46 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8b46bd51399d3e49c601d9958b2e3ff5c1a706cd
      https://github.com/llvm/llvm-project/commit/8b46bd51399d3e49c601d9958b2e3ff5c1a706cd
  Author: Jonas Devlieghere <jonas at devlieghere.com>
  Date:   2026-06-05 (Fri, 05 Jun 2026)

  Changed paths:
    M lldb/source/Core/PluginManager.cpp

  Log Message:
  -----------
  [lldb] Skip plugin teardown when exiting without Terminate (#201739)

`import lldb` auto-calls SBDebugger::Initialize() but never Terminate().
The g_debugger_lifetime is a deliberately-leaked ManagedStatic, so the
PluginInstances containers are still populated when their static
destructors run at process exit. That tripped the "forgot to unregister
plugin?" assert, and once the assert was gated the dynamically-loaded
plugin map's PluginInfo terminate callbacks ran against PluginInstances
mutexes that had already been destroyed.

This only surfaces with LLDB_ENABLE_DYNAMIC_SCRIPTINTERPRETERS, where
`_lldb` is the script-interpreter plugin dylib and liblldb comes in as a
dependency that exit() finalizes. A static build leaks identically but
never reaches those destructors, so the bug stayed latent.

Track an explicit lifecycle (Uninitialized/Initialized/Terminated) in a
single never-destroyed PluginRegistry. ~PluginInstances only checks for
leftover registrations once Terminate() has run, and the map (never torn
down at exit) only runs its terminate callbacks during an explicit
clear, while every container is still alive.



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