Use the abort function stored in the global data structure.

Signed-off-by: Mike Holmes <[email protected]>
---
 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(-)

diff --git a/include/odp/api/init.h b/include/odp/api/init.h
index 4b9296b..c5b4e9b 100644
--- a/include/odp/api/init.h
+++ b/include/odp/api/init.h
@@ -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
diff --git a/platform/linux-generic/include/odp_debug_internal.h 
b/platform/linux-generic/include/odp_debug_internal.h
index 20b6fcc..2b643eb 100644
--- a/platform/linux-generic/include/odp_debug_internal.h
+++ b/platform/linux-generic/include/odp_debug_internal.h
@@ -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)
 
 /**
diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index 608aafd..9a6e29d 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -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);
diff --git a/platform/linux-generic/odp_init.c 
b/platform/linux-generic/odp_init.c
index 6db05b3..e91e910 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -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)
-- 
2.1.0


_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to