[PATCH] D41034: ASAN: Provide reliable debug info for local variables at -O0.

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 8 14:36:20 PST 2017


aprantl created this revision.
Herald added a subscriber: JDevlieghere.

The function stack poisioner conditionally stores local variables
either in an alloca or in malloc'ated memory, which has the
unfortunate side-effect, that the actual address of the variable is
only materialized when the variable is accessed, which means that
those variables are mostly invisible to the debugger even when
compiling without optimizations.

This patch stores the address of the local stack base into an alloca,
which can be referred to by the debug info and is available throughout
the function. This adds one extra pointer-sized alloca to each stack
frame where the transformation is applied to (but mem2reg can optimize
it away again when optimizations are enabled, yielding roughly the 
same debug info quality as before in optimized code).

rdar://problem/30433661


Repository:
  rL LLVM

https://reviews.llvm.org/D41034

Files:
  lib/Transforms/Instrumentation/AddressSanitizer.cpp
  test/Instrumentation/AddressSanitizer/basic.ll
  test/Instrumentation/AddressSanitizer/debug_info.ll
  test/Instrumentation/AddressSanitizer/local_stack_base.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41034.126211.patch
Type: text/x-patch
Size: 6238 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171208/800e7756/attachment.bin>


More information about the llvm-commits mailing list