Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* 32 bit applcaition debugging with 64bit gdb on 64bit machine
@ 2009-12-01  9:15 paawan oza
  2009-12-01 12:02 ` Jan Kratochvil
  2009-12-07 17:54 ` Michael Snyder
  0 siblings, 2 replies; 4+ messages in thread
From: paawan oza @ 2009-12-01  9:15 UTC (permalink / raw)
  To: gdb

Hi,

I have following questions, please try to clarify.

 I compile gdb on 64 bit machine, 

1) 32 bit application compiled on 32 bit system and directly using them on 64 bit machine, and then we debug the 32 bit application using 64 bit gdb on 64 bit machine.

2) 32 bit applications compiled on 64 bit machine using  -m32 flag, and then I try to compile 32 bit application using 64 bit gdb in 64 bit machine.

3) of course 64bit applications must be able to be debugged easily by 64 bit gdb on 64 bit machine.

In 1 and 2,  is there any case where gdb may not work or may have some issue ?
I suppose 3 must not have any issue.

Regards,
Oza.


      


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

* Re: 32 bit applcaition debugging with 64bit gdb on 64bit machine
  2009-12-01  9:15 32 bit applcaition debugging with 64bit gdb on 64bit machine paawan oza
@ 2009-12-01 12:02 ` Jan Kratochvil
  2009-12-07 17:54 ` Michael Snyder
  1 sibling, 0 replies; 4+ messages in thread
From: Jan Kratochvil @ 2009-12-01 12:02 UTC (permalink / raw)
  To: paawan oza; +Cc: gdb

On Tue, 01 Dec 2009 10:15:47 +0100, paawan oza wrote:
> I have following questions, please try to clarify.
>
>  I compile gdb on 64 bit machine,
>
> 1) 32 bit application compiled on 32 bit system and directly using them on 64 bit machine, and then we debug the 32 bit application using 64 bit gdb on 64 bit machine.
>
> 2) 32 bit applications compiled on 64 bit machine using  -m32 flag, and then I try to compile 32 bit application using 64 bit gdb in 64 bit machine.
>
> 3) of course 64bit applications must be able to be debugged easily by 64 bit gdb on 64 bit machine.
>
> In 1 and 2,  is there any case where gdb may not work or may have some issue ?
> I suppose 3 must not have any issue.

build:

Differences between native 32bit build and -m32 build on 64bit should be none
as (a) the gcc target code is the same and (b) the 32bit libraries are exactly
the same binary on 64bit hosts (at least on FedorA).

debugging:

All the cases should work and they are +/- supported for debugging:
kernel debugger inferior
x86_64 x86_64   x86_64    = native 64bit
x86_64 x86_64   i386
x86_64 i386     i386
i386   i386     i386      = native 32bit

But there are occasional GDB bugs such as:
	[patch] Fix syscall restarts for amd64->i386 biarch
	http://sourceware.org/ml/gdb-patches/2009-11/msg00592.html

	[patch 03/15] PIE: breakpoint_address_match gdbarch_addr_bit workaround
	http://sourceware.org/ml/gdb-patches/2009-11/msg00170.html
		(while this case is required only for the still non-upstreamed
		 PIE patch I guess one could find similar bug in existing code)

	[checked-in]
	[patch] Fix i386 memory-by-register access on amd64
	http://sourceware.org/ml/gdb-patches/2009-04/msg00786.html

	[not upstreamed]
	[patch] Support gcore for i386 inferiors on amd64
	http://sourceware.org/ml/gdb-patches/2006-09/msg00159.html
	http://cvs.fedora.redhat.com/viewvc/rpms/gdb/F-12/gdb-6.5-gcore-i386-on-amd64.patch?content-type=text%2Fplain&view=co

Linux kernels had various problems running both the x86_64-x86_64-i386 and
x86_64-i386-i386 cases (the same for ppc*; for example s390x-s390-s390 is
officailly not supported).  Various such bugs were found/fixed, this is why
biarch-tests/ build (erestartsys-trap was failing only in biarch mode
recently) and -debugge{r,e} testcases exist there:
	http://sourceware.org/systemtap/wiki/utrace/tests

One should run the two biarch modes (-m32 build of gdb and check//unix/-m32
testsuite run with 64bit gdb) and check the gdb testsuite produces exactly the
same results as on native 32bit host/kernel.  I was doing these comparisons in
the past which were a source for some bugreports+fixes above and others.
I do not run these tests regularly, one should recheck it.


vDSO:

