From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by sourceware.org (Postfix) with ESMTPS id 893203858CD1 for ; Fri, 23 Feb 2024 01:03:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 893203858CD1 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 893203858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::52c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708650229; cv=none; b=jwbcMZHr2TjA0kyCbMOWUukej4hnLQ2ABKk8fsw1hTMYLuDwZIUd/R/uXAYLeDh0/aJRSY3ypCiwHDi08dBRwJxYWl/ZWBJKt4fsDmDa4RHPv7osJVFWiK/qZ9mv6jakLnfSQGyPpm+IsAM2oYCwiSVFdOVXR1yF3Ze51nKZzOM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708650229; c=relaxed/simple; bh=HoutRXD1CfOxrm4rObBkCTGkGWy94jpNwHqMAvCGYZY=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=GhoBsJ4zIRvlmVJ1CICqwvewZL1a9875hO5ImDFAhgjvduW7CdUKkdR7kdO7opx6jcZRlEKXlOzyB9J8fuUJ1We/mFMstqN+iygG0hKh8P57KBVxVrrSr2HBwVfJ47PNzxK3r6ZL7lQFadWNB3TDCoD4Xm/bFuAMeFEvaI+5NAg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-5dbf7b74402so301272a12.0 for ; Thu, 22 Feb 2024 17:03:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20230601.gappssmtp.com; s=20230601; t=1708650226; x=1709255026; 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=FYKrbLFtZr9cEywWr+tr6SArV++F+5qIpE5GM/tUXeU=; b=xAnaItltxKEa9ZVEhcbchcQrXLkhHw+ZkdV+mgsjAuwIT0/lsEJCJVUvC7C52V195+ /PkUt5MnC4LoBgshA4x1NAUWUzIZ+UVI2oHl45kXd4OeLqmlYrvR1VxH4CceA5q2GIMK FkoVvNv1ljRaAL1P6cL9LItAQmZxPWujFWOVglGXUHwGPyWjFqcTAgz6mDsUGHklit3Q pN8IAFzl4/CcQmREnkRw8kARjQ/fMM+zj776Kps8DGaU6cACMmxQtIxIBoAnPsSA9qfo Nq+WEUjqQWw74DtyvVNCZaoYSESv5o8YYzY2YZCNO4wAOlwgP3y3UggsKL5JJSON8f97 VO8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708650226; x=1709255026; 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=FYKrbLFtZr9cEywWr+tr6SArV++F+5qIpE5GM/tUXeU=; b=oiNa8bI+tQIgt25//ysjNGc7kTbwmjvkGLdAexzlH06fypmLsUpqPHRDuHxXHRYxY9 UQQYjTXPcqzNXDU4CflHtWgl7TCuQIOdpqOZvpm7TNtI/7pTWpNq3RI0wfPFx5/V10gD aRwF6Gfel8gB+jpBJw+4QMhseFFGK1GsoY+w1P34J/v6pGQo5SblipHuYmHBiiA/d/39 MLiPrhpDq7OgwTbc5umE8KhQypas7rKf5XIYOgG90HZ17Boz0RZ451lRWG/9gDMd9qjQ UaWi9Luj7ku/wy/DVccLz6AvYiAJB/2L6BF4+U0wIctUM71AXxd12EQVy5TgiIYiRJ95 f/ew== X-Gm-Message-State: AOJu0YzK7C6EthVKVO0nssRl4cLQlwsBNZixVcQD08qhotX/Y1GhiyLo g8N7BmYkofkSE7yba885UXRN76ykc4tPKOrpXniTnt1gsqwbajkR0hn8fHWwHEwPgt54/OiftAE Z X-Google-Smtp-Source: AGHT+IFyv3Dg7jX1lS1JOWyC+Iuh2SW1phtntJ6TIDhg7Hx2xvZxJEpeOyuoVbI2s+Preh2i1vrvaQ== X-Received: by 2002:a05:6a20:1611:b0:19c:9b7b:66a with SMTP id l17-20020a056a20161100b0019c9b7b066amr607965pzj.49.1708650226473; Thu, 22 Feb 2024 17:03:46 -0800 (PST) Received: from telecaster ([2620:10d:c090:400::4:ca24]) by smtp.gmail.com with ESMTPSA id v5-20020a17090ad58500b0029a6f7797d4sm203898pju.0.2024.02.22.17.03.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 17:03:45 -0800 (PST) Date: Thu, 22 Feb 2024 17:03:44 -0800 From: Omar Sandoval To: Mark Wielaard Cc: elfutils-devel@sourceware.org Subject: Re: [PATCH v2 3/4] libdw: Apply DWARF package file section offsets where appropriate Message-ID: References: <824d09edb009fd7cf3befcd871742f8089793c5e.1701854319.git.osandov@fb.com> <2f2aedc63120761bd82663442cef6a5330c80cd6.camel@klomp.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.8 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, Feb 22, 2024 at 04:53:19PM -0800, Omar Sandoval wrote: > On Fri, Feb 16, 2024 at 04:00:47PM +0100, Mark Wielaard wrote: > > Hi Omar, > > > > On Wed, 2023-12-06 at 01:22 -0800, 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. > > > > So the offsets for DW_SECT_INFO, DW_SECT_TYPES and DW_SECT_ABBREV were > > already taken into account when setting up a cu from a dwp. > > > > With this patch __libdw_cu_str_off_base/str_offsets_base_off handles > > DW_SECT_STR_OFFSETS which is used in dwarf_formstring and > > dwarf_getmacros. > > > > __libdw_cu_ranges_base handles DW_SECT_RNGLISTS, which is used by > > dwarf_ranges. And __libdw_formptr has a special case for > > DW_FORM_sec_offset for IDX_debug_ranges && version < 5 && unit_type == > > DW_UT_split_compile to also uses __libdw_cu_ranges_base. > > > > __libdw_cu_locs_base handles DW_SECT_LOCLISTS which is used in > > dwarf_getlocation through initial_offset. I do wonder why the special > > case in __libdw_formptr isn't needed here too. > > > > dwarf_getmacros handles DW_SECT_MACRO through get_offset_from. And when > > the macros need to refer to the line table, it also handles > > DW_SECT_LINE. > > > > Don't we also need to handle DW_SECT_LINE in dwarf_getsrclines and > > dwarf_next_lines when looking for DW_AT_stmt_list? > > .debug_line is the odd one out in split DWARF: the skeleton file > contains the full .debug_line, and the DWO or DWP files have a skeleton > .debug_line.dwo that only contains the directory and file name tables > (for DW_AT_file and macro info to reference). dwarf_getsrclines and co. > read from the skeleton file, not the DWP file, meaning they shouldn't > use DW_SECT_LINE. Ah, I guess you can call dwarf_getsrclines/dwarf_next_lines on the dwp file itself, where DW_SECT_LINE may be applicable. I need to think about that some more...