Bug 27639 - Unknown DWARF DW_FORM_0x1f20 (GNU_ref_alt) and DWARF DW_FORM_0x1f21 (strp_alt)
Summary: Unknown DWARF DW_FORM_0x1f20 (GNU_ref_alt) and DWARF DW_FORM_0x1f21 (strp_alt)
Status: RESOLVED FIXED
Alias: None
Product: debugedit
Classification: Unclassified
Component: debugedit (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-24 06:16 UTC by Matthias Klose
Modified: 2022-12-28 21:41 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2021-03-24 06:16:30 UTC
debugedit warns about unknown sections DWARF DW_FORM_0x1f20 and DWARF DW_FORM_0x1f21, when called for a binary which has been processed by dwz.

These warnings should not be emitted when debugedit is just called to change the build-id.
Comment 1 Mark Wielaard 2022-04-20 18:28:35 UTC
(In reply to Matthias Klose from comment #0)
> debugedit warns about unknown sections DWARF DW_FORM_0x1f20 and DWARF
> DW_FORM_0x1f21, when called for a binary which has been processed by dwz.
> 
> These warnings should not be emitted when debugedit is just called to change
> the build-id.

How exactly are you calling debugedit? Which arguments are used?

And what exact warning do you see? unknown section names or unknown DWARF FORMs?

In theory warnings about unknown forms should only be emitted when edit_dwarf2 is called. Which is guarded by:

          if (!(do_build_id && no_recompute_build_id && !base_dir && !dest_dir)
              && name != NULL && strcmp (name, ".debug_info") == 0)
            edit_dwarf2 (dso);
Comment 2 Loïc Minier 2022-11-05 17:56:32 UTC
I believe it's called by debhelper/dh_strip like this:
debugedit --build-id --build-id-seed=$seed $file

https://git.launchpad.net/ubuntu/+source/debhelper/tree/dh_strip#n300
Comment 3 Mark Wielaard 2022-12-28 21:28:36 UTC
(In reply to Loïc Minier from comment #2)
> I believe it's called by debhelper/dh_strip like this:
> debugedit --build-id --build-id-seed=$seed $file
> 
> https://git.launchpad.net/ubuntu/+source/debhelper/tree/dh_strip#n300

Aha, I see the logic for when to skip parsing the DIE tree is wrong.
It only skips dwarf_edit2 when debugedit is invoked with -n -i and no base and destdir are given, but it should skip calling dwarf_edit2 when no base and dessst dir are given and we aren't listing the source files.
Comment 4 Mark Wielaard 2022-12-28 21:41:06 UTC
commit 379b2b95df49d6cebedad3562391c3350882f1a3
Author: Mark Wielaard <mark@klomp.org>
Date:   Wed Dec 28 22:23:01 2022 +0100

    debugedit: Skip calling edit_dwarf2 if not rewriting and/or listing source
    
    We skipped calling edit_dwarf2 when no base and dest dir were given and
    debugedit was invoked with -i -n. But we never need to call edit_dwarf2
    if we aren't rewriting paths and we don't want to list the source files.
    
       * tools/debugedit.c (main): Adjust edit_dwarf2 call guard.
    
    https://sourceware.org/bugzilla/show_bug.cgi?id=27639