diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-01-27 14:02:50 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-02-12 09:31:27 +0100 |
commit | 68f36d144adfa1294f026bdf2d348c22365543fc (patch) | |
tree | cb0aa1bdd384583752af252b0c693fb0a4badc89 /cpukit | |
parent | bsp/lpc32xx: Add BSP_USB_OTG_TRANSCEIVER_VBUS (diff) | |
download | rtems-68f36d144adfa1294f026bdf2d348c22365543fc.tar.bz2 |
score: Add and use rtems_assert_context
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/libcsupport/src/__assert.c | 9 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/fatal.h | 10 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/interr.h | 4 |
3 files changed, 21 insertions, 2 deletions
diff --git a/cpukit/libcsupport/src/__assert.c b/cpukit/libcsupport/src/__assert.c index be0fa6c2e9..d29ea0b7e0 100644 --- a/cpukit/libcsupport/src/__assert.c +++ b/cpukit/libcsupport/src/__assert.c @@ -34,6 +34,13 @@ void __assert_func( const char *failedexpr ) { + rtems_assert_context assert_context = { + .file = file, + .line = line, + .function = func, + .failed_expression = failedexpr + }; + printk("assertion \"%s\" failed: file \"%s\", line %d%s%s\n", failedexpr, file, @@ -41,7 +48,7 @@ void __assert_func( (func) ? ", function: " : "", (func) ? func : "" ); - rtems_fatal( RTEMS_FATAL_SOURCE_ASSERT, (rtems_fatal_code) func ); + rtems_fatal( RTEMS_FATAL_SOURCE_ASSERT, (rtems_fatal_code) &assert_context ); } #endif diff --git a/cpukit/sapi/include/rtems/fatal.h b/cpukit/sapi/include/rtems/fatal.h index 66236462d8..47bf74f279 100644 --- a/cpukit/sapi/include/rtems/fatal.h +++ b/cpukit/sapi/include/rtems/fatal.h @@ -34,6 +34,16 @@ extern "C" { /**@{**/ /** + * @brief Assert context. + */ +typedef struct { + const char *file; + int line; + const char *function; + const char *failed_expression; +} rtems_assert_context; + +/** * @brief Exception frame. */ typedef CPU_Exception_frame rtems_exception_frame; diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h index 2580c72253..a047ca6766 100644 --- a/cpukit/score/include/rtems/score/interr.h +++ b/cpukit/score/include/rtems/score/interr.h @@ -88,7 +88,9 @@ typedef enum { /** * @brief Fatal source of assert(). * - * The fatal code is the pointer value of the function string. + * The fatal code is the pointer value of the assert context. + * + * @see rtems_assert_context. */ RTEMS_FATAL_SOURCE_ASSERT, |