[PATCH] D24014: [codeview] Add new directives to record inlined call site line info

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 29 16:42:32 PDT 2016


rnk created this revision.
rnk added reviewers: majnemer, amccarth.
rnk added a subscriber: llvm-commits.

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.

https://reviews.llvm.org/D24014

Files:
  include/llvm/MC/MCCodeView.h
  include/llvm/MC/MCFragment.h
  include/llvm/MC/MCObjectStreamer.h
  include/llvm/MC/MCStreamer.h
  lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  lib/MC/MCAsmStreamer.cpp
  lib/MC/MCCodeView.cpp
  lib/MC/MCObjectStreamer.cpp
  lib/MC/MCParser/AsmParser.cpp
  lib/MC/MCStreamer.cpp
  test/DebugInfo/COFF/inlining-header.ll
  test/DebugInfo/COFF/inlining-levels.ll
  test/DebugInfo/COFF/inlining.ll
  test/DebugInfo/COFF/local-variables.ll
  test/MC/COFF/cv-def-range.s
  test/MC/COFF/cv-empty-linetable.s
  test/MC/COFF/cv-inline-linetable-infloop.s
  test/MC/COFF/cv-inline-linetable-unlikely.s
  test/MC/COFF/cv-inline-linetable-unreachable.s
  test/MC/COFF/cv-inline-linetable.s
  test/MC/COFF/cv-loc-cross-section.s
  test/MC/COFF/cv-loc.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24014.69636.patch
Type: text/x-patch
Size: 55340 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160829/27381751/attachment.bin>


More information about the llvm-commits mailing list