Add hooking functionality

This allows us to hook chosen functions and do interesting things there (in
particular: reentrancy checking).
This commit is contained in:
David Goldblatt
2017-03-28 17:30:54 -07:00
committed by David Goldblatt
parent 36bd90b962
commit 0a0fcd3e6a
19 changed files with 183 additions and 11 deletions

View File

@@ -45,6 +45,7 @@ extern "C" {
# define JEMALLOC_MANGLE
# include "jemalloc/internal/jemalloc_internal.h"
/******************************************************************************/
/*
* For integration tests, expose the public jemalloc interfaces, but only
@@ -68,6 +69,7 @@ static const bool config_debug =
# define JEMALLOC_N(n) @private_namespace@##n
# include "jemalloc/internal/private_namespace.h"
# include "jemalloc/internal/hooks.h"
/* Hermetic headers. */
# include "jemalloc/internal/assert.h"

View File

@@ -310,6 +310,9 @@ label_test_end: \
#define test(...) \
p_test(__VA_ARGS__, NULL)
#define test_no_reentrancy(...) \
p_test_no_reentrancy(__VA_ARGS__, NULL)
#define test_no_malloc_init(...) \
p_test_no_malloc_init(__VA_ARGS__, NULL)
@@ -321,11 +324,14 @@ label_test_end: \
} \
} while (0)
bool test_is_reentrant();
void test_skip(const char *format, ...) JEMALLOC_FORMAT_PRINTF(1, 2);
void test_fail(const char *format, ...) JEMALLOC_FORMAT_PRINTF(1, 2);
/* For private use by macros. */
test_status_t p_test(test_t *t, ...);
test_status_t p_test_no_reentrancy(test_t *t, ...);
test_status_t p_test_no_malloc_init(test_t *t, ...);
void p_test_init(const char *name);
void p_test_fini(void);