| Alexey Samsonov | e5f5895 | 2012-06-04 13:50:10 +0000 | [diff] [blame] | 1 | //===-- asan_stack.cc -----------------------------------------------------===// |
| Kostya Serebryany | 1e172b4 | 2011-11-30 01:07:02 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file is a part of AddressSanitizer, an address sanity checker. |
| 11 | // |
| 12 | // Code for ASan stack trace. |
| 13 | //===----------------------------------------------------------------------===// |
| Kostya Serebryany | 1b5ea8f | 2012-08-28 14:11:57 +0000 | [diff] [blame] | 14 | #include "asan_flags.h" |
| Kostya Serebryany | 1e172b4 | 2011-11-30 01:07:02 +0000 | [diff] [blame] | 15 | #include "asan_stack.h" |
| Chandler Carruth | d865fec | 2012-08-29 02:27:54 +0000 | [diff] [blame] | 16 | #include "sanitizer/asan_interface.h" |
| Alexey Samsonov | 5f2fe37 | 2012-06-04 11:20:17 +0000 | [diff] [blame] | 17 | |
| Kostya Serebryany | 1e172b4 | 2011-11-30 01:07:02 +0000 | [diff] [blame] | 18 | namespace __asan { |
| 19 | |
| Kostya Serebryany | cc34722 | 2012-08-28 13:49:49 +0000 | [diff] [blame] | 20 | void PrintStack(StackTrace *stack) { |
| 21 | stack->PrintStack(stack->trace, stack->size, flags()->symbolize, |
| Alexey Samsonov | 1ca5357 | 2012-10-02 12:11:17 +0000 | [diff] [blame] | 22 | flags()->strip_path_prefix, __asan_symbolize); |
| Kostya Serebryany | cc34722 | 2012-08-28 13:49:49 +0000 | [diff] [blame] | 23 | } |
| 24 | |
| Kostya Serebryany | 1e172b4 | 2011-11-30 01:07:02 +0000 | [diff] [blame] | 25 | } // namespace __asan |
| Alexey Samsonov | c93d3e2 | 2012-08-22 13:31:37 +0000 | [diff] [blame] | 26 | |
| 27 | // ------------------ Interface -------------- {{{1 |
| Alexey Samsonov | c93d3e2 | 2012-08-22 13:31:37 +0000 | [diff] [blame] | 28 | |
| Alexey Samsonov | 1ca5357 | 2012-10-02 12:11:17 +0000 | [diff] [blame] | 29 | // Provide default implementation of __asan_symbolize that does nothing |
| 30 | // and may be overriden by user if he wants to use his own symbolization. |
| 31 | // ASan on Windows has its own implementation of this. |
| 32 | #ifndef _WIN32 |
| 33 | SANITIZER_WEAK_ATTRIBUTE SANITIZER_INTERFACE_ATTRIBUTE NOINLINE |
| 34 | bool __asan_symbolize(const void *pc, char *out_buffer, int out_size) { |
| 35 | return false; |
| Alexey Samsonov | c93d3e2 | 2012-08-22 13:31:37 +0000 | [diff] [blame] | 36 | } |
| Alexey Samsonov | 1ca5357 | 2012-10-02 12:11:17 +0000 | [diff] [blame] | 37 | #endif |