OLD | NEW |
1 //===- subzero/runtime/szrt_asan.c - AddressSanitizer Runtime -----*- C -*-===// | 1 //===- subzero/runtime/szrt_asan.c - AddressSanitizer Runtime -----*- C -*-===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 /// | 9 /// |
10 /// \file | 10 /// \file |
11 /// \brief Provides the AddressSanitizer runtime. | 11 /// \brief Provides the AddressSanitizer runtime. |
12 /// | 12 /// |
13 /// Exposes functions for initializing the shadow memory region and managing it | 13 /// Exposes functions for initializing the shadow memory region and managing it |
14 /// on loads, stores, and allocations. | 14 /// on loads, stores, and allocations. |
15 /// | 15 /// |
16 //===----------------------------------------------------------------------===// | 16 //===----------------------------------------------------------------------===// |
17 | 17 |
18 #include <stdio.h> | 18 #include <stddef.h> |
| 19 #include <stdlib.h> |
19 | 20 |
20 // TODO(tlively): Define and implement this library | 21 // TODO(tlively): Define and implement this library |
21 void __asan_init(void) { | 22 void __asan_init(void) { |
22 printf("Set up shadow memory here\n"); | 23 printf("Set up shadow memory here\n"); |
23 return; | 24 return; |
24 } | 25 } |
25 | 26 |
26 void __asan_check(void *addr, int size) { | 27 void __asan_check(void *addr, int size) { |
27 printf("Check access of %p of size %d\n", addr, size); | 28 printf("Check %d bytes at %p\n", size, addr); |
28 return; | 29 return; |
29 } | 30 } |
| 31 |
| 32 void *__asan_malloc(size_t size) { |
| 33 printf("malloc() called with size %d\n", size); |
| 34 return malloc(size); |
| 35 } |
| 36 |
| 37 void __asan_free(void *ptr) { |
| 38 printf("free() called on %p\n", ptr); |
| 39 free(ptr); |
| 40 } |
OLD | NEW |