[llvm] [DebugInfo][DWARF] Emit Per-Function Line Table Offsets and End Sequences (PR #110192)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 25 11:54:47 PDT 2024
alx32 wrote:
About the issues found by @rastogishubham [above](https://github.com/llvm/llvm-project/pull/110192#issuecomment-2427949464) - these need some context to explain:
Timeline:
- Originally this feature was published as https://github.com/llvm/llvm-project/pull/93985 (now closed, very similar to this PR).
- https://github.com/llvm/llvm-project/pull/93985 was designed to be as rebase-friendly as possible with the implementation of `-fcas-friendly-debug-info` within the Apple branch.
- In https://github.com/llvm/llvm-project/pull/93985 it [was requested](https://github.com/llvm/llvm-project/pull/93985#issuecomment-2146191315) that this feature also be supported in the MC layer.
- MC layer support was added in https://github.com/llvm/llvm-project/pull/99710
- Now, I published this PR with not much changes from the original now-closed https://github.com/llvm/llvm-project/pull/93985 , wanting to keep compatibility with `-fcas-friendly-debug-info` feature.
- The issue is that I didn't fully account for how the MC layer changes interacted with the original https://github.com/llvm/llvm-project/pull/93985, leading to the issues that @rastogishubham pointed out.
The specific issue is that in the MC layer change, if a `MCDwarfLineEntry` has a valid `LineStreamLabel` then it will only be used for generating the line label, and the rest of the information in the `MCDwarfLineEntry` will be ignored - see [code](https://github.com/alx32/llvm-project/blob/main/llvm/lib/MC/MCDwarf.cpp#L202).
This behavior is basically required in the MC layer as `.loc_label` is a separate instruction.
This behavior lead to the issue @rastogishubham pointed out where valid `MCDwarfLineEntry` entries were being ignored because they had a `LineStreamLabel` attached.
The reason for the above context is to bring up another issue - after the MC change, the behavior is that if a `LineStreamLabel` is specified then the current line sequence will also be terminated. If we want to use `LineStreamLabel` in the current change, then this behavior will be inherited, leading to conflicts to how the "end current sequence" behavior is implemented for the `-fcas-friendly-debug-info` feature.
So it looks like the options here are:
1. Diverge this feature from the implementation of `-fcas-friendly-debug-info` - similar to [this comment](https://github.com/llvm/llvm-project/pull/110192#discussion_r1809635007). This means that `-fcas-friendly-debug-info` can't really share the functionality of this feature directly, as currently implemented in the Apple branch, but there should not be problems merging them together.
2. Add a `MCDwarfLineEntry::LineStreamLabel_NoEndSequence` or simliar field and basically bypass the MC changes and go back to an implementation similar to the original https://github.com/llvm/llvm-project/pull/93985 where there will be some overlap with `-fcas-friendly-debug-info`.
I think Nr.2 above would not be ideal - but still wanted to present it as an option.
I'll update this PR to an implementation of Nr.1 above so we can see how that would look like.
https://github.com/llvm/llvm-project/pull/110192
More information about the llvm-commits
mailing list