This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: printing "variable-sized" registers
- From: Daniel Jacobowitz <drow at false dot org>
- To: Vladimir Prus <ghost at cs dot msu dot su>
- Cc: gdb at sources dot redhat dot com
- Date: Mon, 30 May 2005 12:58:17 -0400
- Subject: Re: printing "variable-sized" registers
- References: <d7f7dt$b3u$1@sea.gmane.org>
On Mon, May 30, 2005 at 06:22:19PM +0400, Vladimir Prus wrote:
>
> Hello,
> I'm working on a gdb port, and have problems with printing certain registers
> of my target. The problem is that those registers are vector buffers that
> can hold from 0 to 32 values at any given moment. I would like the 'info
> registers' command to print exactly the number of values that are present
> in a buffer. That is, on one invocation I might get 4 values printed, and
> on another 15, depending on the current processor state.
>
> However, I don't see an easy way to do this. The
> 'default_print_registers_info' function uses 'val_print' to print the
> value, and 'val_print' uses register type (struct type*), which has a fixed
> size. Anything I can do? Or I should just write arch-specific
> 'print_registers_info' function?
The last one. The best you can do the rest of the time is going to be
giving them a type containing the maximum number of values and fill in
with dummies - maybe also including the count?
If you want "print $reg" to display them nicely, you're going to need
to teach GDB's type system about it somehow. I have no idea what that
change would look like or how it would work, but it could be generally
useful - it's the same concept as prettyprinting a tagged union, I think.
--
Daniel Jacobowitz
CodeSourcery, LLC