This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: gdb stub-offsets query
- From: "William A. Gatliff" <bgat at billgatliff dot com>
- To: ushit kumar <ushit_k at yahoo dot com>
- Cc: gdb at sources dot redhat dot com
- Date: Tue, 25 Jun 2002 07:52:32 -0500
- Subject: Re: gdb stub-offsets query
- References: <20020624210353.2886.qmail@web20609.mail.yahoo.com>
- Reply-to: bgat at billgatliff dot com
> 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.
Cheers,
b.g.
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
> http://fifaworldcup.yahoo.com
>
--
Bill Gatliff
bgat@billgatliff.com