home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!elroy.jpl.nasa.gov!sdd.hp.com!nigel.msen.com!yale.edu!ira.uka.de!Germany.EU.net!hcshh!hm
- From: hm@hcshh.hcs.de (Hellmuth Michaelis)
- Newsgroups: comp.unix.bsd
- Subject: [386BSD] gdb patch for using gdb with coredumps
- Keywords: 386bsd gdb patch coredump
- Message-ID: <1631@hcshh.hcs.de>
- Date: 22 Jan 93 07:42:27 GMT
- Organization: HCS GmbH, Hamburg, Europe
- Lines: 150
-
-
- [I'm posting this for Joerg Wunsch, who is in the moment without news
- access. Please direct all questions, suggestions, flames etc. to him,
- he can still be reached via mail as joerg_wunsch@tcd-dresden.de or
- joerg@sax.de or joerg@ref.tfs.com or wutcd@hadrian.hrz.tu-chemnitz.de.
- Thank you! hellmuth]
-
-
- Hi netters,
-
- when working with GDB, an annoying bug occurs when debugging core
- dumps. GDB always complains about an unreadable stack region if
- one attempts to grab out any stack data (e. g. with the ``where''
- command). I found there's an error in config/i386bsd-dep.c:
- the stack top is reset during `exec_file_command()' to zero
- [and you'll always have to execute this command if you wanna
- debug something]. I've managed the function `core_file_command()'
- to set it to a reasonable value before reading the core file, so
- everything works fine. Btw, the `reasonable value' is offset for
- MAXSSIZ from the constant named USRSTACK (in /usr/include/machine/
- vmparam.h) - I suspect there's still a mistake in /sys/kern/kern_execve.c
- which causes this offset to each user program. But don't bother
- with that, it doesn't harm very much (for now).
-
- To get GDB compiled, you'll have to symlink all /sys/vm/*.h
- files into (existing) /usr/include/vm directory - someone forgot
- this.
-
- When working with kgdb in analyzing kernel core dumps, I found
- it useful to be able to set an arbitrary stack frame to something
- I guess it could be a stack frame. I've extended the existing hooks
- in GDB sources, so it can now be compiled with a macro ``FRAME_
- SPECIFICATOIN_DYADIC'' defined. This allows a third form of the
- frame command:
-
- frame <new_framepointer> <new_programmcounter>
-
- resulting in a new frame (for GDB's idea) being created and making
- it the top one. A general recipe for analyzing kernel core dumps looks
- like:
-
- % cd /sys/compile/YOURMACHINE
- % compile what you feel necessary with `-g' Option
- % size 386bsd; size /var/crash/system.NN should report
- identical section sizes (though 386bsd would be larger)
- % gdb -k 386bsd /var/crash/ram.NN
- (kgdb) up 2
- [ somewhere in trap() ]
- (kgdb) print/x frame
- [ shows you the register contents when system trapped ]
- (kgdb) print/x eva
- [ shows you i386's CR2 contents - useful on vm_fault's ]
- (kgdb) frame frame.tf_ebp frame.tf_eip
- [ That it is! Now your stack is the stack of faulting function;
- look whatever you want to find the failure. e.g.:]
- (kgdb) info args
- [ ... ]
- (kgdb) info locals
- [ ... ]
- ...
-
- Good look!
- J"org
-
- Aah, the patch is built to fit into Terry's patchkit. Put it into
- /patch/inbound, and continue as you used to do. Maybe someone would
- include it ``officially'' sometimes.
-
- begin 644 patchjw003.tar.Z
- M'YV0<,+0&8-&S1T8,&:\`,"PH<.'$"-*G$BQHL6*(#+>J%$#!(",(&%X!)E1
- MY$>2*$6"J#%#QHT9,VS`J$$C8XP8"&]\K'&QI\^?0(-&K#.'3A@Y&0'(>?.&
- MCM")=]"4*</FJ=6K6+-JW<KU:L"!!0\F?`$E")4A2+JJY0K2!HV:)T..)&D2
- M9489,-YF9.ER1EX;+6W&<&OC(XRUB!,/+7HTZ=*F7:-.K:JXLN7+F"N7*$&D
- MR)0A()!0A0,BC1LS;^2T$9CFC1L0<,H@-9.&31D0J)%"$4BPS!S82\_("=-&
- M0=FS2'0D2)"D"10I3ZP4`7&&C!@00YY(F6XD"9/I2((X(<(DB9,C"H)4H8)$
- MN_($2D2D/@/B2ATW<PB"X*'FC>PS7]QQ7WYH`%&''&F$@88+<X2!APMDE.
- M`IU])D424%"1Q!-.Z*#`%5*]1I1I]%5W'1UO@!"A&'70%P8(8Z1V&VVVL5`:
- M'2#<41L;((3!QAUAY/%;C&W`P488IO4HQAMUX!B&&PK<)T<989`1AABV@<#8
- M&&N`,.49K;GA`@A4H)'&;V?BE@8>99`!@AAY:%D&'720J*517'Z!(FDH]JC`
- ME&',X=J56=KA8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,(Z)"`)]`$_RE`9F,'JJ%U6LIV2O
- MUV0:\F2S)V4V-VXR2'<U"%1VN$[M='.4IXXY<AM`TBR<!SJ@IR6Q,0;JF`9=
- MMCBOD7J$U7QYTP*BU2SV<BZTLG5%D0=9@GVG92/K@R:_$2Q%8AL>DG;;UXY(
- M!D^ZN#5?<!0`1#9RD`?)*"LH8`9P8"/GD@+P9`=OD`9NH@(ZN87GTH)[@'-[
- M-&Y8T)0#J25I<))Q4C14DG`O4BYP(RL\LQIYX(`OE"8O(@?T]RFAXAIL$"?]
- MF!%30@<'\AI4N4/'^'QY$XU%"1MCD`(M>([M-`)[*)`PN'I)YGI,QE7S*'M1
- MQD\XJ(A+>3UI8A3#`@*K4Q0@L&&WL34LXS+6F`2`2&-?X`1(!CY)T@8MD$`+
- ME#J)N9A+TP9+P@:_(3O]`@(G4`1!@`77=RLSLA2!%7Y"DF%E<`;EAX.F%IS"
- M.9S$69S&>9S(F9S*N9S,V9S.^9S0&9W2.9W469W6>9W8F9W:N9W<V9W>^9W@
- '&9[B.9Y7`9S(
- `
- end
- --
- >>>>>>> J"org Wunsch <<<<<<< : joerg_wunsch@tcd-dresden.de
- If anything can go wrong... : [...!uunet]!mcsun!unido!textild!joerg_wunsch
- .o .o : alias: joerg@sax.de, joerg@ref.tfs.com,
- <_ ... IT WILL! : wutcd@hadrian.hrz.tu-chemnitz.de
-
-
- --
- hellmuth michaelis HCS Hanseatischer Computerservice GmbH hamburg, europe
- hm@hcshh.hcs.de tel: +49/40/55903-170 fax: +49/40/5591486
-