diff options
| author | Martin Pitt <martin.pitt@ubuntu.com> | 2010-01-26 10:22:31 (GMT) |
|---|---|---|
| committer | Martin Pitt <martin.pitt@ubuntu.com> | 2010-01-26 10:22:31 (GMT) |
| commit | 3658727cfa0eca8c66bc2cdff46992099caf0acd (patch) | |
| tree | a2e287a2b1bf75a9c34d86741724285d08182e2e /glib/gtestutils.c | |
| parent | e84a3f824855419c361ebc9f2e04768f96c6f3b9 (diff) | |
| download | glib-3658727cfa0eca8c66bc2cdff46992099caf0acd.zip glib-3658727cfa0eca8c66bc2cdff46992099caf0acd.tar.xz | |
always use our own internal assertion message symbol
Re-using glibc's __abort_msg symbol causes linking problems, since the symbol
is declared private. Always use our own__glib_abort_msg symbol to store
assertion messages, to avoid compatibility and linking problems.
Also fix the test case to work with out of tree builds (such as "make
distcheck"), and re-enable it.
https://bugzilla.gnome.org/show_bug.cgi?id=594872
Diffstat (limited to 'glib/gtestutils.c')
| -rw-r--r-- | glib/gtestutils.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/glib/gtestutils.c b/glib/gtestutils.c index 36a0a8e..a0bedbd 100644 --- a/glib/gtestutils.c +++ b/glib/gtestutils.c @@ -41,18 +41,11 @@ #include <sys/select.h> #endif /* HAVE_SYS_SELECT_H */ -/* if we have a recent enough glibc, use its __abort_msg variable for storing - * assertion messages (just like assert()). If not, declare our own variable, - * so that platforms with older glibc or different libc implementations can use - * this feature for debugging as well. - */ -#ifdef HAVE_LIBC_ABORT_MSG -extern char *__abort_msg; -#define ASSERT_MESSAGE_STORE __abort_msg -#else +/* Global variable for storing assertion messages; this is the counterpart to + * glibc's (private) __abort_msg variable, and allows developers and crash + * analysis systems like Apport and ABRT to fish out assertion messages from + * core dumps, instead of having to catch them on screen output. */ char *__glib_assert_msg = NULL; -#define ASSERT_MESSAGE_STORE __glib_assert_msg -#endif /* --- structures --- */ struct GTestCase @@ -1312,13 +1305,12 @@ g_assertion_message (const char *domain, g_printerr ("**\n%s\n", s); /* store assertion message in global variable, so that it can be found in a - * core dump; also, use standard C allocation here for compatiblity with - * glibc's __abort_msg variable */ - if (ASSERT_MESSAGE_STORE != NULL) + * core dump */ + if (__glib_assert_msg != NULL) /* free the old one */ - free (ASSERT_MESSAGE_STORE); - ASSERT_MESSAGE_STORE = (char*) malloc (strlen (s) + 1); - strcpy (ASSERT_MESSAGE_STORE, s); + free (__glib_assert_msg); + __glib_assert_msg = (char*) malloc (strlen (s) + 1); + strcpy (__glib_assert_msg, s); g_test_log (G_TEST_LOG_ERROR, s, NULL, 0, NULL); g_free (s); |