1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
llvm-mirror/test/MC/COFF/cv-loc.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

88 lines
1.8 KiB
ArmAsm

# RUN: llvm-mc < %s -triple=x86_64-pc-win32 -filetype=obj | llvm-readobj - -codeview | FileCheck %s
.section .debug$S
.long 4
.cv_stringtable
.cv_file 1 "a.c"
.cv_file 2 "t.inc"
.cv_func_id 0
# Implements this C:
# void f(volatile int *x) {
# ++*x;
# #include "t.h" // contains two ++*x; statements
# ++*x;
# }
.text
.def f;
.scl 2;
.type 32;
.endef
.text
.globl f
.align 16, 0x90
f:
.Lfunc_begin0:
.cv_loc 0 1 5 2
incl (%rdi)
# #include "t.h" start
.cv_loc 0 2 0 0 is_stmt 1
incl (%rdi)
.cv_loc 0 2 1 0
incl (%rdi)
# #include "t.h" end
.cv_loc 0 1 6 2
incl (%rdi)
retq
.Lfunc_end0:
.section .debug$S
.cv_filechecksums
.cv_linetable 0, f, .Lfunc_end0
# CHECK: FunctionLineTable [
# CHECK: LinkageName: f
# CHECK: Flags: 0x1
# CHECK: CodeSize: 0x9
# CHECK: FilenameSegment [
# CHECK: Filename: a.c (0x0)
# CHECK: +0x0 [
# CHECK: LineNumberStart: 5
# CHECK: LineNumberEndDelta: 0
# CHECK: IsStatement: No
# CHECK: ColStart: 2
# CHECK: ColEnd: 0
# CHECK: ]
# CHECK: ]
# CHECK: FilenameSegment [
# CHECK: Filename: t.inc (0x8)
# CHECK: +0x2 [
# CHECK: LineNumberStart: 0
# CHECK: LineNumberEndDelta: 0
# CHECK: IsStatement: Yes
# CHECK: ColStart: 0
# CHECK: ColEnd: 0
# CHECK: ]
# CHECK: +0x4 [
# CHECK: LineNumberStart: 1
# CHECK: LineNumberEndDelta: 0
# CHECK: IsStatement: No
# CHECK: ColStart: 0
# CHECK: ColEnd: 0
# CHECK: ]
# CHECK: ]
# CHECK: FilenameSegment [
# CHECK: Filename: a.c (0x0)
# CHECK: +0x6 [
# CHECK: LineNumberStart: 6
# CHECK: LineNumberEndDelta: 0
# CHECK: IsStatement: No
# CHECK: ColStart: 2
# CHECK: ColEnd: 0
# CHECK: ]
# CHECK: ]
# CHECK: ]