[lld] [llvm] [Symbolizer] Support for Missing Line Numbers. (PR #82240)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 14 01:40:37 PDT 2024


ampandey-1995 wrote:

> I think part of the problem with the test complexity is because you are trying to use a fully linked object file as the input to the test. Converting it into YAML doesn't really do much other than change its representation from an ELF object into a YAML description of that ELF object. Usually, when we talk about using yaml2obj to generate test inputs, we are using a dramatically pared down version of an object, something that no linker would ever produce. For example, most of the sections in your YAML file are probably unnecessary for the test, so you should remove them. Remember the thing you're testing doesn't need to be some completely runnable program, it just needs to have sufficient symbols/debug info etc to exercise the behaviour in llvm-symbolizer that you want to test.
> Additionally, obj2yaml doesn't really understand how to generate proper DWARF section descriptions in YAML, so falls back to using hex descriptions, which are, as @bd1976bris has pointed out, opaque and unreadable.

Actually, I took the inference from the test ```llvm-project/llvm/test/tools/llvm-symbolizer/data-location.yaml``` for the creation of ```approximation-line-handcrafted.yaml```.  I can remove some of the unnecessary symbols from the yaml if it's ok.

> yaml2obj DOES understand special descriptions that allow you to describe by hand the line table, for example (see the yaml2obj tests I pointed out before at llvm/test/tools/yaml2obj/ELF/DWARF), but you'll need to write these yourself, taking inspiration from an existing object for how the line table might be structured, rather than just trying to use obj2yaml to make them.

Ok , So I think then If it's ok for everyone. I will create the line-table taking inference from ```llvm/test/tools/yaml2obj/ELF/DWARF```

> I'll leave it to the main reviewers to guide you in more detail, but if all you really care about testing is a line table with linked addresses in it (some of which are 0), you could start out by building a line table that you want in YAML (or asm) then add the necessary other bare minimum scaffolding to make it work. IIRC, you don't actually even need the .text to contain the addresses you have listed, as long as you have appropriate debug data and symbols, so your addresses could be fairly arbitrary.

Ok , Will try to amend the current test ```approximate-line-handcrafted.yaml``` which is similar in format to ```llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml```.

https://github.com/llvm/llvm-project/pull/82240


More information about the llvm-commits mailing list