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