From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id 3132E3858D33 for ; Sun, 24 Mar 2024 14:11:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3132E3858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3132E3858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711289488; cv=none; b=N3XM32el02lLDvu3CYzAUDNTAim6ZlUCPG3C22EJ74syAk1/kNrE6WVbJDtFtyt6+3VryB25dBmxUpg+RL844/pwKOUNIEgLrmUOB7C2UhzZoEvCYTwA8nDc/KM7dw8UWNliaGPZqOGRorfWUw0bRp3N86oSSfd23aKPGzjNg0Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711289488; c=relaxed/simple; bh=Adj96OPB11F2senGBcTW2k/XOrfH6wFFdnl5rYWTyAA=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=XeJTMa7IWSFthB7o889NV/pyuATG3lKBctikXqRBZdYQaxb4F/Ki3CQVifWqd8pzqgwuAYkbRes3aHdAn5k1f9vNdL45jpSVT6I4l1ITiBrJenSZUY2PLPkmxrVY7Kdsag7VzJLcG2ArsPneiV4nFbO75YhADhUN1kUKFXIKViE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1e034607879so27473345ad.0 for ; Sun, 24 Mar 2024 07:11:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711289485; x=1711894285; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=HSg/TC8jbQ8CqfDwAGHI1jXeyKONWBSYuUXgTmEPi/I=; b=l5BnzS/ixCv8RSL9qapqCziVp3cMc5Bt8iWg7EyhyiU7P25/kRxkKqoR8cuHKTe+NX HahPlRyScNno48GzkiHnkE3eVBE7/b6thc8w2Ok6pTvSBeTeiQDQ9od0hFVLPNgwqEvx VUCzMUoN7p5Vcxdi1PH6M9wzslSzYyIz6YmAWkUxFy1ZYGTDp9bHARBYYRPHYBSz6vl2 +GxoYiFvHDfRMQpH9oXrUTakPLyVeLMrrKhk/9AtwahsJROgczmgtzHzxPWFalKjwmu3 9cHmXwF3LGEplZ0fnIIfabNafAbSfHVrUF8MZ6MDGyNaMBoORM8DhLr+UFmAp+/nw/mX WnAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711289485; x=1711894285; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HSg/TC8jbQ8CqfDwAGHI1jXeyKONWBSYuUXgTmEPi/I=; b=IRFVF3wjg2iVad5e0WJohGRQdpW/0iC1PsTgUrl07tLdtW3vY2Z27ndYxfbYzJrGee 5LMMACAaW0M0NOsI5urJdjiBUDb9PxjD1UmTxAs/8ehCgHpFbLXT7jKGfltjsqlycIsh c0CCn/Kfyuys2L4qdrdrlJVWiX/5iYnyYqXSrdF/JG3tCK+0rtAMp/D1O21//Y2DnsGK hZXHJUcQcovTL49LnDgbQa5UtuPyAM4jn1GIhM5TKibVLUVeLLPu4l447ryH/dbg4WpJ nur3E+d5VIoM07yvtjtNgwCDSJKSYnMGi6qw1HvBoqusZDcXr+zmIDwlnlR60espwPsq 7hfg== X-Gm-Message-State: AOJu0YwDnyzk2QSTLq49NgrA85ixdyIglBsgzCwdXk4tLhxUP8ES/jnQ p/b35zXn9ZzufALX7ctY/ba36zKFd45kWpAgdTFVW3Hw6qS0D44kS9E9fV+X X-Google-Smtp-Source: AGHT+IHHx/y7c+tm+RB7530K8W4CgAfcZCjjgB84QnSmdKSLedp6IbFBWw8/nKwPrDkmYPgSoWd0tQ== X-Received: by 2002:a17:902:cf0a:b0:1e0:b60e:2cdb with SMTP id i10-20020a170902cf0a00b001e0b60e2cdbmr2072567plg.57.1711289484949; Sun, 24 Mar 2024 07:11:24 -0700 (PDT) Received: from [192.168.54.105] (static.220.238.itcsa.net. [190.15.220.238]) by smtp.gmail.com with ESMTPSA id m11-20020a170902f20b00b001dc30f148f7sm3105439plc.243.2024.03.24.07.11.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 24 Mar 2024 07:11:24 -0700 (PDT) Message-ID: <43c02fe9-1862-4257-8692-c4f3cc136ca8@gmail.com> Date: Sun, 24 Mar 2024 11:11:21 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Getter and setter for Dwfl's offline_next_address Content-Language: en-US To: Mark Wielaard Cc: elfutils-devel@sourceware.org References: <20240306192249.242130-1-yakoyoku@gmail.com> <20240320225209.GL8319@gnu.wildebeest.org> From: Martin Rodriguez Reboredo In-Reply-To: <20240320225209.GL8319@gnu.wildebeest.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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: On 3/20/24 19:52, Mark Wielaard wrote: > Hi Martin, > > On Wed, Mar 06, 2024 at 04:22:49PM -0300, Martin Rodriguez Reboredo wrote: >> Added new functions dwfl_get_offline_next_address and >> dwfl_set_offline_next_address which will get plus set said field from >> the Dwfl struct. This is a requirement for listing functions from their >> addresses when using libdwfl offline, otherwise wrong symbols are going >> to be returned. > > Could you show an example of when/where you need it and what address > you set it to? For example, this test program reports the name and location pointed by the passed address. $ ./report /home/yakoyoku/.debug/.build-id/.../elf 0x0003281f 0x000000000003281f ?? ??:0 But due to the mentioned bias both of them are unknown or out of range. > The offline_next_address is only relevant for ET_REL files (like > object files or kernel modules). In general you will need to check the > bias, which various dwfl functions return to know the difference > between the addresses in the ELF, Dwarf or the module load address. > > That said, readelf, nm and dwfl_argp do "cheat" by setting the > offline_next_address to zero if they know they are just inspecting a > single object file. So maybe this is a functionality we need to > expose. But I don't fully understand why you need both a getter and a > setter for any arbitrary address. I've erroneously thought that setting `offline_next_address` was a requirement to obtain what I've needed. But if I use `dwfl_module_getelf` or `dwfl_module_getdwarf` I can get the correct name and location. 0x000000000003281f _ZNSt11__copy_moveILb0ELb0ESt26random_access_iterator_tagE8__copy_mIPcPhEET0_T_S6_S5_ /usr/include/c++/13.2.1/bits/stl_algobase.h:388,18 So this patch is kinda pointless, but at least I've managed to learn what I was missing. Anyways, thanks for the heads-up. :)