mstange / samply

Command-line sampling profiler for macOS and Linux
Apache License 2.0
2.18k stars 56 forks source link

Loading kernel symbols does not work #163

Open ishitatsuyuki opened 5 months ago

ishitatsuyuki commented 5 months ago

Kernel image entries will have a name of [kernel.kallsyms] and a debug path of /usr/lib/debug/boot/vmlinux-{linux_version} (ref). However, this is ignored by get_candidate_paths_for_debug_file, as it only tries to open the file directly if it's named like a PDB.

I first thought of treating kallsyms like PDB, so that the debug file is consulted directly (and if I do a local modification like this, kernel symbol loads). But on second thought, I'm not sure why the debug file is not consulted directly in all cases? Would that break something?

mstange commented 5 months ago

Oh, good point, that seems like an oversight. Yes, always trying the debug path in get_candidate_paths_for_debug_file should work, as long as it's done towards the end, e.g. just before trying the regular path. And then the path can be tried only if it's different from the debug path.

So yeah, the only thing we want to avoid is to check the debug path before other sources that have a higher likelihood of containing debug symbols.