NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: What is the suggested way to use a C compiler with sanitizers?
In article <527159918.27358.1480598518733.JavaMail.ngmail%webmail18.arcor-online.net@localhost>,
Carsten Kunze <carsten.kunze%arcor.de@localhost> wrote:
>Hello,
>
>if one wants to use the sanitizer features of the C compiler, what is
>the suggested way?
>
>If I e.g. compile and link with options
>
>-O2 -g -O0 -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wall
>-Wextra -Wsign-compare -Wcast-align -Wcast-qual -Wmissing-prototypes
>-Wunused-parameter -Wunused-function -Wshadow -fno-common
>-fsanitize=address -fsanitize=undefined -fsanitize=float-divide-by-zero
>-fsanitize=float-cast-overflow
>
>(-O2 is from CFLAGS which should be reset by -O0)
>
>I get something like
>
>ui.c:2017:11: runtime error: member access within misaligned address
>0xbebebebebebebebe for type 'struct filediff', which requires 8 byte
>alignment
>0xbebebebebebebebe: note: pointer points here
>test
><memory cannot be printed>
>
>ASAN:SIGSEGV
>
>=================================================================
>
>==1372==ERROR: AddressSanitizer: SEGV on unknown address 0x72d42a8a5000
>(pc 0x0000004229c5 bp 0x7f7fff49c710 sp 0x7f7fff49c460 T0)
> #0 0x4229c4 (<unknown module>)
>
> #1 0x421dd7 (<unknown module>)
>
> #2 0x44b9be (<unknown module>)
>
> #3 0x42a329 (<unknown module>)
>
> #4 0x4488ad (<unknown module>)
>
> #5 0x413a90 (<unknown module>)
>
> #6 0x410e02 (<unknown module>)
>
> #7 0x4054ae (<unknown module>)
>
> #8 0x4044ba (<unknown module>)
>
>
>
>AddressSanitizer can not provide additional info.
>
>SUMMARY: AddressSanitizer: SEGV ??:0 ??
>
>==1372==ABORTING
>
>on errors. What needs to be configured to make the symbolizer work?
>(Binary is not stripped.)
You need an external symbolizer... By default it runs llvm-symbolizer,
but you can make it use addr2line by setting:
ASAN_OPTIONS=allow_addr2line=true
But then, it looks for libasan.so.1 in the current working directory, and
you can ln -s /usr/lib/libasan.so.1 ., after that it finds the symbols in
the library but not in the main program, saying "unknown module".
christos
Home |
Main Index |
Thread Index |
Old Index