summaryrefslogtreecommitdiffstats
path: root/lldb/test/Shell/Reproducer
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-11-19 17:28:46 -0800
committerJonas Devlieghere <jonas@devlieghere.com>2019-11-20 13:14:16 -0800
commitc8dfe907299e16aeb17175cb0896c17043fc7c81 (patch)
tree85aa1fcf033d71c0243f3efec47e593a5ba0818e /lldb/test/Shell/Reproducer
parent824b25fc02dc4544adae55e6451d355f4c6d7055 (diff)
downloadbcm5719-llvm-c8dfe907299e16aeb17175cb0896c17043fc7c81.tar.gz
bcm5719-llvm-c8dfe907299e16aeb17175cb0896c17043fc7c81.zip
[Reproducer] Generate LLDB reproducer on crash
This patch hooks the reproducer infrastructure with the signal handlers. When lldb crashes with reproducers capture enabled, it will now generate the reproducer and print a short message the standard out. This doesn't affect the pretty stack traces, which are still printed before. This patch also introduces a new reproducer sub-command that intentionally raises a given signal to test the reproducer signal handling. Currently the signal handler is doing too much work. Instead of copying over files into the reproducers in the signal handler, we should re-invoke ourselves with a special command line flag that looks at the VFS mapping and performs the copy. This is a NO-OP when reproducers are disabled. Differential revision: https://reviews.llvm.org/D70474
Diffstat (limited to 'lldb/test/Shell/Reproducer')
-rw-r--r--lldb/test/Shell/Reproducer/Inputs/GDBRemoteCrashCapture.in6
-rw-r--r--lldb/test/Shell/Reproducer/TestCrash.test14
-rw-r--r--lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test9
3 files changed, 28 insertions, 1 deletions
diff --git a/lldb/test/Shell/Reproducer/Inputs/GDBRemoteCrashCapture.in b/lldb/test/Shell/Reproducer/Inputs/GDBRemoteCrashCapture.in
new file mode 100644
index 00000000000..1a733f4dd94
--- /dev/null
+++ b/lldb/test/Shell/Reproducer/Inputs/GDBRemoteCrashCapture.in
@@ -0,0 +1,6 @@
+breakpoint set -f simple.c -l 12
+run
+bt
+cont
+reproducer status
+reproducer xcrash -s SIGSEGV
diff --git a/lldb/test/Shell/Reproducer/TestCrash.test b/lldb/test/Shell/Reproducer/TestCrash.test
new file mode 100644
index 00000000000..1f26a4ebf03
--- /dev/null
+++ b/lldb/test/Shell/Reproducer/TestCrash.test
@@ -0,0 +1,14 @@
+# UNSUPPORTED: system-windows
+# This tests that a reproducer is generated when LLDB crashes.
+
+# Start clean.
+# RUN: rm -rf %t.repro
+
+# RUN: %lldb -b --capture --capture-path %t.repro -o 'reproducer xcrash -s SIGSEGV' | FileCheck %s
+# RUN: %lldb -b --capture --capture-path %t.repro -o 'reproducer xcrash -s SIGBUS' | FileCheck %s
+# RUN: %lldb -b --capture --capture-path %t.repro -o 'reproducer xcrash -s SIGILL' | FileCheck %s
+
+# CHECK: ********************
+# CHECK: Crash reproducer for
+# CHECK: Reproducer written to
+# CHECK: ********************
diff --git a/lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test b/lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
index 04a3e5465bb..609c8392929 100644
--- a/lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
+++ b/lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
@@ -6,11 +6,18 @@
# process. To ensure we're not actually running the original binary we check
# that the string "testing" is not printed.
-# RUN: rm -rf %t.repro
# RUN: %clang_host %S/Inputs/simple.c -g -o %t.out
+
+# Test reproducer generate command.
+# RUN: rm -rf %t.repro
# RUN: %lldb -x -b -s %S/Inputs/GDBRemoteCapture.in --capture --capture-path %t.repro %t.out | FileCheck %s --check-prefix CHECK --check-prefix CAPTURE
# RUN: env FOO=BAR %lldb --replay %t.repro | FileCheck %s --check-prefix CHECK --check-prefix REPLAY
+# Test crash reproducer.
+# RUN: rm -rf %t.repro
+# RUN: %lldb -x -b -s %S/Inputs/GDBRemoteCrashCapture.in --capture --capture-path %t.repro %t.out | FileCheck %s --check-prefix CHECK --check-prefix CAPTURE
+# RUN: %lldb --replay %t.repro | FileCheck %s --check-prefix CHECK --check-prefix REPLAY
+
# CHECK: Breakpoint 1
# CHECK: Process {{.*}} stopped
# CHECK: Process {{.*}} launched
OpenPOWER on IntegriCloud