1# REQUIRES: x86
2
3# RUN: yaml2obj %S/Inputs/unwind-via-stack-win.yaml > %t
4# RUN: %lldb -c %t \
5# RUN:   -o "target symbols add %S/Inputs/unwind-via-stack-win.syms" \
6# RUN:   -s %s -b | FileCheck %s
7
8# First check that unwind plan generation works correctly.
9# This function has a "typical" unwind rule.
10image show-unwind -n call_many
11# CHECK-LABEL: image show-unwind -n call_many
12# CHECK: UNWIND PLANS for unwind-via-stack-win.exe`call_many
13# CHECK: Symbol file UnwindPlan:
14# CHECK: This UnwindPlan originally sourced from breakpad STACK WIN
15# CHECK: This UnwindPlan is sourced from the compiler: yes.
16# CHECK: This UnwindPlan is valid at all instruction locations: no.
17# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 4112-0x0000107d)
18# 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
19
20# Then, some invalid rules.
21image show-unwind -n bogus_rule
22# CHECK-LABEL: image show-unwind -n bogus_rule
23# CHECK: UNWIND PLANS for unwind-via-stack-win.exe`bogus_rule
24# CHECK-NOT: Symbol file
25
26image show-unwind -n bogus_cfa_rhs
27# CHECK-LABEL: image show-unwind -n bogus_cfa_rhs
28# CHECK: UNWIND PLANS for unwind-via-stack-win.exe`bogus_cfa_rhs
29# CHECK-NOT: Symbol file
30
31image show-unwind -n bogus_esp_rhs
32# CHECK-LABEL: image show-unwind -n bogus_esp_rhs
33# CHECK: UNWIND PLANS for unwind-via-stack-win.exe`bogus_esp_rhs
34# CHECK-NOT: Symbol file
35
36# We don't treat unknown lhs as an error, as it can be just a temporary
37# variable used in other rules.
38image show-unwind -n temporary_var
39# CHECK-LABEL: image show-unwind -n temporary_var
40# CHECK: UNWIND PLANS for unwind-via-stack-win.exe`temporary_var
41# CHECK: Symbol file UnwindPlan:
42# CHECK: This UnwindPlan originally sourced from breakpad STACK WIN
43# CHECK: This UnwindPlan is sourced from the compiler: yes.
44# CHECK: This UnwindPlan is valid at all instruction locations: no.
45# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 4400-0x00001134)
46# 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
47
48# And finally, check that backtracing works as a whole by unwinding a simple
49# stack.
50thread backtrace
51# CHECK-LABEL: thread backtrace
52# CHECK: frame #0: 0x000b1092 unwind-via-stack-win.exe`many_pointer_args
53# CHECK: frame #1: 0x000b1079 unwind-via-stack-win.exe`call_many + 105
54# CHECK: frame #2: 0x000b1085 unwind-via-stack-win.exe`main + 5
55# CHECK: frame #3: 0x77278494 kernel32.dll
56# CHECK-NOT: frame
57