This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On 07/09/2013 11:06 AM, Nikita Karetnikov 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.

(you can however connect a 32-bit GDB to a 64-bit GDBserver, and use
that to debug a 64-bit program, though that's more trouble
than just using a 64-bit GDB.).

> 
> I've tried to configure GDB 7.6 with '--enable-64-bit-bfd' (see [2]),
> but it still shows "mips-tdep.c:709: internal-error: bad register
> size".

The x86_64 port catches the case early and bails out (amd64_linux_read_description):

  if (sizeof (void *) == 4 && is_64bit && !is_x32)
    error (_("Can't debug 64-bit process with 32-bit GDB"));

It'd be obviously better if MIPS native target did the same, instead
of tripping on assertions.

> [1] http://www.fdn.fr/~lcourtes/tmp/guile-static-stripped-2.0.9-mips64el-linux-gnuabi64.tar.xz
> [2] http://www.linux-mips.org/archives/linux-mips/2010-10/msg00336.html

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]