From 533da9109154e0e0cc48ee1c676da6518f2e4dd6 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Mon, 4 Aug 2014 22:52:22 +0200 Subject: [PATCH] Enable babeltrace compile-time feature. --- gdb-babeltrace-configure.patch | 85 ++++++++++++++++++++++++++++++++++ gdb.spec | 17 ++++++- 2 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 gdb-babeltrace-configure.patch diff --git a/gdb-babeltrace-configure.patch b/gdb-babeltrace-configure.patch new file mode 100644 index 0000000..3ac029d --- /dev/null +++ b/gdb-babeltrace-configure.patch @@ -0,0 +1,85 @@ +http://sourceware.org/ml/gdb-patches/2014-08/msg00045.html +Subject: [patch] Fix --with-babeltrace with gcc-4.9.1 + + +--qMm9M+Fa2AknHoGS +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline + +Hi, + +when I tried to use --with-babeltrace on Fedora Rawhide x86_64 +using gcc-4.9.1-3.fc22.x86_64 I got: + +checking for libbabeltrace... no +configure: error: babeltrace is missing or unusable +Makefile:7973: recipe for target 'configure-gdb' failed + +configure:15890: checking for libbabeltrace +configure:15918: gcc -o conftest -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -Werror -static-libstdc++ -static-libgcc -Wl,-z,relro conftest.c -lselinux -lncurses -lz -lm -ldl /usr/lib64/libbabeltrace.so /usr/lib64/libbabeltrace-ctf.so >&5 +conftest.c: In function 'main': +conftest.c:198:21: error: unused variable 'pos' [-Werror=unused-variable] + struct bt_iter_pos *pos = bt_iter_get_pos (bt_ctf_get_iter (NULL)); + ^ +cc1: all warnings being treated as errors +configure:15918: $? = 1 +configure: failed program was: + +The patch below fixes it for me. + +In configure.ac there is above this check: + # Append -Werror to CFLAGS so that configure can catch the warning + # "assignment from incompatible pointer type", which is related to + # the babeltrace change from 1.0.3 to 1.1.0. Babeltrace 1.1.0 works + # in GDB, while babeltrace 1.0.3 is broken. + # AC_LIB_HAVE_LINKFLAGS may modify CPPFLAGS in it, so it should be + # safe to save and restore CFLAGS here. + saved_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -Werror" + +Maybe it would be easier to use there: + CFLAGS="$CFLAGS -Werror -Wno-unused-variable" + +But maybe -Werror is cross-compiler compatible while -Wno-unused-variable is +not, I have no idea. + + +Jan + +--qMm9M+Fa2AknHoGS +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline; filename="gdb-babeltrace-configure.patch" + +gdb/ +2014-08-04 Jan Kratochvil + + * configure.ac (--with-babeltrace): Use 'pos'. + * configure: Regenerate. + +diff --git a/gdb/configure.ac b/gdb/configure.ac +index 70d0964..07d2f00 100644 +--- a/gdb/configure.ac ++++ b/gdb/configure.ac +@@ -2437,6 +2437,7 @@ else + struct bt_ctf_event *event = NULL; + const struct bt_definition *scope; + ++ (void) pos; /* Prevent -Werror=unused-variable. */ + scope = bt_ctf_get_top_level_scope (event, + BT_STREAM_EVENT_HEADER); + bt_ctf_get_uint64 (bt_ctf_get_field (event, scope, "id")); +diff --git a/gdb/configure b/gdb/configure +index 809326a..b983d16 100755 +--- a/gdb/configure ++++ b/gdb/configure +@@ -15344,6 +15344,7 @@ struct bt_iter_pos *pos = bt_iter_get_pos (bt_ctf_get_iter (NULL)); + struct bt_ctf_event *event = NULL; + const struct bt_definition *scope; + ++ (void) pos; /* Prevent -Werror=unused-variable. */ + scope = bt_ctf_get_top_level_scope (event, + BT_STREAM_EVENT_HEADER); + bt_ctf_get_uint64 (bt_ctf_get_field (event, scope, "id")); + +--qMm9M+Fa2AknHoGS-- + diff --git a/gdb.spec b/gdb.spec index c9cdbe5..41cdc11 100644 --- a/gdb.spec +++ b/gdb.spec @@ -26,7 +26,7 @@ Version: 7.8 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 15%{?dist} +Release: 16%{?dist} License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain and GFDL Group: Development/Debuggers @@ -524,6 +524,9 @@ Patch921: gdb-python-completer-2of2.patch # Display Fortran strings in backtraces. Patch925: gdb-fortran-frame-string.patch +# Fix -Werror=unused-variable error configuring babeltrace. +Patch926: gdb-babeltrace-configure.patch + %if 0%{!?rhel:1} || 0%{?rhel} > 6 # RL_STATE_FEDORA_GDB would not be found for: # Patch642: gdb-readline62-ask-more-rh.patch @@ -555,6 +558,9 @@ BuildRequires: texlive-collection-latexrecommended %endif # Permit rebuilding *.[0-9] files even if they are distributed in gdb-*.tar: BuildRequires: /usr/bin/pod2man +%if 0%{!?rhel:1} +BuildRequires: libbabeltrace-devel%{?_isa} +%endif %if 0%{?_with_testsuite:1} @@ -804,6 +810,7 @@ find -name "*.info*"|xargs rm -f %patch920 -p1 %patch921 -p1 %patch925 -p1 +%patch926 -p1 %patch848 -p1 %if 0%{!?el6:1} @@ -891,6 +898,11 @@ export LDFLAGS="%{?__global_ldflags} %{?_with_asan:-fsanitize=address}" --disable-sim \ --disable-rpath \ --without-guile \ +%if 0%{!?rhel:1} + --with-babeltrace \ +%else + --without-babeltrace \ +%endif %if 0%{!?rhel:1} || 0%{?rhel} > 6 --with-system-readline \ %else @@ -1294,6 +1306,9 @@ then fi %changelog +* Mon Aug 4 2014 Jan Kratochvil - 7.8-16.fc21 +- Enable babeltrace compile-time feature. + * Sat Aug 2 2014 Jan Kratochvil - 7.8-15.fc21 - Rebase to FSF GDB 7.8. - Display Fortran strings in backtraces.