Re: PING: PATCH: PR backtrace/14646: [x32] backtrace doesn't work

Mark Kettenis
2012-10-15T10:10:04Z

> Date: Tue, 9 Oct 2012 09:38:32 -0700
> From: "H.J. Lu" <hjl.tools@gmail.com>
>
> The current GDB doesn't work on x32. This patch:
>
> http://sourceware.org/ml/gdb-patches/2012-09/msg00714.html
>
> isn't perfect where $pc/$sp is displayed as 64-bit integer. But
> otherwise, GDB works fine.

Finally found some time to dig a little bit deeper. The x32 ABI isn't
the only 32-bit ABI with 64-bit registers. The mips n32 ABI has
exactly the same issue. The relevant code there carries the following
comment:

/* Use pointer types for registers if we can. For n32 we can not,
since we do not have a 64-bit pointer type. */

So I'd say that you should probably commit the diff in:

<http://sourceware.org/ml/gdb-patches/2012-09/msg00714.html>

on the grounds that other 32-bit on 64-bit ABIs also punt on the issue.

But it would be good to try to come up with a way to print 64-bit
registers as pointers for this class of ABIs. But that should almost
certainly done by fixing target-independent parts of GDB and not by
adding more complexity to the target descriptions like your last
couple of diffs did.