1# REQUIRES: x86 2 3# RUN: yaml2obj %S/Inputs/unwind-via-stack-win.yaml -o %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: This UnwindPlan is for a trap handler function: no. 18# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 4112-0x0000107d) 19# CHECK: row[0]: 0: CFA=DW_OP_breg7 +0, DW_OP_consts +80, DW_OP_plus => esp=DW_OP_pick 0x0, DW_OP_consts +4, DW_OP_plus eip=DW_OP_pick 0x0, DW_OP_deref 20 21# Then, some invalid rules. 22image show-unwind -n bogus_rule 23# CHECK-LABEL: image show-unwind -n bogus_rule 24# CHECK: UNWIND PLANS for unwind-via-stack-win.exe`bogus_rule 25# CHECK-NOT: Symbol file 26 27image show-unwind -n bogus_cfa_rhs 28# CHECK-LABEL: image show-unwind -n bogus_cfa_rhs 29# CHECK: UNWIND PLANS for unwind-via-stack-win.exe`bogus_cfa_rhs 30# CHECK-NOT: Symbol file 31 32image show-unwind -n bogus_esp_rhs 33# CHECK-LABEL: image show-unwind -n bogus_esp_rhs 34# CHECK: UNWIND PLANS for unwind-via-stack-win.exe`bogus_esp_rhs 35# CHECK-NOT: Symbol file 36 37# We don't treat unknown lhs as an error, as it can be just a temporary 38# variable used in other rules. 39image show-unwind -n temporary_var 40# CHECK-LABEL: image show-unwind -n temporary_var 41# CHECK: UNWIND PLANS for unwind-via-stack-win.exe`temporary_var 42# CHECK: Symbol file UnwindPlan: 43# CHECK: This UnwindPlan originally sourced from breakpad STACK WIN 44# CHECK: This UnwindPlan is sourced from the compiler: yes. 45# CHECK: This UnwindPlan is valid at all instruction locations: no. 46# CHECK: This UnwindPlan is for a trap handler function: no. 47# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 4400-0x00001134) 48# CHECK: row[0]: 0: CFA=DW_OP_breg7 +0 => esp=DW_OP_pick 0x0, DW_OP_consts +4, DW_OP_plus eip=DW_OP_pick 0x0, DW_OP_deref 49 50# And finally, check that backtracing works as a whole by unwinding a simple 51# stack. 52thread backtrace 53# CHECK-LABEL: thread backtrace 54# CHECK: frame #0: 0x000b1092 unwind-via-stack-win.exe`many_pointer_args 55# CHECK: frame #1: 0x000b1079 unwind-via-stack-win.exe`call_many + 105 56# CHECK: frame #2: 0x000b1085 unwind-via-stack-win.exe`main + 5 57# CHECK: frame #3: 0x77278494 kernel32.dll 58# CHECK-NOT: frame 59