From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by sourceware.org (Postfix) with ESMTPS id 6CE2A384CB9C for ; Tue, 5 Dec 2023 16:11:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6CE2A384CB9C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=canonical.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6CE2A384CB9C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=185.125.188.122 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701792713; cv=none; b=qwDpnSTzCI8LU3jSF7/KLLgtgi1WfOtv20y8Ph20zhG8jMoJ8togAwHRP0ItCQj0AJVAQ/Bpd+3uTBGy3SrUN1hIPccQHaFaPkXBjGLGV/pQL69hdpwmcjNU6IZ6WAZ6DHsvDramMch+c1ZtFvJ5B950ejwKkMZ8S497pEyyNVw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701792713; c=relaxed/simple; bh=YErL9PrxlMFQTZuu9uUYgnrKFq5bDwB2Gw0gdqbiQPg=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=Jh5a+sCi1VT/KNE70MEOqrl09SoKw4Kk6uEGGXexxheWRXgm2L2mx6UCGogoFKWGs+QgSuVJIVm4i/lb92rjF/ntggPjAY3tdJbQKZixTpMTRkG83RNiAb5biIJbHFQIpM2Am6GlPvU0ps8l4itaBCXgo55fFIYUpCIlyBYZBVw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 4128C3F193 for ; Tue, 5 Dec 2023 16:11:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1701792703; bh=YErL9PrxlMFQTZuu9uUYgnrKFq5bDwB2Gw0gdqbiQPg=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=hRsPGuiLwdM64Rwyx74Tyn1yfAiPP2Gm9TXIZtHCgfWCjCxa/juxvoNiP4MVxpMpN O+XzUIrpWlArsklabiSttyFcJ5IbvBfnkZZol/fHaq5hJu2QIu94GFtP6ai1MEll9A lgcigwB8FRxA5EDpWSZwUWgl+jCZ3UDP9NzUY+GCNHW8+5kYdKRkX3gGxtMtH1wXAH 1noREytVwhpTTEvz+jCwhuDTBEBhrA8gqp+O3GeH6nKZVvpliDYpdVLAuDU4AqMBl6 J1OHV98WQ1A9SMDCsvPfwcGaAnW6/FtuMSaT1ujceODenNrJnI+GcNYHifAwlXDT3c o2UAY8Zu3MDFQ== Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-332e2f70092so5336146f8f.0 for ; Tue, 05 Dec 2023 08:11:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701792703; x=1702397503; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YErL9PrxlMFQTZuu9uUYgnrKFq5bDwB2Gw0gdqbiQPg=; b=urXVHJfUISXSHc1zSAMipKVpVj6EXtVk9ArtfKytHJxLV1xDPedRobkfmKXfXUOyTc jofd6BZI0ZmFbyfXcB+UX2l3jXgAyG5FSP97s6CUIA9OdQrMhQ6/BU65Juq7U0Cw5JwH cD1V7Lhti/LvDWWCWkSKbC/ZVnSZblJHhudQf24sIdTq2bZhsFmepnXF3lfxUOipc4SI /V4ljG2kAVRqKG80ZOO4Y5cubciSK7s9XH1C5tOpcUi/Zq7oOcr7g5BbhtMTHtxy9tCf SohotuqwIpTuEoghURA+1hPdnB0pEIjPCaRLo8lKpL0kTkkSHmLDkImy/oyMMIQLzjUa 14PQ== X-Gm-Message-State: AOJu0YwM5hgF0y7Cl/yRIYx71lYF0Xj615ZvscGHO9/JJkARy1zak/Dl jgOCdmVMIKylgMtN7HRi1hIy++YtBOwwoNep1BZ/IjiTMlsnDk4PlO9GUk+i1Oq4St55Ghesrvj iL6TYb3KBTobwm+w7Pd70+UGdk9Rm7SNM5FSRYPPS4UpEdh+0syMpaMcuZhI= X-Received: by 2002:a05:6000:145:b0:333:3f8c:d38b with SMTP id r5-20020a056000014500b003333f8cd38bmr2959169wrx.84.1701792702846; Tue, 05 Dec 2023 08:11:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IFYF2OXHD0rFx4gwGWJxAc8w5csY+VaBjnGx0IyWYuOXBtlm1r9+9NJCNdIduT1B3cl+PegB7X0oyg9A/0wbRE= X-Received: by 2002:a05:6000:145:b0:333:3f8c:d38b with SMTP id r5-20020a056000014500b003333f8cd38bmr2959157wrx.84.1701792702554; Tue, 05 Dec 2023 08:11:42 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Dimitri John Ledkov Date: Tue, 5 Dec 2023 16:11:06 +0000 Message-ID: Subject: Re: Porting pahole from dwarf_next_unit() to dwarf_get_units() To: Arnaldo Carvalho de Melo Cc: dwarves@vger.kernel.org, elfutils-devel@sourceware.org, mark@klomp.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: I On Tue, 5 Dec 2023, 15:47 Arnaldo Carvalho de Melo, wrote: > > Em Tue, Dec 05, 2023 at 01:03:01PM +0000, Dimitri John Ledkov escreveu: > > Currently pahole warns and does nothing upon hitting > > DW_TAG_skeleton_unit as implemented at > > https://git.kernel.org/pub/scm/devel/pahole/pahole.git/commit/?id=0135ccd632796ab3aff65b7c99b374c4682c2bcf > > > > In elfutils, a while back a new API got added that aids with discovery > > and processing of such tags - > > https://sourceware.org/git/?p=elfutils.git;a=commitdiff;h=79f0e623dcde4b042bb72f636a2211d67d5c0ade > > > > It seems to me if pahole is ported from using dwarf_next_unit() to > > instead use dwarf_get_units() native support can be added for > > split-dwarf (dwo) files. > > That would be awesome! > > > I am trying to write such a port, but it is proving to be very > > difficult. > > I did some work on supporting split-dwarf months ago, but got > sidetracked with other work, BTF related and then the code bitrotted, I > have to go back looking at it to swap back the details into my brain: > > https://git.kernel.org/pub/scm/devel/pahole/pahole.git/log/?h=alt_dwarf > > The patches after: > > 45c044860c2abce7 dwarf_loader: Sync with LINUX_ELFNOTE_LTO_INFO macro from kernel > > Are the ones to suport alt dwarf. I will read into those thanks. > > > I am entirely unfamiliar with neither pahole nor libdw nor > > the dwarf file format. Thus it is very confusing when both pahole and > > dwarf library use very similar type names and structs. For example > > libdw has struct Dwarf_CU and pahole has unrelated dwarf_cu struct. > > > What are the differences between dwarf_nextcu(), dwarf_next_unit(), > > dwarf_get_units() and when should one use each one of them? (or nest > > them?) > > > Is a port of https://git.kernel.org/pub/scm/devel/pahole/pahole.git/tree/dwarf_loader.c?id=0135ccd632796ab3aff65b7c99b374c4682c2bcf > > to use dwarf_get_units() a right approach and would be welcomed? > > Yes, we need to support DWARF5 fully. ack > > > Is anyone else interested in providing any help, or guidance? > > I'm interested, and I think if Mark could help it would be great as > well. I have something that sort of works, but then like aboarts with invalid free's on exit - which the purist in me cares, but not sure if it is of practical value or not. And eu-readelf code also mentions that it deliberary leaks memory, because life is hard. I will try to address or warn about memory leaks to see if stuff works, and post and RFC. Regards, Dimitri.