[debuginfo-tests] r363611 - llgdb.py: Make sure to clean up the debugger on exit.

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 17 13:06:34 PDT 2019


Author: adrian
Date: Mon Jun 17 13:06:34 2019
New Revision: 363611

URL: http://llvm.org/viewvc/llvm-project?rev=363611&view=rev
Log:
llgdb.py: Make sure to clean up the debugger on exit.

<rdar://problem/51807962>

Modified:
    debuginfo-tests/trunk/llgdb.py

Modified: debuginfo-tests/trunk/llgdb.py
URL: http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/llgdb.py?rev=363611&r1=363610&r2=363611&view=diff
==============================================================================
--- debuginfo-tests/trunk/llgdb.py (original)
+++ debuginfo-tests/trunk/llgdb.py Mon Jun 17 13:06:34 2019
@@ -58,6 +58,12 @@ args = parser.parse_args()
 debugger = lldb.SBDebugger.Create()
 debugger.SkipLLDBInitFiles(args.n)
 
+# Make sure to clean up the debugger on exit.
+import atexit
+def on_exit():
+    debugger.Terminate()
+atexit.register(on_exit)
+
 # Don't return from lldb function calls until the process stops.
 debugger.SetAsync(False)
 
@@ -150,7 +156,6 @@ NOTE: There are several reasons why this
             print debugger.HandleCommand(' '.join(cmd))
 
     except SystemExit:
-        lldb.SBDebugger_Terminate()
         raise
     except:
         print 'Could not handle the command "%s"' % ' '.join(cmd)




More information about the llvm-commits mailing list