asan/tsan: rename interceptors from __xsan_xxx to __interceptor_xxx
llvm-svn: 157569
This commit is contained in:
parent
ebdf670ae7
commit
bd310f02a5
|
@ -2,10 +2,10 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
extern "C" void *__xsan_malloc(size_t size);
|
extern "C" void *__interceptor_malloc(size_t size);
|
||||||
extern "C" void *malloc(size_t size) {
|
extern "C" void *malloc(size_t size) {
|
||||||
write(2, "malloc call\n", sizeof("malloc call\n") - 1);
|
write(2, "malloc call\n", sizeof("malloc call\n") - 1);
|
||||||
return __xsan_malloc(size);
|
return __interceptor_malloc(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
extern "C" long __xsan_strtol(const char *nptr, char **endptr, int base);
|
extern "C" long __interceptor_strtol(const char *nptr, char **endptr, int base);
|
||||||
extern "C" long strtol(const char *nptr, char **endptr, int base) {
|
extern "C" long strtol(const char *nptr, char **endptr, int base) {
|
||||||
fprintf(stderr, "my_strtol_interceptor\n");
|
fprintf(stderr, "my_strtol_interceptor\n");
|
||||||
return __xsan_strtol(nptr, endptr, base);
|
return __interceptor_strtol(nptr, endptr, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
|
@ -65,8 +65,8 @@
|
||||||
// with same names in our library and then obtain the real function pointers
|
// with same names in our library and then obtain the real function pointers
|
||||||
// using dlsym().
|
// using dlsym().
|
||||||
// There is one complication. A user may also intercept some of the functions
|
// There is one complication. A user may also intercept some of the functions
|
||||||
// we intercept. To resolve this we declare our interceptors with __xsan_
|
// we intercept. To resolve this we declare our interceptors with __interceptor_
|
||||||
// prefix, and then make actual interceptors weak aliases to __xsan_
|
// prefix, and then make actual interceptors weak aliases to __interceptor_
|
||||||
// functions.
|
// functions.
|
||||||
// This is not so on Mac OS, where the two-level namespace makes
|
// This is not so on Mac OS, where the two-level namespace makes
|
||||||
// our replacement functions invisible to other libraries. This may be overcomed
|
// our replacement functions invisible to other libraries. This may be overcomed
|
||||||
|
@ -93,12 +93,12 @@
|
||||||
# endif
|
# endif
|
||||||
# define DECLARE_WRAPPER(ret_type, convention, func, ...)
|
# define DECLARE_WRAPPER(ret_type, convention, func, ...)
|
||||||
#else
|
#else
|
||||||
# define WRAP(x) __xsan_ ## x
|
# define WRAP(x) __interceptor_ ## x
|
||||||
# define WRAPPER_NAME(x) "__xsan_" #x
|
# define WRAPPER_NAME(x) "__interceptor_" #x
|
||||||
# define INTERCEPTOR_ATTRIBUTE __attribute__((visibility("default")))
|
# define INTERCEPTOR_ATTRIBUTE __attribute__((visibility("default")))
|
||||||
# define DECLARE_WRAPPER(ret_type, convention, func, ...) \
|
# define DECLARE_WRAPPER(ret_type, convention, func, ...) \
|
||||||
extern "C" ret_type convention func(__VA_ARGS__) \
|
extern "C" ret_type convention func(__VA_ARGS__) \
|
||||||
__attribute__((weak, alias("__xsan_" #func), visibility("default")))
|
__attribute__((weak, alias("__interceptor_" #func), visibility("default")))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PTR_TO_REAL(x) real_##x
|
#define PTR_TO_REAL(x) real_##x
|
||||||
|
|
|
@ -32,7 +32,7 @@ bool WEAK OnReport(const ReportDesc *rep, bool suppressed) {
|
||||||
static void StackStripMain(ReportStack *stack) {
|
static void StackStripMain(ReportStack *stack) {
|
||||||
ReportStack *last_frame = 0;
|
ReportStack *last_frame = 0;
|
||||||
ReportStack *last_frame2 = 0;
|
ReportStack *last_frame2 = 0;
|
||||||
const char *prefix = "__xsan_";
|
const char *prefix = "__interceptor_";
|
||||||
uptr prefix_len = internal_strlen(prefix);
|
uptr prefix_len = internal_strlen(prefix);
|
||||||
const char *path_prefix = flags()->strip_path_prefix;
|
const char *path_prefix = flags()->strip_path_prefix;
|
||||||
uptr path_prefix_len = internal_strlen(path_prefix);
|
uptr path_prefix_len = internal_strlen(path_prefix);
|
||||||
|
|
Loading…
Reference in New Issue