public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: Mark Wielaard <mark@klomp.org>
Cc: elfutils-devel@sourceware.org
Subject: Re: [PATCH v2 3/4] libdw: Apply DWARF package file section offsets where appropriate
Date: Thu, 22 Feb 2024 17:03:44 -0800	[thread overview]
Message-ID: <Zdfu8BTlOPIDAcIA@telecaster> (raw)
In-Reply-To: <Zdfsfznp_flK4aT6@telecaster>

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...

  reply	other threads:[~2024-02-23  1:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06  9:22 [PATCH v2 0/4] elfutils: DWARF package (.dwp) file support Omar Sandoval
2023-12-06  9:22 ` [PATCH v2 1/4] libdw: Parse DWARF package file index sections Omar Sandoval
2024-02-15 17:40   ` Mark Wielaard
2023-12-06  9:22 ` [PATCH v2 2/4] libdw: Try .dwp file in __libdw_find_split_unit() Omar Sandoval
2024-02-15 23:17   ` Mark Wielaard
2023-12-06  9:22 ` [PATCH v2 3/4] libdw: Apply DWARF package file section offsets where appropriate Omar Sandoval
2024-02-16 15:00   ` Mark Wielaard
2024-02-23  0:53     ` Omar Sandoval
2024-02-23  1:03       ` Omar Sandoval [this message]
2024-02-24 14:00         ` Mark Wielaard
2024-02-26 19:31           ` Omar Sandoval
2024-02-24 13:30       ` Mark Wielaard
2023-12-06  9:22 ` [PATCH v2 4/4] libdw: Handle overflowed DW_SECT_INFO offsets in DWARF package file indexes Omar Sandoval
2024-01-04  0:53 ` [PATCH v2 0/4] elfutils: DWARF package (.dwp) file support Omar Sandoval

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zdfu8BTlOPIDAcIA@telecaster \
    --to=osandov@osandov.com \
    --cc=elfutils-devel@sourceware.org \
    --cc=mark@klomp.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).