This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: The 'x' command: size problem
Daniel Jacobowitz wrote:
> On Tue, Sep 06, 2005 at 10:16:56PM +0300, Eli Zaretskii wrote:
>> > Date: Tue, 6 Sep 2005 11:24:48 -0400
>> > From: Daniel Jacobowitz <drow@false.org>
>> > Cc: gdb@sources.redhat.com
>> >
>> > On Tue, Sep 06, 2005 at 07:00:28PM +0400, Vladimir Prus wrote:
>> > > works. In fact, the x_command function in printcmd.c expects the the
>> > > size argument be always given as literal.
>> > >
>> > > This limitation makes it somewhat harder to implement "show this
>> > > variable/expression in binary" command in a GUI. Are there any easy
>> > > workarounds?
>> >
>> > Not as far as I know.
>>
>> Is that a bug, and if so, should we fix it ASAP?
>
> Personally, I don't think it's a bug.
>
> It can't unambiguously accept x/sizeof(i), because of x/s. I suppose
> we could allow convenience variables here, but I don't think the
> benefit is substantial. For a frontend, it shouldn't be hard to find
> the right size as a literal. For a user, ditto.
By the same argumentation, it should not be too hard to find the address, so
'x' should accept literal address only, that is:
x/4 &g
should be disallowed and user will be required to write:
print &g
x/4 0xWHATEVER
It's a bit inconsistent that arbitrary expression is allowed to address, but
not for size.
- Volodya