[U-Boot] [PATCH v5 08/10] sandbox: Add support for calling abort()

Alexander Graf agraf at suse.de
Fri Jun 22 12:44:16 UTC 2018


From: Simon Glass <sjg at chromium.org>

This function is useful to signal that the application needs to exit
immediate. It can be caught with a debugger (e.g. gdb). Add a stub for it
so that it can be called from within sandbox when an internal error
occurs.

Signed-off-by: Simon Glass <sjg at chromium.org>
Signed-off-by: Alexander Graf <agraf at suse.de>
---
 arch/sandbox/cpu/os.c | 5 +++++
 include/os.h          | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index 3067503d51..9fbcb9ef92 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -631,3 +631,8 @@ void os_localtime(struct rtc_time *rt)
 	rt->tm_yday = tm->tm_yday;
 	rt->tm_isdst = tm->tm_isdst;
 }
+
+void os_abort(void)
+{
+	abort();
+}
diff --git a/include/os.h b/include/os.h
index 64e89a06c9..8fb9d309d0 100644
--- a/include/os.h
+++ b/include/os.h
@@ -330,4 +330,9 @@ int os_spl_to_uboot(const char *fname);
  */
 void os_localtime(struct rtc_time *rt);
 
+/**
+ * os_abort() - Raise SIGABRT to exit sandbox (e.g. to debugger)
+ */
+void os_abort(void);
+
 #endif
-- 
2.12.3



More information about the U-Boot mailing list