Linux kernel provides [vdso] 4KB page which intentionally uses some
instructions not present on 32bit native targets which may cause some
incompatibilities for 32-bit era debuggers not ready for them:

Vitaly Mayatskikh:
I can confirm, this is internal kernel issue in arch/x86_64/ia32/syscall32.c.
It reproducible on every AMD machine, because kernel uses `sysenter' for Intel
machines and `syscall' instead of `int80' otherwise.

Seems, AMD is able to execute `syscall' from compatibility mode and this is
faster than `int80'. Isn't it cheaper to fix gdb and not to loose cpu time for
every system call in ia32 emulation mode? IIRC, on Intel machines `syscall'
costs approx. 1200 tacts and `int80' approx 2500.  


Regards,
Jan


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

* Re: 32 bit applcaition debugging with 64bit gdb on 64bit machine
  2009-12-01  9:15 32 bit applcaition debugging with 64bit gdb on 64bit machine paawan oza
  2009-12-01 12:02 ` Jan Kratochvil
@ 2009-12-07 17:54 ` Michael Snyder
  2009-12-08 13:24   ` paawan oza
  1 sibling, 1 reply; 4+ messages in thread
From: Michael Snyder @ 2009-12-07 17:54 UTC (permalink / raw)
  To: paawan oza; +Cc: gdb

paawan oza wrote:
> Hi,
> 
> I have following questions, please try to clarify.
> 
>  I compile gdb on 64 bit machine, 
> 
> 1) 32 bit application compiled on 32 bit system and directly using them on 64 bit machine, and then we debug the 32 bit application using 64 bit gdb on 64 bit machine.
> 
> 2) 32 bit applications compiled on 64 bit machine using  -m32 flag, and then I try to compile 32 bit application using 64 bit gdb in 64 bit machine.
> 
> 3) of course 64bit applications must be able to be debugged easily by 64 bit gdb on 64 bit machine.
> 
> In 1 and 2,  is there any case where gdb may not work or may have some issue ?
> I suppose 3 must not have any issue.

"not have any issues" is of course a pretty strong statement.
In general, all three cases should work.
I assume you talk about Intel arch.

Michael


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

* Re: 32 bit applcaition debugging with 64bit gdb on 64bit machine
  2009-12-07 17:54 ` Michael Snyder
@ 2009-12-08 13:24   ` paawan oza
  0 siblings, 0 replies; 4+ messages in thread
From: paawan oza @ 2009-12-08 13:24 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb

Yes. I was talking about intel arch.

Today I was trying to run following things.

1) 64 bit gdb with 32 bit inferior (compiled with -m32 option) on x86_64 arch.
I ran gdb testesuite. some gcore related test cases were failing on gdb 6.8.
I think gcore related things are not fixed in gdb 7.0 , may be.

2) 32 bit gdb (compiled using -m32) with 32 bit inferior also showed some varied results on x86_64 compare to native 32 bit gdb with 32 bit inferior on x86_64
I am not very sure about the reasons about the above point.

3) Is there any patch for 6.8 for gcore fix for point-1 ?

Regards,
Oza.





----- Original Message ----
From: Michael Snyder <msnyder@vmware.com>
To: paawan oza <paawan1982@yahoo.com>
Cc: "gdb@sourceware.org" <gdb@sourceware.org>
Sent: Mon, December 7, 2009 11:23:30 PM
Subject: Re: 32 bit applcaition debugging with 64bit gdb on 64bit machine

paawan oza wrote:
> Hi,
> 
> I have following questions, please try to clarify.
> 
>  I compile gdb on 64 bit machine, 
> 1) 32 bit application compiled on 32 bit system and directly using them on 64 bit machine, and then we debug the 32 bit application using 64 bit gdb on 64 bit machine.
> 
> 2) 32 bit applications compiled on 64 bit machine using  -m32 flag, and then I try to compile 32 bit application using 64 bit gdb in 64 bit machine.
> 
> 3) of course 64bit applications must be able to be debugged easily by 64 bit gdb on 64 bit machine.
> 
> In 1 and 2,  is there any case where gdb may not work or may have some issue ?
> I suppose 3 must not have any issue.

"not have any issues" is of course a pretty strong statement.
In general, all three cases should work.
I assume you talk about Intel arch.

Michael



      


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

end of thread, other threads:[~2009-12-08 13:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-01  9:15 32 bit applcaition debugging with 64bit gdb on 64bit machine paawan oza
2009-12-01 12:02 ` Jan Kratochvil
2009-12-07 17:54 ` Michael Snyder
2009-12-08 13:24   ` paawan oza

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