Hi Aaron,

On Mon, Jul 20, 2026 at 10:33:30PM -0400, Aaron Merey wrote:
> On Fri, Jul 10, 2026 at 6:35 PM Mark Wielaard <[email protected]> wrote:
> > +/* Returns the version, is_dwp flag, filepath, and ID from the
> > +   .debug_dwp section if found in the DWARF file.  On success, the
> > +   version and is_supp flag value, filepath pointer, and ID pointer
> 
> This should say "and is_dwp" instead of "and is_supp".

Oops. Fixed.

> > +   are written to the output parameters (if not NULL), and the
> > +   positive length of the ID is returned.  The is_dwp flag value is
> > +   one if the Dwarf object represents a package file, zero otherwise.
> > +   The filepath and ID pointers are valid as long as the Dwarf object
> > +   is valid.  Returns 0 if the DWARF file lacks a .debug_dwp section.
> > +   Returns -1 in case of malformed data or other errors.  Currently
> > +   only version 6 is supported.  */
> 
> The specs for .debug_sup and .debug_dwp say the ID length can be 0 if no
> ID is provided. dwelf_dwarf_debug_dwp and dwelf_dwarf_debug_sup return 0
> in this case but the header comments for these functions state that a
> return value of 0 indicates that there is no .debug_dwp or .debug_sup
> section.

O, I totally missed that. But yes, it does say that. You could have
just no id, but just a filepath.

> Should the return value distinguish between no ID and no section?  Or
> just change the comments to say that 0 indicates either no ID or no
> section?

Probably best to change the code so that if zero is returned because
there is no section, then the filepath and id references (if given)
are set to NULL. Otherwise they would be valid pointers. A possibly
empty string for filepath and a valid pointer for id (which shouldn't
be dereferenced, because it points to zero id bytes). Then the user
can find out for themselves which it is. And try to just use the
filepath if it is all they have.

I'll sent a new version.

Thanks,

Mark

Reply via email to