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

H.J. Lu hjl.tools@gmail.com
Thu Apr 22 17:22:15 GMT 2021


On Thu, Apr 22, 2021 at 10:16 AM Szabolcs Nagy via Gdb-patches
<gdb-patches@sourceware.org> wrote:
>
> The 04/22/2021 16:25, Florian Weimer wrote:
> > * Szabolcs Nagy:
> >
> > > if i rerun the link command of the test exe but with -no-pie
> > > instead of -pie then the test passes with that binary.
> > >
> > > i suspect gdb places the breakpoint at the wrong place in pie
> > > for some reason. can be ubuntu tooling specific. see the
> > > breakpoint location (the exe base offset is missing):
> >
> > Thanks for investigating.
> >
> > > +attach 1254516
> > > [New LWP 1254517]
> > > Trying host libthread_db library: /home/szabolcs/try/build/nptl_db/libthread_db.so.1.
> > > td_ta_new failed: application not linked with libthread
> > > thread_db_load_search returning 0
> > > Trying host libthread_db library: /home/szabolcs/try/build/nptl_db/libthread_db.so.1.
> > > [Thread debugging using libthread_db enabled]
> > > Using host libthread_db library "/home/szabolcs/try/build/nptl_db/libthread_db.so.1".
> > > thread_db_load_search returning 1
> > > 0x0000ffff9d3d89c4 in __futex_abstimed_wait_common64 (futex_word=0xffff9d363210, expected=1254517, clockid=<optimized out>, abstime=0x0, private=<optimized out>, cancel=cancel@entry=true) at futex-internal.c:74
> > > 74          err = INTERNAL_SYSCALL_CANCEL (futex_time64, futex_word, op, expected,
> > > +break debugger_inspection_point
> > > Breakpoint 1 at 0x20c0: file tst-pthread-gdb-attach.c, line 123.
> > > +continue
> >
> > 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.

Just pass -no-pie to build exe.

> add-symbol-file fails even without ld.so, just pie exe fails.
>
> 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.
>


-- 
H.J.


More information about the Libc-alpha mailing list