Re: Debugging 64-bit programs using 32-bit GDB

"Maciej W. Rozycki" <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
On Wed, 24 Jul 2013, Pedro Alves wrote:

> > Is it possible to debug a 64-bit executable ('bin/guile' [1]) using
> > 32-bit GDB?  (I use GNU/Linux.)
> 
> I don't think so.  The ptrace registers interfaces allow retrieving
> the right register sets (at least the modern interfaces), but
> things like breakpoints, etc. won't work, as the 32-bit GDB won't
> be able to handle the inferior's 64-bit addresses (due to how ptrace
> works).  Last I checked, Power had extra ptrace interfaces for that.
> Don't know about MIPS.

 This is apparently supported -- <asm/ptrace.h> on MIPS/Linux has this:

/* Calls to trace a 64bit program from a 32bit program.	 */
#define PTRACE_PEEKTEXT_3264	0xc0
#define PTRACE_PEEKDATA_3264	0xc1
#define PTRACE_POKETEXT_3264	0xc2
#define PTRACE_POKEDATA_3264	0xc3
#define PTRACE_GET_THREAD_AREA_3264	0xc4

and arch/mips/kernel/ptrace32.c in the kernel tree has corresponding code.
So it looks like we could support it.

  Maciej
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.