Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* How to configure a cross gdb to debug natively
@ 2001-07-13 13:23 H . J . Lu
  2001-07-13 13:48 ` H . J . Lu
  0 siblings, 1 reply; 9+ messages in thread
From: H . J . Lu @ 2001-07-13 13:23 UTC (permalink / raw)
  To: GDB

I'd like to configure gdb inside a tree with binutils, gcc and gdb
on Linux/i686 with

# ../configure --target=i386-linux ....

I do that on purpose so that gcc and binutils won't use any files
on the host machine. But gdb refuses to debug natively on Linux/i686
since it is configured as a cross gdb, However, Linux/i686 is
compatible with i386-linux, how can I convince gdb to debug natively?

Thanks.


H.J.


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

* Re: How to configure a cross gdb to debug natively
  2001-07-13 13:23 How to configure a cross gdb to debug natively H . J . Lu
@ 2001-07-13 13:48 ` H . J . Lu
  2001-07-13 14:06   ` Alexandre Oliva
  2001-07-13 14:08   ` Daniel Jacobowitz
  0 siblings, 2 replies; 9+ messages in thread
From: H . J . Lu @ 2001-07-13 13:48 UTC (permalink / raw)
  To: GDB; +Cc: gdb-patches

On Fri, Jul 13, 2001 at 01:23:46PM -0700, H . J . Lu wrote:
> I'd like to configure gdb inside a tree with binutils, gcc and gdb
> on Linux/i686 with
> 
> # ../configure --target=i386-linux ....
> 
> I do that on purpose so that gcc and binutils won't use any files
> on the host machine. But gdb refuses to debug natively on Linux/i686
> since it is configured as a cross gdb, However, Linux/i686 is
> compatible with i386-linux, how can I convince gdb to debug natively?
> 

This patch seems to do the trick for me.


H.J.
----
2001-07-13  H.J. Lu  (hjl@gnu.org)

	* configure.in: Check "${target_os}" = "${host_os}" and
	"${gdb_target_cpu}" = "${gdb_host_cpu}" for native files
	instead of "${target}" = "${host}".
	* configure: Regenerated.

