[Lldb-commits] [PATCH] D12683: Fix debugger shutdown when Python interpreter is loaded

Oleksiy Vyalov via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 7 18:47:27 PDT 2015

ovyalov created this revision.
ovyalov added a reviewer: clayborg.
ovyalov added a subscriber: lldb-commits.

Python locks in memory a few global objects like lldb.debugger,lldb.target,...  - as a consequence, ~Debugger isn't called upon shutdown.
Calling Debugger::Clear ensures that ScriptInterpreterPython::Clear is called to clean up Python global variables. 



Index: source/Core/Debugger.cpp
--- source/Core/Debugger.cpp
+++ source/Core/Debugger.cpp
@@ -421,7 +421,11 @@
     // Clear our master list of debugger objects
     Mutex::Locker locker (GetDebuggerListMutex ());
-    GetDebuggerList().clear();
+    auto& debuggers = GetDebuggerList();
+    for (const auto& debugger: debuggers)
+        debugger->Clear();
+    debuggers.clear();

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12683.34176.patch
Type: text/x-patch
Size: 466 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150908/f1acb9d0/attachment.bin>

More information about the lldb-commits mailing list