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

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 14 00:54:25 PDT 2024


jh7370 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. 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.

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.

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


More information about the llvm-commits mailing list