@@ -91,6 +91,9 @@ void odp_override_abort(void) ODP_NORETURN;
/** Replaceable logging function */
typedef int (*odp_log_func_t)(odp_log_level_e level, const char *fmt, ...);
+/** Replaceable abort function */
+typedef void (*odp_abort_func_t)(void) ODP_NORETURN;
+
/** ODP initialization data.
* Data that is required to initialize the ODP API with the
* application specific data such as specifying a logging callback, the log
@@ -54,7 +54,7 @@ extern "C" {
#define ODP_ASSERT(cond, msg) \
do { if ((ODP_DEBUG == 1) && (!(cond))) { \
ODP_ERR("%s\n", msg); \
- odp_override_abort(); } \
+ odp_global_data.abort_fn(); } \
} while (0)
/**
@@ -86,7 +86,7 @@ extern "C" {
#define ODP_ABORT(fmt, ...) \
do { \
ODP_LOG(ODP_LOG_ABORT, fmt, ##__VA_ARGS__); \
- odp_override_abort(); \
+ odp_global_data.abort_fn(); \
} while (0)
/**
@@ -22,6 +22,7 @@ extern "C" {
struct odp_global_data {
odp_log_func_t log_fn;
+ odp_abort_func_t abort_fn;
} odp_global_data;
int odp_system_info_init(void);
@@ -14,6 +14,7 @@ int odp_init_global(odp_init_t *params ODP_UNUSED,
odp_platform_init_t *platform_params ODP_UNUSED)
{
odp_global_data.log_fn = odp_override_log;
+ odp_global_data.abort_fn = odp_override_abort;
if (params != NULL) {
if (params->log_fn != NULL)
Use the abort function stored in the global data structure. Signed-off-by: Mike Holmes <mike.holmes@linaro.org> --- include/odp/api/init.h | 3 +++ platform/linux-generic/include/odp_debug_internal.h | 4 ++-- platform/linux-generic/include/odp_internal.h | 1 + platform/linux-generic/odp_init.c | 1 + 4 files changed, 7 insertions(+), 2 deletions(-)