Changeset 82d56184 in mainline for uspace/lib/c/generic/assert.c
- Timestamp:
- 2011-06-01T21:05:19Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5cac9cd
- Parents:
- 682cfceb (diff), 5d1b3aa (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/assert.c
r682cfceb r82d56184 33 33 #include <assert.h> 34 34 #include <stdio.h> 35 #include <io/klog.h> 35 36 #include <stdlib.h> 37 #include <atomic.h> 36 38 #include <stacktrace.h> 39 #include <stdint.h> 40 41 static atomic_t failed_asserts = {0}; 37 42 38 43 void assert_abort(const char *cond, const char *file, unsigned int line) 39 44 { 45 /* 46 * Send the message safely to klog. Nested asserts should not occur. 47 */ 48 klog_printf("Assertion failed (%s) in file \"%s\", line %u.\n", 49 cond, file, line); 50 51 /* 52 * Check if this is a nested or parallel assert. 53 */ 54 if (atomic_postinc(&failed_asserts)) 55 abort(); 56 57 /* 58 * Attempt to print the message to standard output and display 59 * the stack trace. These operations can theoretically trigger nested 60 * assertions. 61 */ 40 62 printf("Assertion failed (%s) in file \"%s\", line %u.\n", 41 63 cond, file, line); 42 64 stacktrace_print(); 65 43 66 abort(); 44 67 }
Note:
See TracChangeset
for help on using the changeset viewer.