[Skiboot] [PATCH] Make abort() update sp attn area (like assert does)

Stewart Smith stewart at linux.vnet.ibm.com
Wed Feb 11 12:19:57 AEDT 2015


Why not this patch instead? If no objections, I'll apply it. I do think
we could probably change some of our abort()s to be the assert of the
condition that fails though.

Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 core/utils.c          |    4 ++--
 libc/include/stdlib.h |    8 +++++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/core/utils.c b/core/utils.c
index 1a81ae2..9c94ecc 100644
--- a/core/utils.c
+++ b/core/utils.c
@@ -26,10 +26,10 @@ unsigned long __stack_chk_guard = 0xdeadf00dbaad300d;
 void __noreturn assert_fail(const char *msg)
 {
 	prlog(PR_EMERG, "Assert fail: %s\n", msg);
-	abort();
+	_abort();
 }
 
-void __noreturn abort(void)
+void __noreturn _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
-- 
1.7.10.4



More information about the Skiboot mailing list