This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
info registers output
- From: Pedro Alves <palves at redhat dot com>
- To: Ulrich Weigand <uweigand at de dot ibm dot com>
- Cc: Sergio Durigan Junior <sergiodj at redhat dot com>, GDB Patches <gdb-patches at sourceware dot org>, Tom Tromey <tromey at redhat dot com>, Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Date: Wed, 01 Aug 2012 21:20:11 +0100
- Subject: info registers output
- References: <201208011940.q71Jeksr002407@d06av02.portsmouth.uk.ibm.com>
On 08/01/2012 08:40 PM, Ulrich Weigand wrote:
> Pedro Alves wrote:
>> Why is the output format different? It looks like consistency here would be good.
>
> The problem is that "pc", "fp", etc can refer to different things under
> the covers: either a register defined by the target code, or else a
> "user register" defined by GDB common code.
>
> On many targets (but not Intel), "pc" is the name of a register defined
> by the target. In this case, registers_info uses the standard
> gdbarch_print_registers_info routine to output its content; this gives
> a larger space between register name and value, and outputs the
> contents both in hex and in the register's default type, usually a
> function pointer type.
>
> On targets where "pc" is *not* the name of a register defined by the
> target, registers_info still recognizes the name as "user register",
> and uses a separate code path to print its value. This results in
> a different (shorter) output ...
Ah. I wonder if that's been made on purpose. You get this on amd64:
(gdb) info registers rip pc
rip 0x390f407e68 0x390f407e68 <start_thread+552>
pc: 0x390f407e68
GDB knows the type of "pc", and so should be able to print "pc" like "rip".
Would that be a good idea?
--
Pedro Alves