1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/test/MC/COFF/cv-inline-linetable-infloop.s
Reid Kleckner bdfdb24819 [codeview] Add new directives to record inlined call site line info
Summary:
Previously we were trying to represent this with the "contains" list of
the .cv_inline_linetable directive, which was not enough information.
Now we directly represent the chain of inlined call sites, so we know
what location to emit when we encounter a .cv_loc directive of an inner
inlined call site while emitting the line table of an outer function or
inlined call site. Fixes PR29146.

Also fixes PR29147, where we would crash when .cv_loc directives crossed
sections. Now we write down the section of the first .cv_loc directive,
and emit an error if any other .cv_loc directive for that function is in
a different section.

Also fixes issues with discontiguous inlined source locations, like in
this example:

  volatile int unlikely_cond = 0;
  extern void __declspec(noreturn) abort();
  __forceinline void f() {
    if (!unlikely_cond) abort();
  }
  int main() {
    unlikely_cond = 0;
    f();
    unlikely_cond = 0;
  }

Previously our tables gave bad location information for the 'abort'
call, and the debugger wouldn't snow the inlined stack frame for 'f'.
It is important to emit good line tables for this code pattern, because
it comes up whenever an asan bug occurs in an inlined function. The
__asan_report* stubs are generally placed after the normal function
epilogue, leading to discontiguous regions of inlined code.

Reviewers: majnemer, amccarth

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D24014

llvm-svn: 280822
2016-09-07 16:15:31 +00:00

75 lines
2.3 KiB
ArmAsm

# RUN: llvm-mc -triple=x86_64-pc-win32 -filetype=obj < %s | llvm-readobj -codeview | FileCheck %s
# CHECK: InlineSite {
# CHECK: BinaryAnnotations [
# CHECK: ChangeLineOffset: 1
# CHECK: ChangeCodeLength: 0x2
# CHECK: ]
# CHECK: }
.text
.cv_file 1 "D:\\src\\llvm\\build\\t.c"
.def infloop;
.scl 2;
.type 32;
.endef
.section .text,"xr",one_only,infloop
.globl infloop
.p2align 4, 0x90
infloop: # @infloop
.Lfunc_begin1:
.cv_func_id 0
.cv_inline_site_id 2 within 0 inlined_at 1 1 1
.cv_loc 2 1 3 7 # t.c:3:7
jmp .Lfunc_begin1
.Lfunc_end1:
.def afterinfloop;
.scl 2;
.type 32;
.endef
.section .text,"xr",one_only,afterinfloop
.globl afterinfloop
.p2align 4, 0x90
afterinfloop: # @afterinfloop
.cv_func_id 3
.cv_loc 3 1 13 0 # t.c:13:0
retq
.section .debug$S,"dr"
.long 4
.long 241 # Symbol subsection for infloop
.long .Ltmp17-.Ltmp16 # Subsection size
.Ltmp16:
.short .Ltmp19-.Ltmp18 # Record length
.Ltmp18:
.short 4423 # Record kind: S_GPROC32_ID
.long 0 # PtrParent
.long 0 # PtrEnd
.long 0 # PtrNext
.long .Lfunc_end1-infloop # Code size
.long 0 # Offset after prologue
.long 0 # Offset before epilogue
.long 0 # Function type index
.secrel32 infloop # Function section relative address
.secidx infloop # Function section index
.byte 0 # Flags
.asciz "infloop" # Function name
.Ltmp19:
.short .Ltmp21-.Ltmp20 # Record length
.Ltmp20:
.short 4429 # Record kind: S_INLINESITE
.long 0 # PtrParent
.long 0 # PtrEnd
.long 4098 # Inlinee type index
.cv_inline_linetable 2 1 2 .Lfunc_begin1 .Lfunc_end1
.Ltmp21:
.short 2 # Record length
.short 4430 # Record kind: S_INLINESITE_END
.short 2 # Record length
.short 4431 # Record kind: S_PROC_ID_END
.Ltmp17:
.p2align 2
.cv_linetable 1, infloop, .Lfunc_end1