summaryrefslogtreecommitdiffstats
path: root/lldb/lit/SymbolFile/Breakpad/unwind-via-stack-win.test
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-09-05 07:05:15 +0000
committerPavel Labath <pavel@labath.sk>2019-09-05 07:05:15 +0000
commitc3bea40bf751b1ade264e2df8487d196e0c7d3c8 (patch)
tree54f8ec6c713b28bbde8bda13b3a9a794543b51a3 /lldb/lit/SymbolFile/Breakpad/unwind-via-stack-win.test
parente46639620d32c4edf274d5d2964850542d34db15 (diff)
downloadbcm5719-llvm-c3bea40bf751b1ade264e2df8487d196e0c7d3c8.tar.gz
bcm5719-llvm-c3bea40bf751b1ade264e2df8487d196e0c7d3c8.zip
Breakpad: Basic support for STACK WIN unwinding
Summary: This patch makes it possible to unwind via breakpad STACK WIN records. It is "basic" because two important features are missing: - support for the .raSearch keyword - support for multiple STACK WIN records within a single function Right now, we just reject the .raSearch records, and always pick the first record for the whole function SymbolFileBreakpad, and so I think it can serve as a good example of what is needed of the symbol file and unwinding machinery to make this work. However, it is already useful for unwinding in some situations, and it sets up the general framework for the parsing of these kinds of records, which reduces the size of the followup patches implementing the two other components. Reviewers: amccarth, rnk, markmentovai Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D67067 llvm-svn: 371017
Diffstat (limited to 'lldb/lit/SymbolFile/Breakpad/unwind-via-stack-win.test')
-rw-r--r--lldb/lit/SymbolFile/Breakpad/unwind-via-stack-win.test54
1 files changed, 54 insertions, 0 deletions
diff --git a/lldb/lit/SymbolFile/Breakpad/unwind-via-stack-win.test b/lldb/lit/SymbolFile/Breakpad/unwind-via-stack-win.test
new file mode 100644
index 00000000000..2e04ed68844
--- /dev/null
+++ b/lldb/lit/SymbolFile/Breakpad/unwind-via-stack-win.test
@@ -0,0 +1,54 @@
+# RUN: yaml2obj %S/Inputs/unwind-via-stack-win.yaml > %t
+# RUN: %lldb -c %t \
+# RUN: -o "target symbols add %S/Inputs/unwind-via-stack-win.syms" \
+# RUN: -s %s -b | FileCheck %s
+
+# First check that unwind plan generation works correctly.
+# This function has a "typical" unwind rule.
+image show-unwind -n call_many
+# CHECK-LABEL: image show-unwind -n call_many
+# CHECK: UNWIND PLANS for unwind-via-stack-win.exe`call_many
+# CHECK: Symbol file UnwindPlan:
+# CHECK: This UnwindPlan originally sourced from breakpad STACK WIN
+# CHECK: This UnwindPlan is sourced from the compiler: yes.
+# CHECK: This UnwindPlan is valid at all instruction locations: no.
+# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 16-0x0000007d)
+# CHECK: row[0]: 0: CFA=DW_OP_breg7 +0, DW_OP_consts +80, DW_OP_plus => esp=DW_OP_pick 0x00, DW_OP_consts +4, DW_OP_plus eip=DW_OP_pick 0x00, DW_OP_deref
+
+# Then, some invalid rules.
+image show-unwind -n bogus_rule
+# CHECK-LABEL: image show-unwind -n bogus_rule
+# CHECK: UNWIND PLANS for unwind-via-stack-win.exe`bogus_rule
+# CHECK-NOT: Symbol file
+
+image show-unwind -n bogus_cfa_rhs
+# CHECK-LABEL: image show-unwind -n bogus_cfa_rhs
+# CHECK: UNWIND PLANS for unwind-via-stack-win.exe`bogus_cfa_rhs
+# CHECK-NOT: Symbol file
+
+image show-unwind -n bogus_esp_rhs
+# CHECK-LABEL: image show-unwind -n bogus_esp_rhs
+# CHECK: UNWIND PLANS for unwind-via-stack-win.exe`bogus_esp_rhs
+# CHECK-NOT: Symbol file
+
+# We don't treat unknown lhs as an error, as it can be just a temporary
+# variable used in other rules.
+image show-unwind -n temporary_var
+# CHECK-LABEL: image show-unwind -n temporary_var
+# CHECK: UNWIND PLANS for unwind-via-stack-win.exe`temporary_var
+# CHECK: Symbol file UnwindPlan:
+# CHECK: This UnwindPlan originally sourced from breakpad STACK WIN
+# CHECK: This UnwindPlan is sourced from the compiler: yes.
+# CHECK: This UnwindPlan is valid at all instruction locations: no.
+# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 304-0x00000134)
+# CHECK: row[0]: 0: CFA=DW_OP_breg7 +0 => esp=DW_OP_pick 0x00, DW_OP_consts +4, DW_OP_plus eip=DW_OP_pick 0x00, DW_OP_deref
+
+# And finally, check that backtracing works as a whole by unwinding a simple
+# stack.
+thread backtrace
+# CHECK-LABEL: thread backtrace
+# CHECK: frame #0: 0x000b1092 unwind-via-stack-win.exe`many_pointer_args
+# CHECK: frame #1: 0x000b1079 unwind-via-stack-win.exe`call_many + 105
+# CHECK: frame #2: 0x000b1085 unwind-via-stack-win.exe`main + 5
+# CHECK: frame #3: 0x77278494 kernel32.dll
+# CHECK-NOT: frame
OpenPOWER on IntegriCloud