From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25362 invoked by alias); 13 Feb 2012 20:05:18 -0000 Received: (qmail 25353 invoked by uid 22791); 13 Feb 2012 20:05:16 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 13 Feb 2012 20:05:00 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1DK4kft010967 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 13 Feb 2012 15:04:46 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q1DK4iN3012455; Mon, 13 Feb 2012 15:04:45 -0500 Message-ID: <4F396CDC.7020504@redhat.com> Date: Mon, 13 Feb 2012 20:05:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20120131 Thunderbird/10.0 MIME-Version: 1.0 To: Jan Kratochvil CC: Tristan Gingold , "gdb-patches@sourceware.org ml" Subject: Re: RFA: Try to include libunwind-ia64.h in libunwind-frame.h References: <5D1CD28F-F628-475C-B6D8-5FCBF5290C63@adacore.com> <20120210182705.GA32459@host2.jankratochvil.net> <4F3562FE.7050106@redhat.com> <20120211140919.GA24043@host2.jankratochvil.net> <4F395D17.5070303@redhat.com> <20120213190223.GA8851@host2.jankratochvil.net> <4F396251.9020409@redhat.com> <20120213192652.GA11522@host2.jankratochvil.net> In-Reply-To: <20120213192652.GA11522@host2.jankratochvil.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-02/txt/msg00245.txt.bz2 On 02/13/2012 07:26 PM, Jan Kratochvil wrote: > On Mon, 13 Feb 2012 20:19:45 +0100, Pedro Alves wrote: >> On 02/13/2012 07:02 PM, Jan Kratochvil wrote: >>> It is required for ia64 but it can be used even with non-ia64 archs. >> >> How? AFAICS, no other target installs the libunwind sniffer. It's just >> dead code on other archs, if I'm reading the code correctly. > > I see now. I did not know. Sure in this case this patch of mine was wrong. > I will therefore make libunwind usable only with ia64, this will be different > patch removing some parts of gdb/ code. I was only thinking of the below. Would this work for everyone? I don't have a cross build of libunwind for ia64 handy, but I assume this works, given the previous patches... 2012-02-13 Tristan Gingold Pedro Alves * ia64-tdep.c: Do not include libunwind-ia64.h. * libunwind-frame.h: Include libunwind-ia64.h instead of libunwind.h. * configure.ac (--with-libunwind, $enable_libunwind): Don't check for libunwind.h existence. * configure, config.in: Regenerate. --- gdb/config.in | 3 --- gdb/configure | 22 +++++++++------------- gdb/configure.ac | 6 +++--- gdb/ia64-tdep.c | 1 - gdb/libunwind-frame.h | 7 ++++++- 5 files changed, 18 insertions(+), 21 deletions(-) diff --git a/gdb/config.in b/gdb/config.in index bae1763..194cc7d 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -242,9 +242,6 @@ /* Define if libunwind library is being used. */ #undef HAVE_LIBUNWIND -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBUNWIND_H - /* Define to 1 if you have the header file. */ #undef HAVE_LIBUNWIND_IA64_H diff --git a/gdb/configure b/gdb/configure index 2566410..96a82ee 100755 --- a/gdb/configure +++ b/gdb/configure @@ -8252,21 +8252,19 @@ if test "${with_libunwind+set}" = set; then : esac else - for ac_header in libunwind.h libunwind-ia64.h + for ac_header in libunwind-ia64.h do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : + ac_fn_c_check_header_mongrel "$LINENO" "libunwind-ia64.h" "ac_cv_header_libunwind_ia64_h" "$ac_includes_default" +if test "x$ac_cv_header_libunwind_ia64_h" = x""yes; then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define HAVE_LIBUNWIND_IA64_H 1 _ACEOF fi done - if test x"$ac_cv_header_libunwind_h" = xyes -a x"$ac_cv_header_libunwind_ia64_h" = xyes; then + if x"$ac_cv_header_libunwind_ia64_h" = xyes; then enable_libunwind=yes; fi @@ -8274,14 +8272,12 @@ fi if test x"$enable_libunwind" = xyes; then - for ac_header in libunwind.h libunwind-ia64.h + for ac_header in libunwind-ia64.h do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : + ac_fn_c_check_header_mongrel "$LINENO" "libunwind-ia64.h" "ac_cv_header_libunwind_ia64_h" "$ac_includes_default" +if test "x$ac_cv_header_libunwind_ia64_h" = x""yes; then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define HAVE_LIBUNWIND_IA64_H 1 _ACEOF fi diff --git a/gdb/configure.ac b/gdb/configure.ac index 1b11adb..f7c987d 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -348,14 +348,14 @@ AS_HELP_STRING([--with-libunwind], [use libunwind frame unwinding support]), no) enable_libunwind=no ;; *) AC_MSG_ERROR(bad value ${withval} for GDB with-libunwind option) ;; esac],[ - AC_CHECK_HEADERS(libunwind.h libunwind-ia64.h) - if test x"$ac_cv_header_libunwind_h" = xyes -a x"$ac_cv_header_libunwind_ia64_h" = xyes; then + AC_CHECK_HEADERS(libunwind-ia64.h) + if x"$ac_cv_header_libunwind_ia64_h" = xyes; then enable_libunwind=yes; fi ]) if test x"$enable_libunwind" = xyes; then - AC_CHECK_HEADERS(libunwind.h libunwind-ia64.h) + AC_CHECK_HEADERS(libunwind-ia64.h) AC_DEFINE(HAVE_LIBUNWIND, 1, [Define if libunwind library is being used.]) CONFIG_OBS="$CONFIG_OBS libunwind-frame.o" CONFIG_DEPS="$CONFIG_DEPS libunwind-frame.o" diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index a297ecc..a36dc22 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -43,7 +43,6 @@ #ifdef HAVE_LIBUNWIND_IA64_H #include "elf/ia64.h" /* for PT_IA_64_UNWIND value */ #include "libunwind-frame.h" -#include "libunwind-ia64.h" /* Note: KERNEL_START is supposed to be an address which is not going to ever contain any valid unwind info. For ia64 linux, the choice diff --git a/gdb/libunwind-frame.h b/gdb/libunwind-frame.h index 0251819..922fdcb 100644 --- a/gdb/libunwind-frame.h +++ b/gdb/libunwind-frame.h @@ -29,7 +29,12 @@ struct gdbarch; #ifndef LIBUNWIND_FRAME_H #define LIBUNWIND_FRAME_H 1 -#include "libunwind.h" +/* IA64 is the only target that currently uses libunwind. If some + other target wants to use it, we will need to do some abstracting + in order to make it possible to have more than one libunwind-frame + instance. Including "libunwind.h" is wrong as that picks up the + version for the host gdb is running on. */ +#include "libunwind-ia64.h" struct libunwind_descr {