From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 39F193858D37 for ; Wed, 30 Nov 2022 18:46:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 39F193858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669833981; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o1DWcuuEhxCNJOvmOQFVZZYAFzEuX1cQ1EG4odLMRx0=; b=FDGRdauf7LiMr2GvImDF2mn1hU96lX1kzqXKco3R7YdOGIo2Zaey8GhM9kZ3L4buc+1d4T fVntUnkRiH0Us4wtFI9QzqJgSry5Mar+iSyvRnYQ/7Pd8DHTEimT22bM4N47k+X45MpQD8 KVpu7bWvUFgt0rmMKWfO8H8GzOq1lZM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-111-oHWeCRB3OvOmbIlpCue13w-1; Wed, 30 Nov 2022 13:46:18 -0500 X-MC-Unique: oHWeCRB3OvOmbIlpCue13w-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2E57E858F13; Wed, 30 Nov 2022 18:46:18 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 821551121314; Wed, 30 Nov 2022 18:46:17 +0000 (UTC) From: Florian Weimer To: Mark Wielaard Cc: Avi Kivity , gdb@sourceware.org Subject: Re: debuginfod vs libthread_db.so References: <6cf1a5ef8636a1603181f0b177909a1e7869ece9.camel@klomp.org> Date: Wed, 30 Nov 2022 19:46:14 +0100 In-Reply-To: <6cf1a5ef8636a1603181f0b177909a1e7869ece9.camel@klomp.org> (Mark Wielaard's message of "Thu, 24 Nov 2022 13:24:00 +0100") Message-ID: <87bkoo46x5.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * 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,=20 > https://sourceware.org/ml/infinity/ > Source code: https://gitlab.com/gbenson/i8c/,=20 > 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=E2=80=94= 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