From 20648cdc29ec8e45bd16cdb2f8c726f5bd5604cf Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 27 Nov 2017 11:29:15 +0000 Subject: [PATCH] tests: Work around a gdb bug in assert-msg-test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It seems that when GLib is compiled without CFLAGS=-g, gdb can’t work out the size of __glib_assert_msg, so assumes it’s 4 bytes — even on 64-bit systems. This causes it to not read the most significant 4 bytes of the assertion message pointer, and hence it can’t print the stored assertion message. This causes assert-msg-test to fail. The upstream gdb bug is https://sourceware.org/bugzilla/show_bug.cgi?id=22501. Work around that by referencing and dereferencing __glib_assert_msg so that gdb treats it as a pointer of sizeof(char*) rather than of the size it incorrectly calculated from the library’s symbol table (or through some other mystical process). Signed-off-by: Philip Withnall https://bugzilla.gnome.org/show_bug.cgi?id=782057 --- tests/assert-msg-test.gdb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/assert-msg-test.gdb b/tests/assert-msg-test.gdb index 63a254152..dbecaaf2a 100644 --- a/tests/assert-msg-test.gdb +++ b/tests/assert-msg-test.gdb @@ -1,4 +1,5 @@ run set print elements 0 -print (char*) __glib_assert_msg +# Work around https://sourceware.org/bugzilla/show_bug.cgi?id=22501 +print *((char**) &__glib_assert_msg) quit