[PATCH v3] nptl_db: Support different libpthread/ld.so load orders (bug 27744)

Florian Weimer fweimer@redhat.com
Thu Apr 22 15:39:05 GMT 2021


* Szabolcs Nagy:

>> Would you please check if the issue goes away if you replace
>> 
>>            "add-symbol-file %1$s/nptl/tst-pthread-gdb-attach\n"
>> 
>> with
>>            "file %1$s/nptl/tst-pthread-gdb-attach\n"
>> 
>> ?
>> 
>> (I assume this happens without --enable-hardcoded-path-in-tests.)
>
> yes, it seems gdb does not work with
>
> ld.so ./exe
>
> if exe is pie. i could not get it to work wit file either.
>
> add-symbol-file fails even without ld.so, just pie exe fails.

But “file” works?

> you have to use -o offset argument to add-symbol-file and
> manually fish out the base offset from info proc map, i don't
> think that can be easily scripted.

Oh, it's essentially a self-attach (after fork), so we can just read the
base address from the running process.  If there's an easy way to do
that.  In theory, it's just looking at a symbol at the main program and
subtracting its virtual offset, but I don't know how to get that.

Thanks,
Florian



More information about the Gdb-patches mailing list