[llvm] [DebugInfo] Add clang flag to enable function-level debug line attribution (PR #93985)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 6 07:14:27 PDT 2024
alx32 wrote:
This feature is primarily designed for MachO, so the following explanation is specific to that context:
> There will always be a DW_LNE_set_address opcode that points back to the start of the function.
You're right that this method works well when we're dealing with a single object file. For instance, in `foo.o`, the line entries for the `foo` function will correctly point to the `foo` instructions based on the address, and the same goes for `bar.o` with the `bar` function.
However, the challenge arises when identical functions like `foo` and `bar` are merged during the linking process with Identical Code Folding (ICF). After linking `foo.o` and `bar.o` into a single binary (`out.bin`) and creating a debug symbol file (`out.dSYM`), there will be only one merged function in `out.bin` representing both `foo` and `bar`. In the `out.dSYM`, the line entries for both `foo` and `bar` will point to this single merged function. At this point, it becomes impossible to determine which line entries originally belonged to `foo` and which to `bar`.
Is there currently a way to attribute the line information in `out.dSYM` to either `foo` or `bar` ?
I think one possibility would be to leave the object files as-is and have `dsymutil` add additional attributes to `out.dSYM` - but I don't think this is an approach we take for anything currently.
https://github.com/llvm/llvm-project/pull/93985
More information about the llvm-commits
mailing list