[compiler-rt] r220582 - Add runtime flag 'symbolize_inline_frames' to disable symbolization of inlined frames done in llvm-symbolizer
Will Schmidt
will_schmidt at vnet.ibm.com
Tue Oct 28 15:18:16 PDT 2014
On Mon, 2014-10-27 at 15:48 -0700, Alexey Samsonov wrote:
> Hi Will,
>
>
> It's possible that FooBarBaz() just doesn't get inlined. Could you
> check if the attached patch fixes the test for you?
Thanks for the patch. I verified that the function is being inlined
with -O3 or with the inline attribute, as was expected. I was poking a
few more parts with gdb to make sense of things, and determined that I
did have a stale/old object somewhere in my build.. (gdb could not find
the symbolize_inline_frames field, which was obviously a bad thing.. ).
So with a fresh(er) build, the test still fails, but differently. As
seen below, the symbolize_inline_frames=false is causing the main()
entry to be suppressed, rather than the FooBarBaz() entry.
> export ASAN_OPTIONS=symbolize_inline_frames=true
> <...>/asan/Output/print-stack-trace.cc.tmp
#0 0x100c4e5c in __sanitizer_print_stack_trace <...>/asan/asan_stack.cc:23
#1 0x100e2c48 in FooBarBaz <...>/TestCases/print-stack-trace.cc:12:3
#2 0x100e2c48 in main <...>/TestCases/print-stack-trace.cc:16
#3 0x100000424548 (/lib64/power8/libc.so.6+0x44548)
> export ASAN_OPTIONS=symbolize_inline_frames=false
> <...>/asan/Output/print-stack-trace.cc.tmp
#0 0x100c4e5c in __sanitizer_print_stack_trace <...>/asan/asan_stack.cc:23
#1 0x100e2c48 in FooBarBaz <...>/TestCases/print-stack-trace.cc:12:3
#2 0x100000424548 (/lib64/power8/libc.so.6+0x44548)
Under gdb, backtrace is:
(gdb) bt
#0 __sanitizer_print_stack_trace () at <...>/lib/asan/asan_stack.cc:24
#1 0x00000000100e2c4c in FooBarBaz () at <...>/sanitizer_common/TestCases/print-stack-trace.cc:12
#2 main () at <...>/sanitizer_common/TestCases/print-stack-trace.cc:16
>
> On Mon, Oct 27, 2014 at 3:23 PM, Will Schmidt
> <will_schmidt at vnet.ibm.com> wrote:
> On Fri, 2014-10-24 at 18:34 +0000, Alexey Samsonov wrote:
> > Author: samsonov
> > Date: Fri Oct 24 13:34:43 2014
> > New Revision: 220582
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=220582&view=rev
> > Log:
> > Add runtime flag 'symbolize_inline_frames' to disable
> symbolization of inlined frames done in llvm-symbolizer
> >
>
> > Modified:
> compiler-rt/trunk/test/sanitizer_common/TestCases/print-stack-trace.cc
> > URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/print-stack-trace.cc?rev=220582&r1=220581&r2=220582&view=diff
> >
> ==============================================================================
> > ---
> compiler-rt/trunk/test/sanitizer_common/TestCases/print-stack-trace.cc (original)
> > +++
> compiler-rt/trunk/test/sanitizer_common/TestCases/print-stack-trace.cc Fri Oct 24 13:34:43 2014
> > @@ -1,13 +1,14 @@
> > // RUN: %clangxx -O0 %s -o %t && %run %t 2>&1 | FileCheck %
> s
> > // RUN: %clangxx -O3 %s -o %t && %run %t 2>&1 | FileCheck %
> s
> > -//
> > +// RUN: %tool_options=symbolize_inline_frames=false %run %t
> 2>&1 | FileCheck %s --check-prefix=NOINLINE
> > +
>
> Hi Alexey,
>
> This one fails for me, in a local build, on ppc64*. The
> output from the
> run portion ( that gets passed into FileCheck ) looks the
> same,
> regardless of the ASAN_OPTIONS=symbolize_inline_frames=*
> value used.
> So I'd guess this is an architecture limitation for the
> moment, but
> thats not obvious from the other changes... Am I missing
> something
> else in my environment here? (should be all fresh build,
> etc).
>
> > /home/willschm/llvm_build/native/llvm.cmake/./bin/clang
> --driver-mode=g++ -gline-tables-only -fsanitize=address
> -O3 /home/willschm/llvm/projects/compiler-rt/test/sanitizer_common/TestCases/print-stack-trace.cc -o /home/willschm/llvm_build/native/llvm.cmake/projects/compiler-rt/test/sanitizer_common/asan/Output/print-stack-trace.cc.tmp
>
> >
> ASAN_OPTIONS=symbolize_inline_frames=true /home/willschm/llvm_build/native/llvm.cmake/projects/compiler-rt/test/sanitizer_common/asan/Output/print-stack-trace.cc.tmp
> #0 0x100c07dc in
> __sanitizer_print_stack_trace /home/willschm/llvm/projects/compiler-rt/lib/asan/asan_stack.cc:23
> #1 0x100def70 in
> FooBarBaz /home/willschm/llvm/projects/compiler-rt/test/sanitizer_common/TestCases/print-stack-trace.cc:12:3
> #2 0x100def70 in
> main /home/willschm/llvm/projects/compiler-rt/test/sanitizer_common/TestCases/print-stack-trace.cc:16
> #3 0x1000003b4cfc in
> generic_start_main /build/buildd/eglibc-2.19/csu/../csu/libc-start.c:287
>
> Thanks,
> -Will
>
>
> > // Not yet implemented for TSan.
> > //
> https://code.google.com/p/address-sanitizer/issues/detail?id=243
> > // XFAIL: tsan
> >
> > #include <sanitizer/common_interface_defs.h>
> >
> > -void FooBarBaz() {
> > +static inline void FooBarBaz() {
> > __sanitizer_print_stack_trace();
> > }
> >
> > @@ -16,5 +17,8 @@ int main() {
> > return 0;
> > }
> > // CHECK: {{ #0 0x.* in __sanitizer_print_stack_trace}}
> > -// CHECK: {{ #1 0x.* in
> FooBarBaz(\(\))? .*print-stack-trace.cc:11}}
> > -// CHECK: {{ #2 0x.* in main.*print-stack-trace.cc:15}}
> > +// CHECK: {{ #1 0x.* in
> FooBarBaz(\(\))? .*print-stack-trace.cc:12}}
> > +// CHECK: {{ #2 0x.* in main.*print-stack-trace.cc:16}}
> > +
> > +// NOINLINE: #0 0x{{.*}} in __sanitizer_print_stack_trace
> > +// NOINLINE: #1 0x{{.*}} in
> main{{.*}}print-stack-trace.cc:12
>
>
>
>
>
>
>
>
>
>
>
> --
> Alexey Samsonov
> vonosmas at gmail.com
More information about the llvm-commits
mailing list