gdb stub-offsets query

William A. Gatliff
Tue Jun 25 05:52:00 GMT 2002

> Should not the stubs return the correct offset values?

Yes, but in a lot of systems the zeros *are* the correct values.

I don't know what the original intent of the offsets query is, but the
way gdb uses it is if the target returns any nonzero offsets, gdb will
apply those offsets during symbol lookups and so forth.  This lets an
embedded system download code and data to wherever it will fit in
memory, even if it isn't the address that the locator placed it.

This is handy when you have an application image that was located in
flash, but you want to run it from RAM temporarily.  It isn't so handy
when the image isn't position-independent, however.

My gdbstubs code hardcodes all zeros for the response, because my
stubs won't do any relocations.  If gdb asks to put stuff at address
X, I put it there no questions asked.  But if this weren't the case,
the qOffsets command would be a real lifesaver.



On Mon, Jun 24, 2002 at 02:03:53PM -0700, ushit kumar wrote:
> Hi,
> How is the (gdb remote protocol) offset query, ie the
> following:
> $qOffsets#4b
> used by gdb?
> I have observed in some stubs that the response is
> coded to zero, ie 
> Text=0;Data=0;Bss=0.
> Should not the stubs return the correct offset values?
> Thanks,
> ushit
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup

Bill Gatliff

More information about the Gdb mailing list