Skip to content

Commit 605f02d

Browse files
libmicrokit: improve __assert_fail
This is used by libsel4 headers, we should actually crash when an assert fails and also print out the name of the PD that failed. Signed-off-by: Ivan Velickovic <i.velickovic@unsw.edu.au>
1 parent f7a48b4 commit 605f02d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

libmicrokit/src/dbg.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#include <sel4/sel4.h>
99

10+
extern char microkit_name[];
11+
1012
void microkit_dbg_putc(int c)
1113
{
1214
#if defined(CONFIG_PRINTING)
@@ -52,11 +54,13 @@ void microkit_dbg_put32(seL4_Uint32 x)
5254

5355
void __assert_fail(const char *str, const char *file, int line, const char *function)
5456
{
55-
microkit_dbg_puts("assert failed: ");
57+
microkit_dbg_puts(microkit_name);
58+
microkit_dbg_puts("|assert failed: ");
5659
microkit_dbg_puts(str);
5760
microkit_dbg_puts(" ");
5861
microkit_dbg_puts(file);
5962
microkit_dbg_puts(" ");
6063
microkit_dbg_puts(function);
6164
microkit_dbg_puts("\n");
65+
__builtin_trap();
6266
}

0 commit comments

Comments
 (0)