--- gdb/configure.in.arch	Fri Jul 13 12:12:33 2001
+++ gdb/configure.in	Fri Jul 13 13:36:15 2001
@@ -1183,7 +1183,7 @@ s/GDB_MULTI_ARCH[ 	]*=[ 	]*\([^ 	]*\)[ 	
 # these really aren't orthogonal true/false values of the same condition,
 # but shells are slow enough that I like to reuse the test conditions
 # whenever possible
-if test "${target}" = "${host}"; then
+if test "${target_os}" = "${host_os}" -a "${gdb_target_cpu}" = "${gdb_host_cpu}"; then
 nativefile=`sed -n '
 s/NAT_FILE[ 	]*=[ 	]*\([^ 	]*\)/\1/p
 ' ${host_makefile_frag}`


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

* Re: How to configure a cross gdb to debug natively
  2001-07-13 13:48 ` H . J . Lu
@ 2001-07-13 14:06   ` Alexandre Oliva
  2001-07-13 14:08   ` Daniel Jacobowitz
  1 sibling, 0 replies; 9+ messages in thread
From: Alexandre Oliva @ 2001-07-13 14:06 UTC (permalink / raw)
  To: H . J . Lu; +Cc: GDB, gdb-patches

On Jul 13, 2001, "H . J . Lu" <hjl@lucon.org> wrote:

> -if test "${target}" = "${host}"; then
> +if test "${target_os}" = "${host_os}" -a "${gdb_target_cpu}" = "${gdb_host_cpu}"; then

Please use `test ... && test ...' instead of `test ... -a ...'.  The
latter is not as portable.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me


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

* Re: How to configure a cross gdb to debug natively
  2001-07-13 13:48 ` H . J . Lu
  2001-07-13 14:06   ` Alexandre Oliva
@ 2001-07-13 14:08   ` Daniel Jacobowitz
  2001-07-13 14:12     ` H . J . Lu
  2001-07-13 15:15     ` Andrew Cagney
  1 sibling, 2 replies; 9+ messages in thread
From: Daniel Jacobowitz @ 2001-07-13 14:08 UTC (permalink / raw)
  To: H . J . Lu; +Cc: GDB, gdb-patches

On Fri, Jul 13, 2001 at 01:48:06PM -0700, H . J . Lu wrote:
> On Fri, Jul 13, 2001 at 01:23:46PM -0700, H . J . Lu wrote:
> > I'd like to configure gdb inside a tree with binutils, gcc and gdb
> > on Linux/i686 with
> > 
> > # ../configure --target=i386-linux ....
> > 
> > I do that on purpose so that gcc and binutils won't use any files
> > on the host machine. But gdb refuses to debug natively on Linux/i686
> > since it is configured as a cross gdb, However, Linux/i686 is
> > compatible with i386-linux, how can I convince gdb to debug natively?
> > 
> 
> This patch seems to do the trick for me.
> 
> 
> H.J.
> ----
> 2001-07-13  H.J. Lu  (hjl@gnu.org)
> 
> 	* configure.in: Check "${target_os}" = "${host_os}" and
> 	"${gdb_target_cpu}" = "${gdb_host_cpu}" for native files
> 	instead of "${target}" = "${host}".
> 	* configure: Regenerated.

I don't think this is generally appropriate.  For one thing, it further
breaks the consistency of cross-compiling.  If I have ${host} !=
${target} then I am definitely building a cross debugger and that's
what I expect to get out.  Why not build your tools --host=i386-linux
instead?

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


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

* Re: How to configure a cross gdb to debug natively
  2001-07-13 14:08   ` Daniel Jacobowitz
@ 2001-07-13 14:12     ` H . J . Lu
  2001-07-13 14:28       ` Daniel Jacobowitz
  2001-07-13 15:15     ` Andrew Cagney
  1 sibling, 1 reply; 9+ messages in thread
From: H . J . Lu @ 2001-07-13 14:12 UTC (permalink / raw)
  To: GDB, gdb-patches

On Fri, Jul 13, 2001 at 02:08:26PM -0700, Daniel Jacobowitz wrote:
> On Fri, Jul 13, 2001 at 01:48:06PM -0700, H . J . Lu wrote:
> > On Fri, Jul 13, 2001 at 01:23:46PM -0700, H . J . Lu wrote:
> > > I'd like to configure gdb inside a tree with binutils, gcc and gdb
> > > on Linux/i686 with
> > > 
> > > # ../configure --target=i386-linux ....
> > > 
> > > I do that on purpose so that gcc and binutils won't use any files
> > > on the host machine. But gdb refuses to debug natively on Linux/i686
> > > since it is configured as a cross gdb, However, Linux/i686 is
> > > compatible with i386-linux, how can I convince gdb to debug natively?
> > > 
> > 
> > This patch seems to do the trick for me.
> > 
> > 
> > H.J.
> > ----
> > 2001-07-13  H.J. Lu  (hjl@gnu.org)
> > 
> > 	* configure.in: Check "${target_os}" = "${host_os}" and
> > 	"${gdb_target_cpu}" = "${gdb_host_cpu}" for native files
> > 	instead of "${target}" = "${host}".
> > 	* configure: Regenerated.
> 
> I don't think this is generally appropriate.  For one thing, it further
> breaks the consistency of cross-compiling.  If I have ${host} !=
> ${target} then I am definitely building a cross debugger and that's

I thought the only difference between the native debugger and the
cross debugger was you couldn't debug natibely with the cross
debugger, but you could use the native debugger to debug in a
cross environment.

> what I expect to get out.  Why not build your tools --host=i386-linux
> instead?

As I said, gdb is the part of my tool source tree. I don't want to
use --host=i386-linux so that gcc and bintils won't use any header
files and libraries on the host machine.


H.J.


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

* Re: How to configure a cross gdb to debug natively
  2001-07-13 14:12     ` H . J . Lu
@ 2001-07-13 14:28       ` Daniel Jacobowitz
  2001-07-13 14:45         ` H . J . Lu
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2001-07-13 14:28 UTC (permalink / raw)
  To: H . J . Lu; +Cc: GDB

On Fri, Jul 13, 2001 at 02:12:22PM -0700, H . J . Lu wrote:
> > I don't think this is generally appropriate.  For one thing, it further
> > breaks the consistency of cross-compiling.  If I have ${host} !=
> > ${target} then I am definitely building a cross debugger and that's
> 
> I thought the only difference between the native debugger and the
> cross debugger was you couldn't debug natibely with the cross
> debugger, but you could use the native debugger to debug in a
> cross environment.

The difference is that all code in NATDEPFILES is not included in a
cross debugger, yes.  That can substantially change the way that GDB
works.  If you configure for a cross debugger, you should expect to get
a cross debugger out.

> > what I expect to get out.  Why not build your tools --host=i386-linux
> > instead?
> 
> As I said, gdb is the part of my tool source tree. I don't want to
> use --host=i386-linux so that gcc and bintils won't use any header
> files and libraries on the host machine.

Build host-x-host instead?
../src/configure --build=i686-unknown-linux-gnu --host=i386-linux \
	--target=i386-linux

Ought to give you a native debugger and compilers and not reference
host files.  Or do you mean that you want to build cross compilers and
a native debugger at the same time?  You're configuring parts of the
tree for different targets essentially if you do that.  It may work in
this case, but I doubt it's always supposed to work, and a hack to try
to support it seems like a bad idea.  Note that GDB is going to want
host header files if you build it as native - things like
<sys/procfs.h>.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


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

* Re: How to configure a cross gdb to debug natively
  2001-07-13 14:28       ` Daniel Jacobowitz
@ 2001-07-13 14:45         ` H . J . Lu
  2001-07-13 14:52           ` Daniel Jacobowitz
  0 siblings, 1 reply; 9+ messages in thread
From: H . J . Lu @ 2001-07-13 14:45 UTC (permalink / raw)
  To: GDB

On Fri, Jul 13, 2001 at 02:28:50PM -0700, Daniel Jacobowitz wrote:
> > 
> > I thought the only difference between the native debugger and the
> > cross debugger was you couldn't debug natibely with the cross
> > debugger, but you could use the native debugger to debug in a
> > cross environment.
> 
> The difference is that all code in NATDEPFILES is not included in a
> cross debugger, yes.  That can substantially change the way that GDB
> works.  If you configure for a cross debugger, you should expect to get
> a cross debugger out.

Does the change have any negative impact?

> 
> > > what I expect to get out.  Why not build your tools --host=i386-linux
> > > instead?
> > 
> > As I said, gdb is the part of my tool source tree. I don't want to
> > use --host=i386-linux so that gcc and bintils won't use any header
> > files and libraries on the host machine.
> 
> Build host-x-host instead?
> ../src/configure --build=i686-unknown-linux-gnu --host=i386-linux \
> 	--target=i386-linux
> 
> Ought to give you a native debugger and compilers and not reference
> host files.  Or do you mean that you want to build cross compilers and
> a native debugger at the same time?  You're configuring parts of the

Yes.

> tree for different targets essentially if you do that.  It may work in

That is something I tried to avoid.

> this case, but I doubt it's always supposed to work, and a hack to try
> to support it seems like a bad idea.  Note that GDB is going to want
> host header files if you build it as native - things like
> <sys/procfs.h>.

And? My patch checks "${target_os}" = "${host_os}" and
"${gdb_target_cpu}" = "${gdb_host_cpu}".


H.J.


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

* Re: How to configure a cross gdb to debug natively
  2001-07-13 14:45         ` H . J . Lu
@ 2001-07-13 14:52           ` Daniel Jacobowitz
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel Jacobowitz @ 2001-07-13 14:52 UTC (permalink / raw)
  To: GDB

On Fri, Jul 13, 2001 at 02:45:57PM -0700, H . J . Lu wrote:
> Does the change have any negative impact?

I think you're violating least surprise.  You want a native debugger. 
Configure for a native debugger.  A cross debugger should never try to
run binaries on the local machine, even if it happens they will run; it
requires a remote target, and does not include entire chunks of code. 
That's a good thing.

> > this case, but I doubt it's always supposed to work, and a hack to try
> > to support it seems like a bad idea.  Note that GDB is going to want
> > host header files if you build it as native - things like
> > <sys/procfs.h>.
> 
> And? My patch checks "${target_os}" = "${host_os}" and
> "${gdb_target_cpu}" = "${gdb_host_cpu}".

I think you should trust the target triplets in a case like this.  If
it says they're different, assume that they really are different.  I
suspect that this will do the wrong thing with, for instance, 32-bit
and 64-bit AIX.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


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

* Re: How to configure a cross gdb to debug natively
  2001-07-13 14:08   ` Daniel Jacobowitz
  2001-07-13 14:12     ` H . J . Lu
@ 2001-07-13 15:15     ` Andrew Cagney
  1 sibling, 0 replies; 9+ messages in thread
From: Andrew Cagney @ 2001-07-13 15:15 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: H . J . Lu, GDB, gdb-patches

> On Fri, Jul 13, 2001 at 01:48:06PM -0700, H . J . Lu wrote:
> 
>> On Fri, Jul 13, 2001 at 01:23:46PM -0700, H . J . Lu wrote:
> 
>> > I'd like to configure gdb inside a tree with binutils, gcc and gdb
>> > on Linux/i686 with
>> > 
>> > # ../configure --target=i386-linux ....
>> > 
>> > I do that on purpose so that gcc and binutils won't use any files
>> > on the host machine. But gdb refuses to debug natively on Linux/i686
>> > since it is configured as a cross gdb, However, Linux/i686 is
>> > compatible with i386-linux, how can I convince gdb to debug natively?
>> > 

> I don't think this is generally appropriate.  For one thing, it further
> breaks the consistency of cross-compiling.  If I have ${host} !=
> ${target} then I am definitely building a cross debugger and that's
> what I expect to get out.  Why not build your tools --host=i386-linux
> instead?


Yes.

H.J., you need to canadian cross GDB using the cross-GCC and 
cross-BINUTILS you just built.

	Andrew


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

end of thread, other threads:[~2001-07-13 15:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-13 13:23 How to configure a cross gdb to debug natively H . J . Lu
2001-07-13 13:48 ` H . J . Lu
2001-07-13 14:06   ` Alexandre Oliva
2001-07-13 14:08   ` Daniel Jacobowitz
2001-07-13 14:12     ` H . J . Lu
2001-07-13 14:28       ` Daniel Jacobowitz
2001-07-13 14:45         ` H . J . Lu
2001-07-13 14:52           ` Daniel Jacobowitz
2001-07-13 15:15     ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox