Skip to content

Relax condition for DW_DLE_IMPROPER_DWO_ID#315

Merged
davea42 merged 1 commit intodavea42:mainfrom
jeremy-rifkin:jr/improper-dwo
Feb 23, 2026
Merged

Relax condition for DW_DLE_IMPROPER_DWO_ID#315
davea42 merged 1 commit intodavea42:mainfrom
jeremy-rifkin:jr/improper-dwo

Conversation

@jeremy-rifkin
Copy link
Copy Markdown
Contributor

Hello,
Clang has added a flag called -gmodules where when using C++20 modules the compiler omits most DWARF info pertaining to types from object files and instead a debug fission-like link to a pcm file (used by clang for precompiled headers and modules) is used. The CU DIE looks like

0x00005309: Compile Unit: length = 0x00000021, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x0000532e)

0x00005315: DW_TAG_compile_unit
              DW_AT_producer	("clang version 21.1.8 (https://github.com/conda-forge/clangdev-feedstock bd55c85b7753fc7bd9035ad4c72ca6ee803d158f)")
              DW_AT_language	(DW_LANG_C_plus_plus_14)
              DW_AT_name	("cpptrace")
              DW_AT_str_offsets_base	(0x00000008)
              DW_AT_stmt_list	(0x000007a5)
              DW_AT_comp_dir	("/path/to/my/dir")
              DW_AT_GNU_dwo_id	(0xe32a33107ad1afcc)
              DW_AT_dwo_name	("build/files/path/to/module.pcm")

There is a check in dwarf_die_deliv.c which errors when a DW_DLE_IMPROPER_DWO_ID attribute is present but dwarf 4 isn't used, or dwarf 5 and apple clang are used (this part was recently added in b0b8cea).

Since this isn't just an apple clang caveat, and I imagine gcc might do something similar in the future, I think the condition should be relaxed to just checking if the version is before dwarf 4.

Copy link
Copy Markdown
Owner

@davea42 davea42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this seems sensible.
Thanks!

@davea42 davea42 merged commit aeb19e7 into davea42:main Feb 23, 2026
@jeremy-rifkin
Copy link
Copy Markdown
Contributor Author

Thanks so much for the quick reply and merge! This will be very helpful for enabling cpptrace to work with code compiled with -gmodules.

@davea42
Copy link
Copy Markdown
Owner

davea42 commented Feb 24, 2026

I really appreciate your thoughtful and meaningful insights. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants