Pirama Arumuga Nainar | 7c91505 | 2015-04-08 08:58:29 -0700 | [diff] [blame] | 1 | // Check that the `atos` symbolizer works. |
| 2 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 3 | // RUN: %clangxx_asan -O0 %s -o %t |
| 4 | // RUN: %env_asan_opts=verbosity=2 ASAN_SYMBOLIZER_PATH=$(which atos) not %run %t 2>&1 | FileCheck %s |
Pirama Arumuga Nainar | 7c91505 | 2015-04-08 08:58:29 -0700 | [diff] [blame] | 5 | |
| 6 | #include <stdlib.h> |
| 7 | #include <string.h> |
| 8 | int main(int argc, char **argv) { |
| 9 | char *x = (char*)malloc(10 * sizeof(char)); |
| 10 | memset(x, 0, 10); |
| 11 | int res = x[argc]; |
| 12 | free(x); |
| 13 | free(x + argc - 1); // BOOM |
| 14 | // CHECK: AddressSanitizer: attempting double-free{{.*}}in thread T0 |
| 15 | // CHECK: Using atos at user-specified path: |
| 16 | // CHECK: #0 0x{{.*}} in {{.*}}free |
| 17 | // CHECK: #1 0x{{.*}} in main {{.*}}atos-symbolizer.cc:[[@LINE-4]] |
| 18 | // CHECK: freed by thread T0 here: |
| 19 | // CHECK: #0 0x{{.*}} in {{.*}}free |
| 20 | // CHECK: #1 0x{{.*}} in main {{.*}}atos-symbolizer.cc:[[@LINE-8]] |
| 21 | // CHECK: allocated by thread T0 here: |
| 22 | // CHECK: atos-symbolizer.cc:[[@LINE-13]] |
| 23 | return res; |
| 24 | } |