Given a panic line such as
drm_atomic_connector_get_property+0x1a3/0x340,nm+addr2linemap the symbol and offset back to afile:line.scripts/gaandscripts/pawrap those two steps.
- You need a
vmlinuxwith symbols — build the kernel at least once. - Manual:
nm vmlinux | grep <symbol>→ add the offset →addr2line -e vmlinux -i <addr>. - Or:
scripts/ga <vmlinux> <symbol+offset>prints the firstaddr2lineline (-iinline expansions are cut, so you get the outermost frame). scripts/pa <file>:<line> [context]printscontextlines before/after with the target line highlighted in red (default 8).- Addresses and line numbers are build-specific; the example below is a historical observation from the documented WSL2 kernel and will not match a different build.
nm <kernel-src>/vmlinux | grep drm_atomic_connector_get_property
# ffffffff81d67c10 t drm_atomic_connector_get_property
# ffffffff81d67c00 t __pfx_drm_atomic_connector_get_property
# ffffffff81d67c10 + 0x1a3 = ffffffff81d67db3
addr2line -e <kernel-src>/vmlinux -i ffffffff81d67db3
# <kernel-src>/drivers/gpu/drm/drm_atomic_uapi.c:808
awk 'NR>=800 && NR<=816 {print NR, $0}' \
<kernel-src>/drivers/gpu/drm/drm_atomic_uapi.cThe symbol lookup excludes __-prefixed symbols, which is why
__pfx_drm_atomic_connector_get_property (the function-prefix padding) is not
the one that gets used.
# resolve the RIP to a file:line
./scripts/ga <kernel-src>/vmlinux drm_atomic_connector_get_property+0x1a3
# <kernel-src>/drivers/gpu/drm/drm_atomic_uapi.c:808
# print 8 lines before and after file:line, highlighting the target line
./scripts/pa <kernel-src>/drivers/gpu/drm/drm_atomic_uapi.c:808Both scripts accept --help and use the workspace exit codes (see
scripts/ga, scripts/pa).
WSL stores crash dumps under %LOCALAPPDATA%\Temp\wsl-crashes on the Windows
side; open the most recent kernel-panic-xxxxxxxx.txt.
- The
ffffffff81d67c10/+0x1a3/drm_atomic_uapi.c:808values above are a single historical observation on the documented WSL2 kernel; symbol addresses and line numbers change with every build and config. - The source excerpt that the original tutorial showed at line 808 is omitted here on purpose: it belongs to one kernel revision and would drift again.
- kernel-source-map.md - the files the resolved lines live in
- driver-faq.md - the callbacks that appear in panic traces