GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2020-01-07T04:18:03Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/17428GHC produces an incorrect DWARF .debug_aranges section in some cases2020-01-07T04:18:03ZSzymon Nowicki-KorgolGHC produces an incorrect DWARF .debug_aranges section in some cases## Summary
When parsing the `.debug_aranges` section of code produced by GHC (for example using the [folly symboliser](https://github.com/facebook/folly/tree/master/folly/experimental/symbolizer)) the parsing fails because of an incorre...## Summary
When parsing the `.debug_aranges` section of code produced by GHC (for example using the [folly symboliser](https://github.com/facebook/folly/tree/master/folly/experimental/symbolizer)) the parsing fails because of an incorrect value of the length field.
The bug seems to be here:
https://gitlab.haskell.org/ghc/ghc/blob/4898df1cc25132dc9e2599d4fa4e1bbc9423cda5/compiler/nativeGen/Dwarf/Types.hs#L233
where the `initialLength` is set to a constant value, while the length should depend on the amount of address range entries in a given section.
It seems to have been introduced in this commit:
https://gitlab.haskell.org/ghc/ghc/commit/4a32bf925b8aba7885d9c745769fe84a10979a53
where the capability to create a `.debug_aranges` section with multiple address ranges was added, but the calculation for `initialLength` was not changed.
## Environment
* GHC version used: 8.4.48.8.2