A new ksymoops (code inside)

rubini@pop.systemy.it
Tue, 21 May 1996 02:39:33 +0200 (MET DST)


Hello Linuxers.
Since the version of ksymoops released with the official
kernel lacks a few features, and since Greg McGary told me he isn't
maintaining the source, here's a new version of the tool. It's
called "oops.c", but it's customary.

Feel free to send me any complaint, but please include "oops" as a
substring of the subject line.

The new features of the tool are:
- strips syslog prefixes
- every information in the oops appears in the output, so the
oops itselfcan be discarded after decoding
- decodes registers and stack (tries to give symbolic names to them),
in addition to the code
- shows pointers to stack relative to %esp
- uses symbols in modules from /proc/ksyms
- it's in C (I don't know the plusplus stuff).

The remaining bugs and missing features are the following
- doesn't check /proc/ksyms against the map for mismatches
- works if no map is there, using /proc/ksyms alone -- Hmm....
- should have cmdline options to be more/less aggressive
- doesn't check for module bounds -- should use "ksyms -m"
- it'2 x86 only: it doesn't decode the amusing face of sparc oopses

I feel ksymoops most useful for driver (=module) developers. This is
understandable, as the kernel proper is oopsing less and less...
However, a partial symbol table for a module gives little info
(personally, I export all symbols to the kernel when debugging :)

The code is at the end, uuencoded so you can just pipe it out without
editing. For who's curious, here's the output of the program against
an oops in a "faulty" module (built on purpose). Yes, it's longer, but
there's everything in it, and it's only one screenful with 80x50.

EIP: 0010:0201f030 <faulty_copy+2c/54>
EFLAGS: 00010216
eax: 0000000c
ebx: 00000000
ecx: 00196fb6 <buf+6/400>
edx: 00397018
esi: 00001000
edi: 0800a000
ebp: 00eecf60 <%esp+10>
esp: 00eecf50 <%esp+0>
ds: 0018 es: 0018 fs: 002b gs: 002b ss: 0018
Process cat (pid: 658, process nr: 23, stackpage=00eec000)
esp+0 : 0800a000
esp+4 : 00001000
esp+8 : 00001000
esp+12: 0008ed11
esp+16: 00eecf90 <%esp+40>
esp+20: 0201f083 <faulty_read+2b/88>
esp+24: 0800a000
esp+28: 0201f17c
esp+32: 00001000
esp+36: 0201f135 <faulty_fops+51/98>
esp+40: 0040f1f8
esp+44: 01345140
esp+48: 0800a000
esp+52: 00001000
esp+56: 01345140
esp+60: 0040f1f8
esp+64: 0800a000
esp+68: 00120ec2 <sys_read+aa/bc>
esp+72: 0040f1f8
esp+76: 01345140
esp+80: 0800a000
esp+84: 00001000
esp+88: 00e58018
esp+92: 0800a000
Trace: 0201f083 <faulty_read+2b/88>
Trace: 0201f17c
Trace: 0201f135 <faulty_fops+51/98>
Trace: 00120ec2 <sys_read+aa/bc>
Trace: 0010a459 <system_call+59/a0>
Code: <faulty_copy+2c/54> movl %ebx,%fs:0xfffffffc(%ebp)
Code: <faulty_copy+30/54> movl 0x18c2a4,%eax <jiffies+0/4>
Code: <faulty_copy+35/54> pushl %eax
Code: <faulty_copy+36/54> pushl $0x201f122 <faulty_fops+3e/98>
Code: <faulty_copy+3b/54> call fe0f2fc0 <gcc2_compiled.+fe0f2fc0>

begin 664 oops.c.gz
M'XL(`%(;H3$``[4::V_;1O)S_"LF+!Q+-BU+RLNUPJ!IFBL")&UQ;=`#;".@
MR*5$FR)Y7,J6K_5_OYG977%)KAVW2(F$%O<Q,SL[[]VC_1W8ATMYLRJ*4L+5
M=#2&PT-X`S)=E9F`),UJ44%=0"5DD5T)P*'S(I.0YO`AS=<;^!DG'F;%0B(D
M`O:V*&^J=+&L8?!V")-OOWT./U9B`1^C'\/J!EXM+E??K<)%FF7A*$JC99;&
MHZA8O8;!E:AD6N0P&6V&3D@OX$TFI`SSN"K@W^MYFJ?PJN*_WZ7EU54J1^L\
M+:-16B.X=;FHPEA(@G6TLW/$U/TDKB$18;W&]9Q0@WID7:6X?GDC<2505B))
M-T(V_;&("@2%7%BD$CDB`8G`66%TV0Q:2QRQ*V1)_)++XAK*(LUY-#9D111F
M<!56LC/#XNBJB->X0DBJ8@5'955$1[0W-.,(:`E`<S^F4J;YPK6.:"FB2WLF
MA(LPS64-]5+`*BPA*2I8I7(5UCA6*M9\D^91MHX%O))UG!:CY>MV4Y;.NVT5
M$M!N0\[CT'9;5-^4HMV4D=`<J852#V*/D=NY@(]O_O/YIS<?W\''GW_XO/W`
M-?]WG=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BU[$X>MRVC)>N#+:;A6K:0?!,F7ZJ1Y.G\?7I8ICPS<ZED,2;
M_IF;F[4/L5!,4]^0_TH<1N?AOQRZ=KV5&Y+K>K!YO(L);L_0L,;%4<)\$+R8
M;9V>4A.Z[JAT(`DQ)ZB75;%>++LLN]UIF\4IFT4E632WKL)(?-'AO24,O]%0
MY?;Z"^L:T@VX_GE^2K:0C![9L3LL'M-P\`Q'/,?_+_#_2P?GM;,[ODM=NP[O
M^U#?CE6WY`:[J3JPYF.S"Y<2WR?)MOH=/U#O^%SB<)J>V.HWT#IQ,=Q_IE3P
M;J:HYP$JZK8_C[7;@";3XXBOJ"*R.E&816LTI'3?V:%X1G>/_UZ,@(@BEE.2
MHOY-NH<'3$H=)M.'ZT-;`YZ>F!J/DQ2'\".W[Q+[R[;8JR`-G'\<?M$\]\W[
MVBIS&02]`S3SN%1&,8E59E<.\H)*/RI.9L6YPRP^6'<N'Z@[;'Q:B@.L`']/
M&_Z6`CQ0RDFRV+MW0*C+*2R]SQO95171WI54FT73L>*1@YNJ7&Y*9Q29/*%7
MJR:Z)1\Y%/#1WS!S+*'58LX)?74BV`]R5-:RK0_-0%]QNV'*0TKJ*!ZC3-69
4D/6HLTH0K?H9/O\'[7X]3!$R```B
`
end

--
    __ o   La forza dei forti sta nel traversare le traversie con occhio sereno
   _`\<,                                                          (Paperino)
__( )/( )__     alessandro rubini - rubini@ipvvis.unipv.it