Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide feedback when only symbols or only types are produced #22

Open
ikelos opened this issue Aug 12, 2020 · 3 comments
Open

Provide feedback when only symbols or only types are produced #22

ikelos opened this issue Aug 12, 2020 · 3 comments

Comments

@ikelos
Copy link
Member

ikelos commented Aug 12, 2020

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

@gcmoreira
Copy link

gcmoreira commented Aug 11, 2024

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.

@ikelos
Copy link
Member Author

ikelos commented Aug 11, 2024

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.

@ikelos
Copy link
Member Author

ikelos commented Aug 11, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants