Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 1 | // Checks that the debugging API returns correct shadow scale and offset. |
| 2 | // RUN: %clangxx_asan -O %s -o %t |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 3 | // RUN: %env_asan_opts=verbosity=1 %run %t 2>&1 | FileCheck %s |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 4 | |
| 5 | #include <sanitizer/asan_interface.h> |
| 6 | #include <stdio.h> |
| 7 | #include <stdlib.h> |
| 8 | |
| 9 | // printed because of verbosity=1 |
| 10 | // CHECK: SHADOW_SCALE: [[SCALE:[0-9]+]] |
Pirama Arumuga Nainar | cdce50b | 2015-07-01 12:26:56 -0700 | [diff] [blame] | 11 | // CHECK: SHADOW_OFFSET: [[OFFSET:0x[0-9a-f]+]] |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 12 | |
| 13 | int main() { |
| 14 | size_t scale, offset; |
| 15 | __asan_get_shadow_mapping(&scale, &offset); |
| 16 | |
Pirama Arumuga Nainar | cdce50b | 2015-07-01 12:26:56 -0700 | [diff] [blame] | 17 | fprintf(stderr, "scale: %d\n", (int)scale); |
| 18 | fprintf(stderr, "offset: 0x%lx\n", offset); |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 19 | |
| 20 | // CHECK: scale: [[SCALE]] |
| 21 | // CHECK: offset: [[OFFSET]] |
| 22 | |
| 23 | return 0; |
| 24 | } |