mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-06 16:08:43 +02:00
Support storing assertion messages into core dump
Crash interception/debugging systems like Apport or ABRT capture core dumps for later crash analysis. However, if a program exits with an assertion failure, the core dump is not useful since the assertion message is only printed to stderr. glibc recently got a patch which stores the message of assert() into the __abort_msg global variable. (http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=48dcd0ba) That works fine for programs which actually use the standard C assert() macro. This patch adds the same functionality for glib's assertion tests. If we are building against a glibc which already has __abort_msg (2.11 and later, or backported above git commit), use that, otherwise put it into our own field __glib_assert_msg. Usage: $ cat test.c #include <glib.h> int main() { g_assert(1 < 0); return 0; } $ ./test **ERROR:test.c:5:main: assertion failed: (1 < 0) Aborted (Core dumped) $ gdb --batch --ex 'print (char*) __abort_msg' ./test core [...] $1 = 0x93bf028 "ERROR:test.c:5:main: assertion failed: (1 < 0)" https://bugzilla.gnome.org/show_bug.cgi?id=594872
This commit is contained in:
committed by
Chris Coulson
parent
e9ab9eaff6
commit
da66897950
14
configure.in
14
configure.in
@@ -2676,6 +2676,20 @@ int error = EILSEQ;
|
||||
], have_eilseq=yes, have_eilseq=no);
|
||||
AC_MSG_RESULT($have_eilseq)
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl *** Check whether glibc has global variable for assertion messages ***
|
||||
dnl **********************************************************************
|
||||
|
||||
AC_MSG_CHECKING(if libc has __abort_msg)
|
||||
AC_LINK_IFELSE([
|
||||
extern char *__abort_msg;
|
||||
int main() { return __abort_msg == (char*) 0; }
|
||||
], [libc_has_abort_msg=yes], [libc_has_abort_msg=no])
|
||||
AC_MSG_RESULT($libc_has_abort_msg)
|
||||
if test "$libc_has_abort_msg" = "yes"; then
|
||||
AC_DEFINE(HAVE_LIBC_ABORT_MSG,1,[Whether libc defines __abort_msg])
|
||||
fi
|
||||
|
||||
dnl ******************************************************************
|
||||
dnl *** Look for glib-genmarshal in PATH if we are cross-compiling ***
|
||||
dnl ******************************************************************
|
||||
|
Reference in New Issue
Block a user