From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 5C39E3858D34 for ; Thu, 29 Feb 2024 23:49:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5C39E3858D34 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5C39E3858D34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=45.83.234.184 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709250591; cv=none; b=PgaCjAp3U8LjJmbP7PIsjoiecZlwozT7yOXlG9grczInUW92ru6LuVbaKVsfxi7YCobXGy5JDAwzdPANL+o2yW1CJZ5oaIv1Z6mNApkiP775m6BEicXgUghZnCZUPWRsgy/eJG6InC21/UmmrlDsOm+//RqxV6pT6Dh0t1wrDR8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709250591; c=relaxed/simple; bh=bIoPnLfPthLBNsDofUlNrE7fJFgtf4tR0YE3i7+yc/k=; h=Date:From:To:Subject:Message-ID:MIME-Version; b=fIBQCWkEpO2KS1FibuHdJ5a+JvcQHoxhDoIsmVXPRrlGFG8XDyurGSeHY28I5epaBLi7wlzL1y+UcyUriz50rl0qQet5r7GGWZHReXLsefSXSu+x9mXBE/+bIN74wiprvCrhs9AFWqzeFEVZELa5RxfBChrO0JHQr1vUDINopOs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by gnu.wildebeest.org (Postfix, from userid 1000) id 88DA53000400; Fri, 1 Mar 2024 00:49:48 +0100 (CET) Date: Fri, 1 Mar 2024 00:49:48 +0100 From: Mark Wielaard To: Omar Sandoval Cc: elfutils-devel@sourceware.org Subject: Re: [PATCH v3 3/4] libdw: Apply DWARF package file section offsets where appropriate Message-ID: <20240229234948.GF4502@gnu.wildebeest.org> References: <97684319dd59b92e63675ee7df118466df3ca1fe.1708974560.git.osandov@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <97684319dd59b92e63675ee7df118466df3ca1fe.1708974560.git.osandov@fb.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,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: Hi Omar, On Mon, Feb 26, 2024 at 11:32:50AM -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. > > * libdw/dwarf_getlocation.c (initial_offset): Call > dwarf_cu_dwp_section_info and add offset to start_offset. > * libdw/dwarf_getmacros.c (get_macinfo_table): Call > dwarf_cu_dwp_section_info and add offset to line_offset. > (get_offset_from): Call dwarf_cu_dwp_section_info and add offset > to *retp. > * libdw/dwarf_getsrcfiles.c (dwarf_getsrcfiles): Call > dwarf_cu_dwp_section_info and pass offset to > __libdw_getsrclines. > * libdw/dwarf_next_lines.c (dwarf_next_lines): Call > dwarf_cu_dwp_section_info and add offset to stmt_off. > * libdw/libdwP.h (str_offsets_base_off): Call > dwarf_cu_dwp_section_info and add offset. > (__libdw_cu_ranges_base): Ditto. > (__libdw_cu_locs_base): Ditto. > * tests/run-all-dwarf-ranges.sh: Check testfile-dwp-5 and > testfile-dwp-4. > * tests/run-declfiles.sh: Ditto. > * tests/run-get-lines.sh: Ditto. > * tests/run-next-lines.sh: Ditto. > * tests/run-varlocs.sh: Ditto. > * tests/run-get-files.sh: Check testfile-dwp-5, > testfile-dwp-5.dwp, testfile-dwp-4, and testfile-dwp-4.dwp > * tests/run-next-files.sh: Ditto. > * tests/run-dwarf-getmacros.sh: Check testfile-dwp-5 and > testfile-dwp-4-strict. > * tests/run-get-units-split.sh: Ditto. Very nice. So the only changes from V2 are > diff --git a/libdw/dwarf_getsrcfiles.c b/libdw/dwarf_getsrcfiles.c > index 12fdabf2..cd2e5b5a 100644 > --- a/libdw/dwarf_getsrcfiles.c > +++ b/libdw/dwarf_getsrcfiles.c > @@ -64,12 +64,17 @@ dwarf_getsrcfiles (Dwarf_Die *cudie, Dwarf_Files **files, size_t *nfiles) > the table is at offset zero. */ > if (cu->dbg->sectiondata[IDX_debug_line] != NULL) > { > - /* We are only interested in the files, the lines will > - always come from the skeleton. */ > - res = __libdw_getsrclines (cu->dbg, 0, > - __libdw_getcompdir (cudie), > - cu->address_size, NULL, > - &cu->files); > + Dwarf_Off dwp_off; > + if (INTUSE(dwarf_cu_dwp_section_info) (cu, DW_SECT_LINE, > + &dwp_off, NULL) == 0) > + { > + /* We are only interested in the files, the lines will > + always come from the skeleton. */ > + res = __libdw_getsrclines (cu->dbg, dwp_off, > + __libdw_getcompdir (cudie), > + cu->address_size, NULL, > + &cu->files); > + } > } > else > { Looks correct. > diff --git a/libdw/dwarf_next_lines.c b/libdw/dwarf_next_lines.c > index 6a9fe361..a96bd73e 100644 > --- a/libdw/dwarf_next_lines.c > +++ b/libdw/dwarf_next_lines.c > @@ -132,6 +132,11 @@ dwarf_next_lines (Dwarf *dbg, Dwarf_Off off, > && next_cu->unit_type != DW_UT_split_type) > continue; > > + Dwarf_Off dwp_off; > + if (INTUSE(dwarf_cu_dwp_section_info) (next_cu, DW_SECT_LINE, > + &dwp_off, NULL) == 0) > + stmt_off += dwp_off; > + > if (stmt_off == off) > { > *cu = next_cu; Also correct. And the new tests in run-declfiles.sh, run-get-files.sh, run-get-lines.sh, run-next-files.sh and run-next-lines.sh. You are certainly very thorough. Thanks. Pushed, Mark