Re: how to make gdb happy with my linkmap

Mathieu Lacage
2008-12-18T22:03:03Z

On Thu, Dec 18, 2008 at 10:48 PM, Daniel Jacobowitz <drow@false.org> wrote:
> On Thu, Dec 18, 2008 at 10:41:20PM +0100, Mathieu Lacage wrote:
>> hi,
>>
>> I am currently trying to write a small ELF loader and make gdb be
>> happy with it.
>
> On SVR4 systems, basically, you can't. There is some information you
> won't be able to update because it lives in the kernel (auxilliary
> vector). This is one of the reasons I recently implemented "set

erm, I might be totally naive, but, how does the libc loader achieve
this then ? The only thing I am trying to do is be sufficiently
compatible with the libc loader to make gdb happy with my loader. Did
I mention that I am trying to replace the libc loader rather than try
to make two loaders co-exist in the same process image (which would
create another set of challenging problems from a compatibility
perspective).

> wrapper"; if the loader is far enough along when GDB starts looking

will grep for this.

> at it, and has a link map already set up, then it will (generally)
> not go poking around the auxilliary vector.
>
>> Hence, my question: what are the requirements on the structure of a
>> linkmap which is compatible with gdb's usage (beyond the mere ABI
>> offset requirements).
>
> I don't think this is possible to answer. The answer is that GDB is
> written to work as best it can with all the system loaders we've
> encountered. If there's a change that would make things easier for
> your loader, without breaking any of those systems, you're welcome to
> propose it :-)

Ok, my question then, is: what can I do in my loader to be fully
compatible with what gdb expects :) I am willing to go through quite
a bit of pain in the name of compatibility: whatever gdb asks me to do
will be probably orders of magnitude easier than what glibc is asking
me to provide