This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Debugging 64-bit programs using 32-bit GDB
- From: "Maciej W. Rozycki" <macro at codesourcery dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Nikita Karetnikov <nikita at karetnikov dot org>, <gdb at sourceware dot org>
- Date: Wed, 24 Jul 2013 22:20:57 +0100
- Subject: Re: Debugging 64-bit programs using 32-bit GDB
- References: <87r4f8oxo3 dot fsf at karetnikov dot org> <51EFE5C0 dot 60706 at redhat dot com>
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