impossible to resolve symbols in same binary loaded twice with dlmopen

Tom Tromey tromey@redhat.com
Thu Jul 8 20:32:00 GMT 2010


>>>>> "Mathieu" == Mathieu Lacage <mathieu.lacage@sophia.inria.fr> writes:

Mathieu> 2010-XX-XX Mathieu Lacage <mathieu.lacage@inria.fr>
Mathieu>         Fix PR/gdb 11766: gdb does not resolve correctly symbols in
Mathieu> binaries loaded twice with dlmopen

I think this is a reasonable idea.

First, I'm curious: does gdb detect dlmopen calls automatically?  I
thought there was some missing glibc feature here.  I haven't looked
into it too much since I wasn't aware of anybody really using dlmopen.
If gdb cannot do this, please file a bug report.

I am not completely sure that this patch is sufficient.

It doesn't seem like it would handle PIE properly.  I think you would
have to modify objfile_relocate as well.

I was wondering if there is a possible bug with a program dlmopen()ing
itself, but after thinking about it my guess is no.

Otherwise it seems reasonable to me.


Once you have this patch, does it really work?  It seems like it would
work ok for some things, like backtraces, but not other things.  E.g.,
does symbol lookup work properly in the dlmopen case?  I would imagine
that it does or does not depending on the ordering of objfiles in gdb's
internal list.

Tom



More information about the Gdb-patches mailing list