brintos

brintos / llvm-project-archived public Read only

0
0
Text · 713 B · 9c8ab46 Raw
31 lines · cpp
1// Checks that the debugging API returns correct shadow scale and offset.2// RUN: %clangxx_asan -O %s -o %t3// RUN: %env_asan_opts=verbosity=1 %run %t 2>&1 | FileCheck %s4 5#include <sanitizer/asan_interface.h>6#include <stdio.h>7#include <stdlib.h>8 9#if _WIN6410#define PTR "%llx"11#else12#define PTR "%lx"13#endif14 15// printed because of verbosity=116// CHECK: SHADOW_SCALE: [[SCALE:[0-9]+]]17// CHECK: SHADOW_OFFSET: 0x{{0*}}[[OFFSET:[0-9a-f]+]]18 19int main() {20  size_t scale, offset;21  __asan_get_shadow_mapping(&scale, &offset);22 23  fprintf(stderr, "scale: %d\n", (int)scale);24  fprintf(stderr, "offset: 0x" PTR "\n", (void*)offset);25 26  // CHECK: scale: [[SCALE]]27  // CHECK: offset: 0x{{0*}}[[OFFSET]]28 29  return 0;30}31