This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: The 'x' command: size problem
On Tuesday 06 September 2005 19:24, Daniel Jacobowitz wrote:
> 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. But you're in a GUI, i.e. hopefully something
> with logic and capable of parsing GDB's responses. Is it really that
> hard to get the size and print out the right bytes?
>
> -data-evaluate-expression "sizeof(i)"
> ^done,value="4"
> (gdb)
>
> -data-read-memory "&i" t 1 1 4
> ^done,addr="0xbf82ec04",nr-bytes="4",total-bytes="4",next-row="0xbf82ec08",
>prev-row="0xbf82ec00",next-page="0xbf82ec08",prev-page="0xbf82ec00",memory=[
>{addr="0xbf82ec04",data=["10011100","01011110","11101111","10110111"]}]
> (gdb)
No, it's not very hard. But given anynchronious nature of communication with
gdb I'm trying to limit the number of queries to minimum, to minimize the
amount of data I have to keep.
<aside>
I might be wrong, but I feel it would be much better if gdb were a library
that I could link to. That would eliminate most anynchonious communication
and won't require to keep track which gdb reply corresponds to which
previously issued command and where the result of the command must be sent
inside the frontend.
</aside>
- Volodya