dwarf2json
dwarf2json copied to clipboard
Provide feedback when only symbols or only types are produced
There may be an expectation that just providing an elf file, or just providing the system.map will be enough to generate a complete JSON file. It would be awesome to be able to let the user know if the JSON file they've generated won't necessarily work properly (ie, lacking symbols, lacking types, lacking banner/constant_data).
Hey @ikelos, I'm very late to this, but since no one has responded yet, here are my two cents.
System.map only provides symbol addresses, not their types, so it’s not sufficient on its own. In contrast, a vmlinux with debug symbols file includes both symbols and types. There seems to be some confusion—many, including myself, previously thought that both System.map and vmlinux were needed.
In nearly all cases, you only need the vmlinux with debug symbols and do:
$ dwarf2json --elf [vmlinux-x.y.z] | xz -c > linux_x.y.z.json.xz
That's all.
How is System.map generated?
The System.map file is actually generated from vmlinux during the kernel compilation process. The kernel shell script responsible for that is mksysmap.
Essentially, what it does is:
$ nm -n vmlinux > System.map
In newer kernel versions, it has changed a bit and it's now a sed script, and they do something like nm -n <file> | ./mksysmap, but it's basically the same idea.
This is needed because the real System.map is actually a subset of the nm output. mksysmap filters out some of the symbols. That is thoroughly documented within the same script.
Hi Gus, yep, I totally agree with what you've said but I'm pretty sure we've had people generating ISF files from the wrong type of kernel or something and so we recommend the system map as a belt-and-braces solution, which is why I was after a quick way for people to know whether what they've generated had the right data or not. I had quite forgotten I'd filed this though so it can't be that significant of an issue.
Just a very simple status line about the generated file that tells you the number of base types, types, symbols and enums would be really helpful to tell whether the user's provided the right file. Should be pretty easy to put in place?