Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tristan Gingold <gingold@adacore.com>
To: "gdb-patches@sourceware.org ml" <gdb-patches@sourceware.org>
Subject: RFA: Try to include libunwind-ia64.h in libunwind-frame.h
Date: Thu, 02 Feb 2012 16:32:00 -0000	[thread overview]
Message-ID: <5D1CD28F-F628-475C-B6D8-5FCBF5290C63@adacore.com> (raw)

Hi,

building a cross debugger for ia64 isn't as easy as for most other platforms.
Part of the issue is libunwind.h, which is not well designed for cross operation:

[…]

#ifndef UNW_REMOTE_ONLY

#if defined __arm__
# include "libunwind-arm.h"
#elif defined __hppa__
# include "libunwind-hppa.h"
#elif defined __ia64__
# include "libunwind-ia64.h"
#elif defined __mips__
# include "libunwind-mips.h"
#elif defined __powerpc__ && !defined __powerpc64__
# include "libunwind-ppc32.h"
#elif defined __powerpc64__
# include "libunwind-ppc64.h"
#elif defined __i386__
# include "libunwind-x86.h"
#elif defined __x86_64__
# include "libunwind-x86_64.h"
#else
# error "Unsupported arch"
#endif

[…]

Note that gdb doesn't define UNW_REMOTE_ONLY.  So clearly in my case a wrong header will be used.

I propose to fix this issue with the following patch: it includes libunwind-ia64.h if HAVE_LIBUNWIND_IA64_H is defined.
This is not perfect as libunwind-ia64.h may be detected even if not used, but will work in practice because only ia64 use libunwind.
So maybe it is a little bit over-engineered, and we could simply include libunwind-ia64.h.

(Also, the include of libunwind-ia64.h in ia64-tdep.c isn't necessary.  The reviewer will tell if s/he prefer to keep or remove this include).

Manually tested.

Ok for trunk ?

Tristan.

2012-02-02  Tristan Gingold  <gingold@adacore.com>

	* ia64-tdep.c: Do not include libunwind-ia64.h
	* libunwind-frame.h: Include libunwind-ia64.h instead of
	libunwind.h if possible.

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..932439b 100644
--- a/gdb/libunwind-frame.h
+++ b/gdb/libunwind-frame.h
@@ -29,7 +29,11 @@ struct gdbarch;
 #ifndef LIBUNWIND_FRAME_H
 #define LIBUNWIND_FRAME_H 1
 
+#ifdef HAVE_LIBUNWIND_IA64_H
+#include "libunwind-ia64.h"
+#else
 #include "libunwind.h"
+#endif
 
 struct libunwind_descr
 {


             reply	other threads:[~2012-02-02 16:32 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-02 16:32 Tristan Gingold [this message]
2012-02-10 12:31 ` Jan Kratochvil
2012-02-10 13:15   ` Tristan Gingold
2012-02-10 13:21     ` Jan Kratochvil
2012-02-10 13:27     ` Joel Brobecker
2012-02-10 13:45       ` Tristan Gingold
2012-02-10 14:04   ` Tristan Gingold
2012-02-10 14:09     ` Jan Kratochvil
2012-02-10 14:14       ` Tristan Gingold
2012-02-10 18:27 ` Jan Kratochvil
2012-02-10 18:34   ` Pedro Alves
2012-02-10 18:44     ` Jan Kratochvil
2012-02-10 18:59       ` Pedro Alves
2012-02-10 19:38         ` Jan Kratochvil
2012-02-11 14:10     ` Jan Kratochvil
2012-02-13  8:41       ` Tristan Gingold
2012-02-13 18:58       ` Pedro Alves
2012-02-13 19:03         ` Jan Kratochvil
2012-02-13 19:20           ` Pedro Alves
2012-02-13 19:27             ` Jan Kratochvil
2012-02-13 20:05               ` Pedro Alves
2012-02-14  7:28                 ` Jan Kratochvil
2012-02-14 12:14                   ` Pedro Alves
2012-02-14 14:36                     ` Jan Kratochvil
2012-02-14 14:53                       ` Pedro Alves
2012-02-20 20:54                         ` Jan Kratochvil
2012-02-20 22:30                           ` Pedro Alves
2012-02-20 22:37                             ` Joel Brobecker
2012-02-20 22:39                               ` Joel Brobecker
2012-02-20 22:57                               ` Pedro Alves
2012-02-20 23:20                                 ` Joel Brobecker
2012-02-21  6:48                             ` Jan Kratochvil
2012-02-21 13:36                               ` Pedro Alves
2012-02-21 19:10                                 ` Tom Tromey
2012-02-22  7:56                                   ` Tristan Gingold
2012-02-22 14:52                                     ` Jan Kratochvil
2012-02-21 20:18                                 ` Jan Kratochvil
2012-02-21 20:43                                   ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5D1CD28F-F628-475C-B6D8-5FCBF5290C63@adacore.com \
    --to=gingold@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox