This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC/TileGX 5/6]show registers in columns
- From: Pedro Alves <palves at redhat dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: Jiong Wang <jiwang at tilera dot com>, gdb-patches at sourceware dot org, Walter Lee <walt at tilera dot com>, Tom Tromey <tromey at redhat dot com>
- Date: Fri, 08 Feb 2013 21:08:56 +0000
- Subject: Re: [RFC/TileGX 5/6]show registers in columns
- References: <50F91633.6000704@tilera.com> <20130118135039.GI3564@adacore.com> <50F97326.3040709@tilera.com> <20130208190946.GD17107@adacore.com>
On 02/08/2013 07:09 PM, Joel Brobecker wrote:
>>>> + else
>>>> + {
>>>> + fprintf_filtered (file, "0x");
>>>> + for (k = 0; k < tilegx_reg_size; k++)
>>>> + {
>>>> + int idx;
>>>> + if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
>>>> + idx = k;
>>>> + else
>>>> + idx = tilegx_reg_size - 1 - k;
>>>> + fprintf_filtered (file, "%02x", (unsigned char) buffer[idx]);
>
> I do not think that this is the right way of printing the register
> value, by doing all the work yourself. I am not completely sure
> what the best solution would be, though. The other Global Maintainers
> may have a more definitive answer, but perhaps plongest (value_as_long
> (register_value)). My suggestion is a little iffy because it assumes
> for instance that all register values are signed / or unsigned.
Usually you'd use val_print. How about just exporting and
calling default_print_one_register_info? You get consistency
with other archs for free, and unavailable values handled too.
--
Pedro Alves