public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Re: [rfc] bi-arch for x86-64 corefile.
       [not found]         ` <CAMe9rOp_7=S5rTEC+T8Q-UkZj3wDNNM6AhwbRXn18nZAGDH03A@mail.gmail.com>
@ 2012-10-30 12:37           ` Yao Qi
  2012-10-30 12:58             ` Pedro Alves
  2012-10-30 13:32             ` H.J. Lu
  0 siblings, 2 replies; 5+ messages in thread
From: Yao Qi @ 2012-10-30 12:37 UTC (permalink / raw)
  To: H.J. Lu; +Cc: binutils, gdb

On 10/30/2012 03:21 PM, H.J. Lu wrote:
> I am checking in this.  But sourceware.org times out for me.  Please
> give it a try.
>

H.J., it works for me!  Thanks for the review and checking it in.

> diff --git a/bfd/configure b/bfd/configure
> index fdf5356..427e5c1 100755
> --- a/bfd/configure
> +++ b/bfd/configure
> @@ -13927,6 +13927,10 @@ if test "${target}" = "${host}"; then
>     i[3-7]86-*-linux-*)
>   	COREFILE=trad-core.lo
>   	TRAD_HEADER='"hosts/i386linux.h"'
> +	case "$enable_targets" in
> +	*x86_64-*linux*)
> +	  CORE_HEADER='"hosts/x86-64linux.h"'
> +	esac
>   	;;
>     i[3-7]86-*-isc*)	COREFILE=trad-core.lo ;;
>     i[3-7]86-*-aix*)	COREFILE=aix386-core.lo ;;

This part is a little different from my original patch, which is

+	if test x${want64} = xtrue ; then
+	CORE_HEADER='"hosts/x86-64linux.h"'
+	fi

This requires something different in configure options.  In my previous 
patch, when configure i686-pc-linux-gnu-gdb to handle bi-arch, we run 
configure with '--enable-64-bit-bfd'.  In current trunk (w/ your patch), 
we have to run configure with '--enable-targets=x86_64-pc-linux-gnu'.

Copy gdb@ here to make sure GDB people are aware of this change, 
otherwise, configuring gdb with '--enable-64-bit-bfd' only still doesn't 
work for handling x86-64 corefile on x86 gdb.

-- 
Yao

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [rfc] bi-arch for x86-64 corefile.
  2012-10-30 12:37           ` [rfc] bi-arch for x86-64 corefile Yao Qi
@ 2012-10-30 12:58             ` Pedro Alves
  2012-10-30 13:55               ` Mark Kettenis
  2012-10-30 13:32             ` H.J. Lu
  1 sibling, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2012-10-30 12:58 UTC (permalink / raw)
  To: Yao Qi; +Cc: H.J. Lu, binutils, gdb

On 10/30/2012 12:37 PM, Yao Qi wrote:

> This requires something different in configure options.  In my previous patch, when configure i686-pc-linux-gnu-gdb to handle bi-arch, we run configure with '--enable-64-bit-bfd'.  In current trunk (w/ your patch), we have to run configure with '--enable-targets=x86_64-pc-linux-gnu'.
> 
> Copy gdb@ here to make sure GDB people are aware of this change, otherwise, configuring gdb with '--enable-64-bit-bfd' only still doesn't work for handling x86-64 corefile on x86 gdb.

That sounds like an unnecessary restriction.  A 32-bit GDB can debug a 64-bit
inferior with gdbserver just fine (it can also debug a 64-bit core), provided GDB
is built with --enable-64-bit-bfd.  Yes, debugging a native 64-bit inferior won't
work due to ptrace limitations, but GDB's gcore command can generate cores
even when remote debugging w/ gdbserver.

We have things like this, gdb/configure.tgt:

i[34567]86-*-linux*)
	# Target: Intel 386 running GNU/Linux
	gdb_target_obs="i386-tdep.o i386-linux-tdep.o glibc-tdep.o i387-tdep.o \
			solib-svr4.o symfile-mem.o \
			linux-tdep.o linux-record.o"
	if test "x$enable_64_bit_bfd" = "xyes"; then
	    # Target: GNU/Linux x86-64
	    gdb_target_obs="amd64-tdep.o amd64-linux-tdep.o ${gdb_target_obs}"
	fi
	build_gdbserver=yes
	;;

