[llvm] [DebugInfo] Add clang flag to enable function-level debug line attribution (PR #93985)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 5 13:20:10 PDT 2024
dwblaikie wrote:
> > adding the assembly first, then using it for LLVM code generation.
> > Which, I think, will mean needing to define some assembly directives
>
> Thank you for the input! I am not very familiar with this part of the codebase. Could you provide some pointers to similar existing functionality or tests that would be relevant to what the first part of this change should be?
>
> The most similar feature to the new `DW_AT_META_stmt_sequence` is `DW_AT_stmt_list`. In the assembly tests, `DW_AT_stmt_list` appears represented like this: [abbr_offset.s:38](https://github.com/llvm/llvm-project/blob/main/llvm/test/DebugInfo/X86/abbr_offset.s#L38)
>
> ```assembly
> .byte 16 # DW_AT_stmt_list
> ...
> .long .Lline_table_start0 # DW_AT_stmt_list
> ```
>
> It seems this representation should also work for `DW_AT_META_stmt_sequence` - without additional changes. Am I missing something, or is there another aspect I should be looking into?
So this works for the line table because the stmt_list refers to the very start of the line table - so the assembly code refers to that label, then later on it emits a label:
```
.section .debug_line,"", at progbits
.Lline_table_start0:
```
Then the assembler emits the line table during assembly.
So it's only possible to refer to the very start of the line table in this way - to refer into the line table at particular locations, it would require assembler features.
```
https://github.com/llvm/llvm-project/pull/93985
More information about the llvm-commits
mailing list