[llvm] [DebugInfo] Add clang flag to enable function-level debug line attribution (PR #93985)
Paul T Robinson via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 6 10:15:43 PDT 2024
pogo59 wrote:
Without knowing the larger context in which you want to consume the per-function line table pointer, it's harder to know what to suggest. The analysis I mentioned earlier would have to be done in the linker prior to the ICF pass. Now it sounds like you are wanting to leave breadcrumbs for a debugger or other post-link consumer. I'm unfamiliar with .dsym files so I'm not sure what part they play. Is there an RFC or other higher-level description for how all the pieces fit together?
_Assuming_ the new attribute is a reasonable way to go, here's a thought about how to make it work. Have the compiler create a symbol when it wants to emit DW_AT_META_stmt_sequence, and record that symbol somewhere (attached to some per-function data structure that the assembler will be looking at). Then when the assembler gets around to emitting the line table for the function, it can notice the symbol and define it at that point.
Note that if you want the assembler to emit end_sequence at the end of each function's part of the line table, you must begin each sequence with set_address. That is, the line-table generation must behave _as if_ -ffunction-sections was in effect, even if it isn't. That probably wouldn't be too hard to arrange, but you'd need a new option or flag to pass down to the assembler.
https://github.com/llvm/llvm-project/pull/93985
More information about the llvm-commits
mailing list