Changes in uspace/lib/c/generic/assert.c [d8de5d3:13f2461] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/assert.c
rd8de5d3 r13f2461 37 37 #include <atomic.h> 38 38 #include <stacktrace.h> 39 #include <stdint.h>40 39 41 static atomic_t failed_asserts = {0}; 40 #define MSG_START "Assertion failed (" 41 #define MSG_FILE ") in file \"" 42 #define MSG_LINE "\", line " 43 #define MSG_END ".\n" 42 44 43 void assert_abort(const char *cond, const char *file, unsigned int line) 45 static atomic_t failed_asserts; 46 47 void assert_abort(const char *cond, const char *file, const char *line) 44 48 { 45 49 /* 46 50 * Send the message safely to klog. Nested asserts should not occur. 47 51 */ 48 klog_printf("Assertion failed (%s) in file \"%s\", line %u.\n", 49 cond, file, line); 50 52 klog_write(MSG_START, str_size(MSG_START)); 53 klog_write(cond, str_size(cond)); 54 klog_write(MSG_FILE, str_size(MSG_FILE)); 55 klog_write(file, str_size(file)); 56 klog_write(MSG_LINE, str_size(MSG_LINE)); 57 klog_write(line, str_size(line)); 58 klog_write(MSG_END, str_size(MSG_END)); 59 51 60 /* 52 61 * Check if this is a nested or parallel assert. … … 60 69 * assertions. 61 70 */ 62 printf( "Assertion failed (%s) in file \"%s\", line %u.\n",71 printf(MSG_START "%s" MSG_FILE "%s" MSG_LINE "%s" MSG_END, 63 72 cond, file, line); 64 73 stacktrace_print(); 65 74 66 75 abort(); 67 76 }
Note:
See TracChangeset
for help on using the changeset viewer.