Have all asserts call parlib's assert (XCC)
authorBarret Rhoden <brho@cs.berkeley.edu>
Tue, 25 Apr 2017 17:20:17 +0000 (13:20 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 3 May 2017 16:13:02 +0000 (12:13 -0400)
Now all calls to assert() will print the same info and have a backtrace,
regardless of whether or not you included parlib/assert.h.

Rebuild glibc.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/parlib-compat.c
tools/compilers/gcc-glibc/glibc-2.19-existing.patch

index 2c6f0fc..d11224e 100644 (file)
@@ -48,7 +48,8 @@ weak_alias(__print_user_context, print_user_context)
 
 void ___assert_failed(const char *file, int line, const char *msg)
 {
-       assert(0);
+       breakpoint();
+       abort();
 }
 weak_alias(___assert_failed, _assert_failed)
 
index 6551781..b560a54 100644 (file)
@@ -475,3 +475,23 @@ diff -ruB --unidirectional-new-file ../glibc-2.19/sysdeps/x86_64/tlsdesc.sym ../
  
  TLSDESC_ARG                   offsetof(struct tlsdesc, arg)
  
+--- glibc-2.19/assert/assert.c 2017-04-25 12:52:32.624619029 -0400
++++ glibc-2.19-akaros/assert/assert.c  2017-04-25 12:53:43.872966850 -0400
+@@ -24,6 +24,7 @@
+ #include <sysdep.h>
+ #include <unistd.h>
+ #include <sys/mman.h>
++#include <parlib/assert.h>
+ extern const char *__progname;
+@@ -98,7 +99,7 @@
+ __assert_fail (const char *assertion, const char *file, unsigned int line,
+              const char *function)
+ {
+-  __assert_fail_base (_("%s%s%s:%u: %s%sAssertion `%s' failed.\n%n"),
+-                    assertion, file, line, function);
++  /* Calls out to parlib, and this never returns */
++  _assert_failed(file, line, assertion);
+ }
+ hidden_def(__assert_fail)