trap and frame address

Beesdeckar <[email protected]>
Newsgroups gmane.os.netbsd.devel.kernel
Organization Soft in Engines
Message-ID <[email protected]>
Hello,
I am trying to analyze crash in kernel module. I already know C code 
line which is reason of crash but I am not able to find how to switch to 
stack which made trap like it is displayed in /var/log/message 
(mutex_enter()...) for investigating it's local argument.

If I understand good I need to load trap frame into gdb with "frame 
address <address>" to see stack before trap  happens, but I don't know 
how to find frame address even I am not sure if my assumption is proper.

What should I try or what to look on ?


gdb with loaded crash dump shows:

(gdb) bt
#0  0xffffffff80239985 in cpu_reboot (howto=howto@entry=260, 
bootstr=bootstr@entry=0x0) at /usr/src/sys/arch/amd64/amd64/machdep.c:717
#1  0xffffffff80cfd6db in kern_reboot (howto=howto@entry=260, 
bootstr=bootstr@entry=0x0) at /usr/src/sys/kern/kern_reboot.c:73
#2  0xffffffff80d345b5 in vpanic (fmt=fmt@entry=0xffffffff813a8010 
"trap", ap=ap@entry=0xffffb80384d5ad48) at /usr/src/sys/kern/subr_prf.c:291
#3  0xffffffff80d3468a in panic (fmt=fmt@entry=0xffffffff813a8010 
"trap") at /usr/src/sys/kern/subr_prf.c:208
#4  0xffffffff8023c185 in trap (frame=0xffffb80384d5ae90) at 
/usr/src/sys/arch/amd64/amd64/trap.c:326
#5  0xffffffff80234a7b in alltraps ()
#6  0x000000000000001a in ?? ()
#7  0x0000000000000002 in ?? ()
...

and /var/log/message shows:

Mar 28 21:10:17 bsd /netbsd: [ 463.7723403] fatal page fault in 
supervisor mode
Mar 28 21:10:17 bsd /netbsd: [ 463.7723403] trap type 6 code 0x2 rip 
0xffffffff8023fb0c cs 0x8 rflags 0x10246 cr2 0x1a ilevel 0x8 rsp 
0xffffb80384d5af88
Mar 28 21:10:17 bsd /netbsd: [ 463.7723403] curlwp 0xffffb266fc5b52c0 
pid 0.97 lowest kstack 0xffffb80384d562c0
Mar 28 21:10:17 bsd /netbsd: [ 463.7723403] panic: trap
Mar 28 21:10:17 bsd /netbsd: [ 463.7723403] cpu2: Begin traceback...
Mar 28 21:10:17 bsd /netbsd: [ 463.7723403] vpanic() at netbsd:vpanic+0x188
Mar 28 21:10:17 bsd /netbsd: [ 463.7723403] panic() at netbsd:panic+0x3c
Mar 28 21:10:17 bsd /netbsd: [ 463.7823380] trap() at netbsd:trap+0xbaf
Mar 28 21:10:17 bsd /netbsd: [ 463.7823380] --- trap (number 6) ---
Mar 28 21:10:17 bsd /netbsd: [ 463.7823380] mutex_enter() at 
netbsd:mutex_enter+0xc
Mar 28 21:10:17 bsd /netbsd: [ 463.7923369] itimer_callout() at 
netbsd:itimer_callout+0x2e
Mar 28 21:10:17 bsd /netbsd: [ 463.7923369] callout_softclock() at 
netbsd:callout_softclock+0xac
Mar 28 21:10:17 bsd /netbsd: [ 463.8023378] softint_dispatch() at 
netbsd:softint_dispatch+0x95
Mar 28 21:10:17 bsd /netbsd: [ 463.8023378] DDB lost frame for 
netbsd:Xsoftintr+0x4c, trying 0xffffb80384d5b0f0
Mar 28 21:10:17 bsd /netbsd: [ 463.8023378] Xsoftintr() at 
netbsd:Xsoftintr+0x4c
Mar 28 21:10:17 bsd /netbsd: [ 463.8023378] --- interrupt ---
Mar 28 21:10:17 bsd /netbsd: [ 463.8023378] bd199e21ddf6cd01:
Mar 28 21:10:17 bsd /netbsd: [ 463.8023378] cpu2: End traceback...

Peter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.