ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
asan_interface.h
Go to the documentation of this file.
1 //===-- sanitizer/asan_interface.h ------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file is a part of AddressSanitizer (ASan).
10 //
11 // Public interface header.
12 //===----------------------------------------------------------------------===//
13 #ifndef SANITIZER_ASAN_INTERFACE_H
14 #define SANITIZER_ASAN_INTERFACE_H
15 
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
34 void __asan_poison_memory_region(void const volatile *addr, size_t size);
35 
48 void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
49 
50 // Macros provided for convenience.
51 #if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
59 #define ASAN_POISON_MEMORY_REGION(addr, size) \
60  __asan_poison_memory_region((addr), (size))
61 
69 #define ASAN_UNPOISON_MEMORY_REGION(addr, size) \
70  __asan_unpoison_memory_region((addr), (size))
71 #else
72 #define ASAN_POISON_MEMORY_REGION(addr, size) \
73  ((void)(addr), (void)(size))
74 #define ASAN_UNPOISON_MEMORY_REGION(addr, size) \
75  ((void)(addr), (void)(size))
76 #endif
77 
88 int __asan_address_is_poisoned(void const volatile *addr);
89 
98 void *__asan_region_is_poisoned(void *beg, size_t size);
99 
105 void __asan_describe_address(void *addr);
106 
115 
124 
133 
142 
151 
159 
167 
175 
195 const char *__asan_locate_address(void *addr, char *name, size_t name_size,
196  void **region_address, size_t *region_size);
197 
210 size_t __asan_get_alloc_stack(void *addr, void **trace, size_t size,
211  int *thread_id);
212 
225 size_t __asan_get_free_stack(void *addr, void **trace, size_t size,
226  int *thread_id);
227 
233 void __asan_get_shadow_mapping(size_t *shadow_scale, size_t *shadow_offset);
234 
245 void __asan_report_error(void *pc, void *bp, void *sp,
246  void *addr, int is_write, size_t access_size);
247 
248 // Deprecated. Call __sanitizer_set_death_callback instead.
249 void __asan_set_death_callback(void (*callback)(void));
250 
256 void __asan_set_error_report_callback(void (*callback)(const char *));
257 
263 void __asan_on_error(void);
264 
268 
276 const char* __asan_default_options(void);
277 
278 // The following two functions facilitate garbage collection in presence of
279 // ASan's fake stack.
280 
289 
308 void *__asan_addr_is_in_fake_stack(void *fake_stack, void *addr, void **beg,
309  void **end);
310 
317 
321 
322 #ifdef __cplusplus
323 } // extern "C"
324 #endif
325 
326 #endif // SANITIZER_ASAN_INTERFACE_H
static void trace(ETISS_CPU *cpu, etiss::uint64 addr, etiss::uint32 len, bool isWrite, bool toFile, std::ofstream &file)
void __asan_set_error_report_callback(void(*callback)(const char *))
Sets the callback function to be called during ASan error reporting.
void * __asan_region_is_poisoned(void *beg, size_t size)
Checks if a region is poisoned.
int __asan_report_present(void)
Checks if an error has been or is being reported (useful for calling from the debugger to get informa...
const char * __asan_default_options(void)
User-provided default option settings.
void * __asan_get_report_sp(void)
Gets the SP (stack pointer) register value of an ASan error (useful for calling from the debugger).
void * __asan_get_report_bp(void)
Gets the BP (base pointer) register value of an ASan error (useful for calling from the debugger).
void * __asan_get_report_pc(void)
Gets the PC (program counter) register value of an ASan error (useful for calling from the debugger).
size_t __asan_get_free_stack(void *addr, void **trace, size_t size, int *thread_id)
Gets the free stack trace and thread ID for a heap address (useful for calling from the debugger).
void * __asan_get_current_fake_stack(void)
Gets an opaque handler to the current thread's fake stack.
size_t __asan_get_report_access_size(void)
Gets access size of an ASan error (useful for calling from the debugger).
const char * __asan_locate_address(void *addr, char *name, size_t name_size, void **region_address, size_t *region_size)
Gets information about a pointer (useful for calling from the debugger).
void __asan_describe_address(void *addr)
Describes an address (useful for calling from the debugger).
size_t __asan_get_alloc_stack(void *addr, void **trace, size_t size, int *thread_id)
Gets the allocation stack trace and thread ID for a heap address (useful for calling from the debugge...
void * __asan_addr_is_in_fake_stack(void *fake_stack, void *addr, void **beg, void **end)
Checks if an address belongs to a given fake stack.
const char * __asan_get_report_description(void)
Gets the bug description of an ASan error (useful for calling from a debugger).
int __asan_get_report_access_type(void)
Gets access type of an ASan error (useful for calling from the debugger).
void __asan_set_death_callback(void(*callback)(void))
void __asan_print_accumulated_stats(void)
Prints accumulated statistics to stderr (useful for calling from the debugger).
void __asan_get_shadow_mapping(size_t *shadow_scale, size_t *shadow_offset)
Gets the current shadow memory mapping (useful for calling from the debugger).
void __asan_handle_no_return(void)
Performs shadow memory cleanup of the current thread's stack before a function marked with the [[nore...
void __asan_poison_memory_region(void const volatile *addr, size_t size)
Marks a memory region ([addr, addr+size)) as unaddressable.
void __asan_unpoison_memory_region(void const volatile *addr, size_t size)
Marks a memory region ([addr, addr+size)) as addressable.
void __asan_on_error(void)
User-provided callback on ASan errors.
int __asan_update_allocation_context(void *addr)
Update allocation stack trace for the given allocation to the current stack trace.
int __asan_address_is_poisoned(void const volatile *addr)
Checks if an address is poisoned.
void __asan_report_error(void *pc, void *bp, void *sp, void *addr, int is_write, size_t access_size)
This is an internal function that is called to report an error.
void * __asan_get_report_address(void)
Gets the address of the report buffer of an ASan error (useful for calling from the debugger).