Re: gdbserver relocation?

Daniel Jacobowitz
2003-03-04T03:03:35Z

On Tue, Mar 04, 2003 at 11:27:46AM +0900, Miles Bader wrote:
> Andrew Cagney <ac131313@redhat.com> writes:
> > I suspect you want to send something back using qOffsets.
>
> Yes, that's exactly what I needed.
>
> What do you think of the following patch (I added the `handle_query'
> target callback, and then provided a linux-low.c implementation)?

It looks reasonable to me. Do you have GDB copyright papers on file?

Content-Description: gdb-5.3-qoffsets-20030304.patch

> + if (errno == 0)
> + {
> + /* Both text and data offsets produced at compile-time (and so
> + used by gdb) are relative to the beginning of the program,
> + with the data segment immediately following the text segment.
> + However, the actual runtime layout in memory may put the data
> + somewhere else, so when we send gdb a data base-address, we
> + use the real data base address and subtract the compile-time
> + data base-address from it (which is just the length of the
> + text segment). BSS immediately follows data in both cases. */

Hmm, this only works if the executable is linked at 0 with data right
after text. Is that the case for all/most uClinux targets? I don't
know anything about uClinux.

--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer