diff options
author | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-02-11 12:17:21 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-02-17 14:20:21 +1100 |
commit | c398b5bde673f311072bbd814e8dbb20785258e1 (patch) | |
tree | 93be9a5de12d2b28d64cf9545485c308f501fd98 | |
parent | d0b91f6c8b4f159fc05eca21fceff1bf98fabd51 (diff) | |
download | skiboot-c398b5bde673f311072bbd814e8dbb20785258e1.zip skiboot-c398b5bde673f311072bbd814e8dbb20785258e1.tar.gz skiboot-c398b5bde673f311072bbd814e8dbb20785258e1.tar.bz2 |
Make abort() update sp attn area (like assert does)
Gives better diagnostics in error logs/dumps
cherry-picked from cbf0e24e6734ceb52bbefdb02fb9f35f180dad11
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | core/utils.c | 4 | ||||
-rw-r--r-- | libc/include/stdlib.h | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/core/utils.c b/core/utils.c index 71f3842..9ab98c9 100644 --- a/core/utils.c +++ b/core/utils.c @@ -22,10 +22,10 @@ void assert_fail(const char *msg) { prlog(PR_EMERG, "Assert fail: %s\n", msg); - abort(); + _abort(); } -void abort(void) +void _abort(void) { static bool in_abort = false; unsigned long hid0; diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h index 4ab2825..68ca386 100644 --- a/libc/include/stdlib.h +++ b/libc/include/stdlib.h @@ -25,6 +25,12 @@ unsigned long int strtoul(const char *nptr, char **endptr, int base); long int strtol(const char *nptr, char **endptr, int base); int rand(void); -void __attribute__((noreturn)) abort(void); +void __attribute__((noreturn)) _abort(void); +#define abort() do { \ + update_sp_attn_area("abort():" __FILE__ \ + ":" stringify(__LINE__)); \ + _abort(); \ + } while(0) + #endif |