On Mon, Jul 14, 2014 at 12:09 PM, Shiny Teng <[email protected]> wrote:
> Hi experts,
> I'm using llvm3.4.1 on OSX 10.9.3.
> My codes,
>
> // longstack.cc
> int* a;
> void foo(int n)
> {
> a[n]++;
> foo(++n);
> }
> int main(int argc, char** argv) {
> a = new int[30];
> foo(0);
> }
>
> And it builds,
> /usr/local/Cellar/llvm34/3.4.1_1/bin/clang-3.4 -O0 -g -fsanitize=address
> longstack.cc -o ./longstack
>
> Only thing I set is,
> export ASAN_SYMBOLIZER_PATH=/usr/local/Cellar/
>
> It reports,
>
> =================================================================
> ==49571==ERROR: AddressSanitizer: heap-buffer-overflow on address
> 0x60c00000bff8 at pc 0x10cffbb69 bp 0x7fff52c02a70 sp 0x7fff52c02a68
> READ of size 4 at 0x60c00000bff8 thread T0
> #0 0x10cffbb68 in foo(int) /Users/tengxiang/Test
> Projects/clang/longstack.cc:5
> #1 0x10cffbb8d in foo(int) /Users/tengxiang/Test
> Projects/clang/longstack.cc:6
> ...
> #30 0x10cffbb8d in foo(int) /Users/tengxiang/Test
> Projects/clang/longstack.cc:6
> #31 0x10cffbdaa in main /Users/tengxiang/Test
> Projects/clang/longstack.cc:11
> #32 0x7fff8d8ef5fc in start (/usr/lib/system/libdyld.dylib+0x35fc)
> #33 0x0
>
> ...
> ==49571==ABORTING
>
> Please see the callstack foo(int) doesn't tell what's the inbound
> parameter int's value.
>
> As comparison, I debugged it with lldb, it shows call stack with "bt".
>
>
> ...
> frame #258473: 0x0000000100000f33 longstacknormal`foo(n=32) + 51 at
> longstack.cc:6
> ...
> frame #258504: 0x0000000100000f33 longstacknormal`foo(n=1) + 51 at
> longstack.cc:6
> frame #258505: 0x0000000100000f72 longstacknormal`main(argc=2,
> argv=0x00007fff5fbffba0) + 50 at longstack.cc:11
> frame #258506: 0x00007fff8d8ef5fd libdyld.dylib`start + 1
>
> Please see foo(n=32).
>
> My question is, did I miss anything or is it possible to get things like
> that in ASAN report?
>
asan currently can not do this, sorry.
Such functionality is far from trivial and we are not planing to implement
it.
However, you can attach gdb or lldb to asan-ified process when it has
reported an error and get a more complete stack trace.
https://code.google.com/p/address-sanitizer/wiki/AddressSanitizer#gdb
If you think that such functionality in asan is worth the effort, feel free
to file a bug report:
https://code.google.com/p/address-sanitizer/issues/list
Thanks!
--kcc
> Regards,
> -xiang
>
> --
> You received this message because you are subscribed to the Google Groups
> "address-sanitizer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.