public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* debuginfod vs libthread_db.so
@ 2022-11-24 12:02 Avi Kivity
  2022-11-24 12:24 ` Mark Wielaard
  0 siblings, 1 reply; 3+ messages in thread
From: Avi Kivity @ 2022-11-24 12:02 UTC (permalink / raw)
  To: gdb

[-- Attachment #1: Type: text/plain, Size: 689 bytes --]

debuginfod is pretty nice, since it allows you to debug a core file
generated on one system on another, without worrying about debug
information, so long as you point your debuginfod settings in the right
direction.

However, will it work for libthread_db.so? If not, then this breaks
down if the two systems use different libc versions that have
incompatible libthread_db.so.


(tangent: is it possible to express libthread_db.so code as DWARF
expressions? if so it will be possible to get rid of libthread_db.so,
by having libc encode accessors to thread information as some DWARF
expressions, and teaching gdb to use those expressions instead of
calling libthread_db.so)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: debuginfod vs libthread_db.so
  2022-11-24 12:02 debuginfod vs libthread_db.so Avi Kivity
@ 2022-11-24 12:24 ` Mark Wielaard
  2022-11-30 18:46   ` Florian Weimer
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Wielaard @ 2022-11-24 12:24 UTC (permalink / raw)
  To: Avi Kivity, gdb

Hi Avi,

On Thu, 2022-11-24 at 14:02 +0200, Avi Kivity via Gdb wrote:
> (tangent: is it possible to express libthread_db.so code as DWARF
> expressions? if so it will be possible to get rid of libthread_db.so,
> by having libc encode accessors to thread information as some DWARF
> expressions, and teaching gdb to use those expressions instead of
> calling libthread_db.so)

There used to be an effort to define a kind of extended DWARF
expressions, infinity notes, to describe things like the
libthread_db.so code. Although the website can only be found in
archive.org now, the code is still out there:
https://web.archive.org/web/20190126111943/https://infinitynotes.org/wiki/Infinity

Mailing list: infinity@sourceware.org, 
https://sourceware.org/ml/infinity/
Source code: https://gitlab.com/gbenson/i8c/, 
https://gitlab.com/gbenson/libi8x/

Cheers,

Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: debuginfod vs libthread_db.so
  2022-11-24 12:24 ` Mark Wielaard
@ 2022-11-30 18:46   ` Florian Weimer
  0 siblings, 0 replies; 3+ messages in thread
From: Florian Weimer @ 2022-11-30 18:46 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: Avi Kivity, gdb

* Mark Wielaard:

> Hi Avi,
>
> On Thu, 2022-11-24 at 14:02 +0200, Avi Kivity via Gdb wrote:
>> (tangent: is it possible to express libthread_db.so code as DWARF
>> expressions? if so it will be possible to get rid of libthread_db.so,
>> by having libc encode accessors to thread information as some DWARF
>> expressions, and teaching gdb to use those expressions instead of
>> calling libthread_db.so)
>
> There used to be an effort to define a kind of extended DWARF
> expressions, infinity notes, to describe things like the
> libthread_db.so code. Although the website can only be found in
> archive.org now, the code is still out there:
> https://web.archive.org/web/20190126111943/https://infinitynotes.org/wiki/Infinity
>
> Mailing list: infinity@sourceware.org, 
> https://sourceware.org/ml/infinity/
> Source code: https://gitlab.com/gbenson/i8c/, 
> https://gitlab.com/gbenson/libi8x/

These days, I would recommend to teach GDB to poke at the internal ld.so
data structures to glean the necessary data.  The offsets vary a lot and
would have to come from DWARF, but the structures themselves are fairly
stable (relative to other changes in GDB that glibc updates impose—sorry
about that).

To enable experimentation with this approach, we have stopped removing
debuginfo from ld.so in our distributions.

I kind of want to ship a header-only library in glibc which provides
this capability across multiple glibc versions, while outsourcing the
DWARF parsing etc. to GDB.

libthread_db also had code to compensate for limitations in the original
Linux ptrace interface, but that isn't needed anymore.

Thanks,
Florian


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-30 18:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-24 12:02 debuginfod vs libthread_db.so Avi Kivity
2022-11-24 12:24 ` Mark Wielaard
2022-11-30 18:46   ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).