So it's be nice if bfd did the same in this case.  Thus, I'd very much
prefer if --enable-64-bit-bfd was enough for making bi-arch corefiles
work.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [rfc] bi-arch for x86-64 corefile.
  2012-10-30 12:37           ` [rfc] bi-arch for x86-64 corefile Yao Qi
  2012-10-30 12:58             ` Pedro Alves
@ 2012-10-30 13:32             ` H.J. Lu
  1 sibling, 0 replies; 5+ messages in thread
From: H.J. Lu @ 2012-10-30 13:32 UTC (permalink / raw)
  To: Yao Qi; +Cc: binutils, gdb

On Tue, Oct 30, 2012 at 5:37 AM, Yao Qi <yao@codesourcery.com> wrote:
> On 10/30/2012 03:21 PM, H.J. Lu wrote:
>>
>> I am checking in this.  But sourceware.org times out for me.  Please
>> give it a try.
>>
>
> H.J., it works for me!  Thanks for the review and checking it in.
>
>> diff --git a/bfd/configure b/bfd/configure
>> index fdf5356..427e5c1 100755
>> --- a/bfd/configure
>> +++ b/bfd/configure
>> @@ -13927,6 +13927,10 @@ if test "${target}" = "${host}"; then
>>
>>     i[3-7]86-*-linux-*)
>>         COREFILE=trad-core.lo
>>         TRAD_HEADER='"hosts/i386linux.h"'
>> +       case "$enable_targets" in
>> +       *x86_64-*linux*)
>> +         CORE_HEADER='"hosts/x86-64linux.h"'
>> +       esac
>>
>>         ;;
>>     i[3-7]86-*-isc*)    COREFILE=trad-core.lo ;;
>>     i[3-7]86-*-aix*)    COREFILE=aix386-core.lo ;;
>
>
> This part is a little different from my original patch, which is
>
>
> +       if test x${want64} = xtrue ; then
> +       CORE_HEADER='"hosts/x86-64linux.h"'
> +       fi
>
> This requires something different in configure options.  In my previous
> patch, when configure i686-pc-linux-gnu-gdb to handle bi-arch, we run
> configure with '--enable-64-bit-bfd'.  In current trunk (w/ your patch), we
> have to run configure with '--enable-targets=x86_64-pc-linux-gnu'.

I checked in this patch.

-- 
H.J.
----
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 56b40c5..00f63f2 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2012-10-30  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* configure.in: Also handle --enable-64-bit-bfd when setting
+	CORE_HEADER for 'i[3-7]86-*-linux-*'.
+
 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>

 	* elf32-arm.c (elf32_arm_print_private_bfd_data): Recognise and
diff --git a/bfd/configure b/bfd/configure
index 427e5c1..43bff03 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -13927,8 +13927,8 @@ if test "${target}" = "${host}"; then
   i[3-7]86-*-linux-*)
 	COREFILE=trad-core.lo
 	TRAD_HEADER='"hosts/i386linux.h"'
-	case "$enable_targets" in
-	*x86_64-*linux*)
+	case "$enable_targets"-"$want64" in
+	*x86_64-*linux*|*-true)
 	  CORE_HEADER='"hosts/x86-64linux.h"'
 	esac
 	;;
diff --git a/bfd/configure.in b/bfd/configure.in
index 9a31c04..6261aab 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -331,8 +331,8 @@ changequote(,)dnl
 changequote([,])dnl
 	COREFILE=trad-core.lo
 	TRAD_HEADER='"hosts/i386linux.h"'
-	case "$enable_targets" in
-	*x86_64-*linux*)
+	case "$enable_targets"-"$want64" in
+	*x86_64-*linux*|*-true)
 	  CORE_HEADER='"hosts/x86-64linux.h"'
 	esac
 	;;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [rfc] bi-arch for x86-64 corefile.
  2012-10-30 12:58             ` Pedro Alves
