From 2d26cf37d777c9e6c4f89144b506a153b010d495 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Mon, 17 Jun 2019 20:06:34 +0000 Subject: [PATCH] llgdb.py: Make sure to clean up the debugger on exit. llvm-svn: 363611 --- debuginfo-tests/llgdb.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/debuginfo-tests/llgdb.py b/debuginfo-tests/llgdb.py index 7d4fdd64fd1b..5f14497f628f 100644 --- a/debuginfo-tests/llgdb.py +++ b/debuginfo-tests/llgdb.py @@ -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 may happen: print debugger.HandleCommand(' '.join(cmd)) except SystemExit: - lldb.SBDebugger_Terminate() raise except: print 'Could not handle the command "%s"' % ' '.join(cmd)