[Lldb-commits] [PATCH] D87637: [lldb/test] Enable faulthandler in dotest

Jordan Rupprecht via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 16 14:31:10 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGdd67581407c1: [lldb/test] Enable faulthandler in dotest (authored by rupprecht).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87637/new/

https://reviews.llvm.org/D87637

Files:
  lldb/packages/Python/lldbsuite/test/dotest.py


Index: lldb/packages/Python/lldbsuite/test/dotest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -449,6 +449,18 @@
 
     lldbtest_config.codesign_identity = args.codesign_identity
 
+def registerFaulthandler():
+    try:
+        import faulthandler
+    except ImportError:
+        # faulthandler is not available until python3
+        return
+
+    faulthandler.enable()
+    # faulthandler.register is not available on Windows.
+    if getattr(faulthandler, 'register', None):
+        faulthandler.register(signal.SIGTERM, chain=True)
+
 def setupSysPath():
     """
     Add LLDB.framework/Resources/Python to the search paths for modules.
@@ -875,6 +887,9 @@
     #
     parseOptionsAndInitTestdirs()
 
+    # Print a stack trace if the test hangs or is passed SIGTERM.
+    registerFaulthandler()
+
     setupSysPath()
 
     import lldbconfig


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87637.292350.patch
Type: text/x-patch
Size: 981 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200916/f2433b47/attachment.bin>


More information about the lldb-commits mailing list