mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
93adc422a8
The goal is to improve hwasan's error reporting for stack use-after-return by recording enough information to allow the specific variable that was accessed to be identified based on the pointer's tag. Currently we record the PC and lower bits of SP for each stack frame we create (which will eventually be enough to derive the base tag used by the stack frame) but that's not enough to determine the specific tag for each variable, which is the stack frame's base tag XOR a value (the "tag offset") that is unique for each variable in a function. In IR, the tag offset is most naturally represented as part of a location expression on the llvm.dbg.declare instruction. However, the presence of the tag offset in the variable's actual location expression is likely to confuse debuggers which won't know about tag offsets, and moreover the tag offset is not required for a debugger to determine the location of the variable on the stack, so at the DWARF level it is represented as an attribute so that it will be ignored by debuggers that don't know about it. Differential Revision: https://reviews.llvm.org/D63119 llvm-svn: 363635
26 lines
1.2 KiB
LLVM
26 lines
1.2 KiB
LLVM
; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
|
|
; RUN: verify-uselistorder %s
|
|
|
|
; CHECK: !named = !{
|
|
; CHECK-SAME: !DIExpression(),
|
|
; CHECK-SAME: !DIExpression(DW_OP_deref),
|
|
; CHECK-SAME: !DIExpression(DW_OP_constu, 3, DW_OP_plus),
|
|
; CHECK-SAME: !DIExpression(DW_OP_LLVM_fragment, 3, 7),
|
|
; CHECK-SAME: !DIExpression(DW_OP_deref, DW_OP_plus_uconst, 3, DW_OP_LLVM_fragment, 3, 7),
|
|
; CHECK-SAME: !DIExpression(DW_OP_constu, 2, DW_OP_swap, DW_OP_xderef),
|
|
; CHECK-SAME: !DIExpression(DW_OP_plus_uconst, 3)
|
|
; CHECK-SAME: !DIExpression(DW_OP_LLVM_convert, 16, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_signed)
|
|
; CHECK-SAME: !DIExpression(DW_OP_LLVM_tag_offset, 1)}
|
|
|
|
!named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8}
|
|
|
|
!0 = !DIExpression()
|
|
!1 = !DIExpression(DW_OP_deref)
|
|
!2 = !DIExpression(DW_OP_constu, 3, DW_OP_plus)
|
|
!3 = !DIExpression(DW_OP_LLVM_fragment, 3, 7)
|
|
!4 = !DIExpression(DW_OP_deref, DW_OP_plus_uconst, 3, DW_OP_LLVM_fragment, 3, 7)
|
|
!5 = !DIExpression(DW_OP_constu, 2, DW_OP_swap, DW_OP_xderef)
|
|
!6 = !DIExpression(DW_OP_plus_uconst, 3)
|
|
!7 = !DIExpression(DW_OP_LLVM_convert, 16, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_signed)
|
|
!8 = !DIExpression(DW_OP_LLVM_tag_offset, 1)
|