@ 2012-10-30 13:55               ` Mark Kettenis
  2012-10-30 14:53                 ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Kettenis @ 2012-10-30 13:55 UTC (permalink / raw)
  To: palves; +Cc: yao, hjl.tools, binutils, gdb

> Date: Tue, 30 Oct 2012 12:57:41 +0000
> From: Pedro Alves <palves@redhat.com>
> 
> On 10/30/2012 12:37 PM, Yao Qi wrote:
> 
> > This requires something different in configure options.  In my previous patch, when configure i686-pc-linux-gnu-gdb to handle bi-arch, we run configure with '--enable-64-bit-bfd'.  In current trunk (w/ your patch), we have to run configure with '--enable-targets=x86_64-pc-linux-gnu'.
> > 
> > Copy gdb@ here to make sure GDB people are aware of this change, otherwise, configuring gdb with '--enable-64-bit-bfd' only still doesn't work for handling x86-64 corefile on x86 gdb.
> 
> That sounds like an unnecessary restriction.  A 32-bit GDB can debug a 64-bit
> inferior with gdbserver just fine (it can also debug a 64-bit core), provided GDB
> is built with --enable-64-bit-bfd.  Yes, debugging a native 64-bit inferior won't
> work due to ptrace limitations, but GDB's gcore command can generate cores
> even when remote debugging w/ gdbserver.
> 
> We have things like this, gdb/configure.tgt:
> 
> i[34567]86-*-linux*)
> 	# Target: Intel 386 running GNU/Linux
> 	gdb_target_obs="i386-tdep.o i386-linux-tdep.o glibc-tdep.o i387-tdep.o \
> 			solib-svr4.o symfile-mem.o \
> 			linux-tdep.o linux-record.o"
> 	if test "x$enable_64_bit_bfd" = "xyes"; then
> 	    # Target: GNU/Linux x86-64
> 	    gdb_target_obs="amd64-tdep.o amd64-linux-tdep.o ${gdb_target_obs}"
> 	fi
> 	build_gdbserver=yes
> 	;;
> 
> So it's be nice if bfd did the same in this case.  Thus, I'd very much
> prefer if --enable-64-bit-bfd was enough for making bi-arch corefiles
> work.

The problem is that the Linux core file support in bfd is still relies
on native headers.  Trying to "fix them up" for bi-arch like what's
been done for the last couple of years on Linux is never going to give
you true cross-debugging support.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [rfc] bi-arch for x86-64 corefile.
  2012-10-30 13:55               ` Mark Kettenis
@ 2012-10-30 14:53                 ` Pedro Alves
  0 siblings, 0 replies; 5+ messages in thread
From: Pedro Alves @ 2012-10-30 14:53 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: palves, yao, hjl.tools, binutils, gdb

On 10/30/2012 01:54 PM, Mark Kettenis wrote:

> The problem is that the Linux core file support in bfd is still relies
> on native headers.  Trying to "fix them up" for bi-arch like what's been
> done for the last couple of years on Linux is never going to give you
> true cross-debugging support.

I agree.  The core files' layout is ABI, so we should not need, and should
not rely on host headers for generating core files.  Given that gcore
works with gdbserver too, a non-x86 hosted GDB debugging against
a x86 gdbserver should be able to generate x86 core files, without
x86 target headers present when building the non-x86 gdb/bfd.
I very much support that direction.

The patch looks to me a a small step in the right direction,
in that we rely a little bit less on the host headers though.
I don't know what structures and constants we're still picking up
from host headers.

Regardless, that's independent of the --enable-64-bit-bfd vs
--enable-targets=x86_64-pc-linux-gnu issue, which seems like
H.J has just fixed.  Thanks!

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-10-30 14:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1350881426-4945-1-git-send-email-yao@codesourcery.com>
     [not found] ` <CAMe9rOpeR8AX6EG8mNcfZNHNMrpZmv1S4O8H7BmREsU1vyN1jQ@mail.gmail.com>
     [not found]   ` <508F3B88.8060701@codesourcery.com>
     [not found]     ` <CAMe9rOrXFG_E7F0hhHjexEhahWWNVwfxfSXoOcCAU9XotSuuVw@mail.gmail.com>
     [not found]       ` <508F578F.8050807@codesourcery.com>
     [not found]         ` <CAMe9rOp_7=S5rTEC+T8Q-UkZj3wDNNM6AhwbRXn18nZAGDH03A@mail.gmail.com>
2012-10-30 12:37           ` [rfc] bi-arch for x86-64 corefile Yao Qi
2012-10-30 12:58             ` Pedro Alves
2012-10-30 13:55               ` Mark Kettenis
2012-10-30 14:53                 ` Pedro Alves
2012-10-30 13:32             ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).