emscripten-core / emscripten-core/emscripten
Invalid `DW_AT_ranges` for some inlined functions
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
I am trying to wrap my head around something that looks pretty much like corrupt `DW_AT_ranges` for some `inlined_subroutine`s.
I have a few examples here, they might be a bit random, but I was trying to gather a few examples of how the ranges are broken:
A "simple" case where things go wrong, a range going backwards:
```
0x00765086: DW_TAG_subprogram
DW_AT_low_pc (0x0009c6e0)
DW_AT_high_pc (0x0009c985)
0x00765164: DW_TAG_lexical_block
DW_AT_ranges (0x0005e420
[0x0009c7e2, 0x0009c8a5)
[0x00000000, 0x00000001))
0x0076517a: DW_TAG_inlined_subroutine
DW_AT_ranges (0x0005e3f0
[0x0009c7e2, 0x0009c7e0)
[0x0009c88f, 0x0009c8a2))
```
One range going backwards, the other one outside of its parent.
```
0x03185676: DW_TAG_inlined_subroutine
DW_AT_low_pc (0x00509208)
DW_AT_high_pc (0x00509218)
0x0318569a: DW_TAG_inlined_subroutine
DW_AT_ranges (0x0020e268
[0x00509208, 0x00509204)
[0x00509207, 0x00509218))
```
Two overlapping ranges, which add up to the parent range (not sure this is actually invalid, but definitely weird), they also go out of bounds of the parent:
```
0x0308291c: DW_TAG_inlined_subroutine
DW_AT_low_pc (0x004f0aa8)
DW_AT_high_pc (0x004f0aac)
0x03082936: DW_TAG_inlined_subroutine
DW_AT_ranges (0x00206768
[0x004f0aa8, 0x004f0aab)
[0x004f0aa1, 0x004f0aac))
```
This seems like two sibling DIEs, the first has again, a backwards going range, and another one that goes out of bounds of its parent `DW_TAG_lexical_block`. Well at least the sibling seems to fit neatly into the gap between the first two ranges (though the second one goes backwards).
```
0x00a3dc2c: DW_TAG_lexical_block
DW_AT_low_pc (0x000f3b44)
DW_AT_high_pc (0x000f3bb8)
0x00a3dc61: DW_TAG_inlined_subroutine
DW_AT_ranges (0x000915d0
[0x000f3b44, 0x000f3b46)
[0x000f3b4b, 0x000f3b3f)
[0x000f3b42, 0x000f3b52))
0x00a3dc86: DW_TAG_inlined_subroutine
DW_AT_low_pc (0x000f3b46)
DW_AT_high_pc (0x000f3b4b)
```
Contributor guide
Assessment
This issue has not been assessed yet.