[all-commits] [llvm/llvm-project] 464f65: [DebugInfo][DWARF] Utilize DW_AT_LLVM_stmt_sequenc...
alx32 via All-commits
all-commits at lists.llvm.org
Thu Feb 6 15:41:51 PST 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 464f65adacd812aead775308ab7f1952fee774db
https://github.com/llvm/llvm-project/commit/464f65adacd812aead775308ab7f1952fee774db
Author: alx32 <103613512+alx32 at users.noreply.github.com>
Date: 2025-02-06 (Thu, 06 Feb 2025)
Changed paths:
M llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
M llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
M llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
Log Message:
-----------
[DebugInfo][DWARF] Utilize DW_AT_LLVM_stmt_sequence attr in line table lookups (#123391)
**Summary**
Add support for filtering line table entries based on
`DW_AT_LLVM_stmt_sequence` attribute when looking up address ranges.
This ensures that line entries are correctly attributed to their
corresponding functions, even when multiple functions share the same
address range due to optimizations.
**Background**
In https://github.com/llvm/llvm-project/pull/110192 we added support to
clang to generate the `DW_AT_LLVM_stmt_sequence` attribute for
`DW_TAG_subprogram`'s. Corresponding RFC: [New DWARF Attribute for
Symbolication of Merged
Functions](https://discourse.llvm.org/t/rfc-new-dwarf-attribute-for-symbolication-of-merged-functions/79434)
The `DW_AT_LLVM_stmt_sequence` attribute allows accurate attribution of
line number information to their corresponding functions, even in
scenarios where functions are merged or share the same address space due
to optimizations like Identical Code Folding (ICF) in the linker.
**Implementation Details**
The patch modifies `DWARFDebugLine::lookupAddressRange` to accept an
optional DWARFDie parameter. When provided, the function checks if the
`DIE` has a `DW_AT_LLVM_stmt_sequence` attribute. This attribute
contains an offset into the line table that marks where the line entries
for this DIE's function begin.
If the attribute is present, the function filters the results to only
include line entries from the sequence that starts at the specified
offset. This ensures that even when multiple functions share the same
address range, we return only the line entries that actually belong to
the function represented by the DIE.
The implementation:
- Adds an optional DWARFDie parameter to lookupAddressRange
- Extracts the `DW_AT_LLVM_stmt_sequence` offset if present
- Modifies the address range lookup logic to filter sequences based on
their offset
- Returns only line entries from the matching sequence
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list