AddressFunctionScope was always returning the first address range of the function (assuming it was the only one). This doesn't work for RegisterContextUnwind (it's only caller), when the function doesn't start at the lowest address because it throws off the 'how many bytes "into" a function I am' computation. This patch replaces the result with a call to (recently introduced) SymbolContext::GetFunctionOrSymbolAddress.
51 lines
2.6 KiB
Plaintext
51 lines
2.6 KiB
Plaintext
# Test unwind info for functions which have been split into two or more parts.
|
|
# In particular, check we return the correct set of unwind plans when querying
|
|
# addresses which are in the middle of discontinuous functions.
|
|
|
|
# REQUIRES: lld, target-x86_64
|
|
|
|
# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj \
|
|
# RUN: %S/Inputs/basic-block-sections-with-dwarf.s > %t.o
|
|
# RUN: ld.lld %t.o -o %t
|
|
## NB: This minidump exists only as a receptacle for the object file built
|
|
## above. This is a workaround for the fact that "image show-unwind" does not
|
|
## work without a Process object.
|
|
# RUN: yaml2obj %S/Inputs/linux-x86_64.yaml > %t.core
|
|
# RUN: %lldb -c %t.core %t -o "image load --file %t --slide 0" -s %s -o exit | \
|
|
# RUN: FileCheck --implicit-check-not="UNWIND PLANS" %s
|
|
|
|
image show-unwind --cached true -n foo
|
|
# CHECK: UNWIND PLANS for {{.*}}`foo
|
|
#
|
|
# CHECK: eh_frame UnwindPlan:
|
|
# CHECK-NEXT: This UnwindPlan originally sourced from eh_frame CFI
|
|
# CHECK-NEXT: This UnwindPlan is sourced from the compiler: yes.
|
|
# CHECK-NEXT: This UnwindPlan is valid at all instruction locations: no.
|
|
# CHECK-NEXT: This UnwindPlan is for a trap handler function: no.
|
|
# CHECK-NEXT: Address range of this UnwindPlan: [{{.*}}.text + 6-0x000000000000000b)[{{.*}}.text + 12-0x000000000000001b)[{{.*}}.text + 43-0x0000000000000039)[{{.*}}.text + 58-0x0000000000000045)
|
|
# CHECK-NEXT: row[0]: -37: CFA=rsp+32 => rbx=[CFA-16] rip=[CFA-8]
|
|
# CHECK-NEXT: row[1]: -33: CFA=rsp +8 => rbx=[CFA-16] rip=[CFA-8]
|
|
# CHECK-NEXT: row[2]: -31: CFA=rsp+32 => rbx=[CFA-16] rip=[CFA-8]
|
|
# CHECK-NEXT: row[3]: -27: CFA=rsp+48 => rbx=[CFA-16] rip=[CFA-8]
|
|
# CHECK-NEXT: row[4]: -18: CFA=rsp+32 => rbx=[CFA-16] rip=[CFA-8]
|
|
# CHECK-NEXT: row[5]: 0: CFA=rsp +8 => rip=[CFA-8]
|
|
# CHECK-NEXT: row[6]: 1: CFA=rsp+16 => rbx=[CFA-16] rip=[CFA-8]
|
|
# CHECK-NEXT: row[7]: 12: CFA=rsp+32 => rbx=[CFA-16] rip=[CFA-8]
|
|
# CHECK-NEXT: row[8]: 15: CFA=rsp+16 => rbx=[CFA-16] rip=[CFA-8]
|
|
# CHECK-NEXT: row[9]: 19: CFA=rsp+32 => rbx=[CFA-16] rip=[CFA-8]
|
|
# CHECK-EMPTY:
|
|
|
|
image show-unwind --cached true -n bar
|
|
# CHECK: UNWIND PLANS for {{.*}}`bar
|
|
|
|
# CHECK: eh_frame UnwindPlan:
|
|
# CHECK-NEXT: This UnwindPlan originally sourced from eh_frame CFI
|
|
# CHECK-NEXT: This UnwindPlan is sourced from the compiler: yes.
|
|
# CHECK-NEXT: This UnwindPlan is valid at all instruction locations: no.
|
|
# CHECK-NEXT: This UnwindPlan is for a trap handler function: no.
|
|
# CHECK-NEXT: Address range of this UnwindPlan: [{{.*}}.text + 27-0x000000000000002b)
|
|
# CHECK-NEXT: row[0]: 0: CFA=rsp +8 => rip=[CFA-8]
|
|
# CHECK-NEXT: row[1]: 4: CFA=rsp+96 => rip=[CFA-8]
|
|
# CHECK-NEXT: row[2]: 15: CFA=rsp +8 => rip=[CFA-8]
|
|
# CHECK-EMPTY:
|