From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc2c.google.com (mail-oo1-xc2c.google.com [IPv6:2607:f8b0:4864:20::c2c]) by sourceware.org (Postfix) with ESMTPS id 3936D3858C41 for ; Tue, 7 Nov 2023 16:55:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3936D3858C41 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=osandov.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=osandov.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3936D3858C41 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::c2c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699376114; cv=none; b=rT4w+8iUvl+YFQXIrNPhfsD7qMnWJJIEoIczRGUYCV/YKCoGIQBcl7bdJ7wuHfRxwPBvRi40OkA4IT7yvhnoSYJI4kDWLKVdJRJUSj9ndHlXml4Gdf8Q8tryinQoz3Yvqxii2lzKI4tHaMjaBBIl0aaQycuuf/3jrwU/xF7Vatc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699376114; c=relaxed/simple; bh=Y73ei/efYnT/M/nVeYJG4OxftqKlvTVyDQbLAvIFuew=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=Hp13MFLtcGMdAk1yrcOuhuZGO6h6Sh9WJXu3d353Xgf30ahD+eGLYuWvD/KKVc9weLVM4qW+oZARvVPMok9OI5EUEvbHRm59+YjbcEbT/uRgYbetP5+ydFrFaaW9LUO+EWAB30s/TkAIGMdmiq5rdKn5srBdco35Zw7NZjc7JVI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-58786e23d38so2363035eaf.3 for ; Tue, 07 Nov 2023 08:55:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20230601.gappssmtp.com; s=20230601; t=1699376111; x=1699980911; darn=sourceware.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=VjCo8YTQxtWpOfBAPgbSDakipZY2DClDd4nA94RYuBg=; b=tyZGkPMHcNiwhnJVSKtAr0A88qdWPOalFS2hswpeLTCA8/QWuIB60nJ4FyGO851Pz/ mCJ/5X5jGTJ6j1wWo+Xjo5W9xQvgC7CAcAqqD5xTx9vM1/DD9KFc8KQUqm2XcEXcW593 f8xYadrdk2fF2sjCtv+uhY4+SUXH3Cgr5JyltB/ueN2G8Kln4ywwZF+0BS1yA8F602Ro OvxMCiU9g67CmINnsBnEoAugDudqenZv4Db/Ta6fumvCuwSzQwaAEyGTdR7iLfQCaSBM THKX8LbgibbtCBZnLAbeJW6GaPF6l9iR6kPZd5Qy7Bkctq8TvwyKmObY60ekmL4L2N0t 5Zag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699376111; x=1699980911; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=VjCo8YTQxtWpOfBAPgbSDakipZY2DClDd4nA94RYuBg=; b=oCNrgO2meV3Qh6hYBJfqYOItDx+WB7GHQXXw+7FG0hGVx03lalGrmwDJyzw/2TQenF Fa9Q4YNoUULi2A9ge0Pq5VM8A7VrINQzVBdFR3KoE2gP7n3JyucW57sdHVzWAMW0Mcrh vcK4VbSBfgWmQnALsX+DvUthmlL796Z9FS/hCjZFNZ+sxSGoPdciJ/mKOnX/ziKSj8yx z7dinwXqAQtrcjxm2AQzLJqJofG8mRVYl0cKuYvbBP4DRfbj1TkZjIWgT5QUvVsyK4FM HmkQB7Mb7hbfXsWcph1Bj06U6o4Ca9EPHgZ72sJ8RtHvdvEvu7uy2rzSytVfEazsfxQi +BgQ== X-Gm-Message-State: AOJu0Yzkgd07TJ1ad/FEbPD5cSMuhs5Hqxjlk+o28Mr+AKPLrNcOZlCy VLQJzpzr8vZbxZGQC/9F49ALV0DwJZIlL15Eisc= X-Google-Smtp-Source: AGHT+IGYC7ocijTGslxk3+f2dYnJ3Uf17ZE9NXpDrlNUwAlXU5aG+k12dBL1QwNIDMbBriB7SGYTsg== X-Received: by 2002:a05:6358:720e:b0:16b:63ba:4b68 with SMTP id h14-20020a056358720e00b0016b63ba4b68mr10407436rwa.15.1699376111351; Tue, 07 Nov 2023 08:55:11 -0800 (PST) Received: from telecaster ([2620:10d:c090:400::4:fc06]) by smtp.gmail.com with ESMTPSA id f16-20020a63f110000000b005b8e1b0090asm1606679pgi.67.2023.11.07.08.55.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 08:55:10 -0800 (PST) Date: Tue, 7 Nov 2023 08:55:08 -0800 From: Omar Sandoval To: Mark Wielaard Cc: elfutils-devel@sourceware.org Subject: Re: [PATCH 13/14] libdw: Apply DWARF package file section offsets where appropriate Message-ID: References: <94e0e37fe161b66bab98aca80d5d8566badb44e7.1695837512.git.osandov@fb.com> <20231102222033.GR8429@gnu.wildebeest.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231102222033.GR8429@gnu.wildebeest.org> X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,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: On Thu, Nov 02, 2023 at 11:20:33PM +0100, Mark Wielaard wrote: > Hi Omar, > > On Wed, Sep 27, 2023 at 11:21:02AM -0700, Omar Sandoval wrote: > > The final piece of DWARF package file support is that offsets have to be > > interpreted relative to the section offset from the package index. > > .debug_abbrev.dwo is already covered, so sprinkle around calls to > > dwarf_cu_dwp_section_info for the remaining sections: .debug_line.dwo, > > .debug_loclists.dwo/.debug_loc.dwo, .debug_str_offsets.dwo, > > .debug_macro.dwo/.debug_macinfo.dwo, and .debug_rnglists.dwo. With all > > of that in place, we can finally test various libdw functions on dwp > > files. > > This looks good, but obviously needs some earlier patches. [snip] > > @@ -1222,18 +1223,22 @@ __libdw_cu_ranges_base (Dwarf_CU *cu) > > } > > else > > { > > + Dwarf_Off dwp_offset = 0; > > + dwarf_cu_dwp_section_info (cu, DW_SECT_RNGLISTS, &dwp_offset, NULL); > > Shouldn't we check there wasn't an error? Yeah, I was a little confused by the error handling in these foo_base functions. It doesn't seem like most of the callers are checking for errors. The foo_base functions also seem to be treating invalid attributes as if they don't exist (e.g., when dwarf_formudata returns an error): if (dwarf_attr (&cu_die, DW_AT_rnglists_base, &attr) != NULL) { Dwarf_Word off; if (dwarf_formudata (&attr, &off) == 0) offset += off; } So I suppose the equivalent for this change would be Dwarf_Off dwp_offset = 0; if (dwarf_cu_dwp_section_info (cu, DW_SECT_RNGLISTS, &dwp_offset, NULL) == 0) offset = dwp_offset; [snip] Thanks!