home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / bsd / 11698 < prev    next >
Encoding:
Internet Message Format  |  1993-01-22  |  7.6 KB

  1. Path: sparky!uunet!elroy.jpl.nasa.gov!sdd.hp.com!nigel.msen.com!yale.edu!ira.uka.de!Germany.EU.net!hcshh!hm
  2. From: hm@hcshh.hcs.de (Hellmuth Michaelis)
  3. Newsgroups: comp.unix.bsd
  4. Subject: [386BSD] gdb patch for using gdb with coredumps
  5. Keywords: 386bsd gdb patch coredump
  6. Message-ID: <1631@hcshh.hcs.de>
  7. Date: 22 Jan 93 07:42:27 GMT
  8. Organization: HCS GmbH, Hamburg, Europe
  9. Lines: 150
  10.  
  11.  
  12. [I'm posting this for Joerg Wunsch, who is in the moment without news
  13.  access. Please direct all questions, suggestions, flames etc. to him,
  14.  he can still be reached via mail as joerg_wunsch@tcd-dresden.de or
  15.  joerg@sax.de or joerg@ref.tfs.com or wutcd@hadrian.hrz.tu-chemnitz.de.
  16.  Thank you! hellmuth]
  17.  
  18.  
  19. Hi netters,
  20.  
  21. when working with GDB, an annoying bug occurs when debugging core
  22. dumps. GDB always complains about an unreadable stack region if
  23. one attempts to grab out any stack data (e. g. with the ``where''
  24. command). I found there's an error in config/i386bsd-dep.c:
  25. the stack top is reset during `exec_file_command()' to zero
  26. [and you'll always have to execute this command if you wanna
  27. debug something]. I've managed the function `core_file_command()'
  28. to set it to a reasonable value before reading the core file, so
  29. everything works fine. Btw, the `reasonable value' is offset for
  30. MAXSSIZ from the constant named USRSTACK (in /usr/include/machine/
  31. vmparam.h) - I suspect there's still a mistake in /sys/kern/kern_execve.c
  32. which causes this offset to each user program. But don't bother
  33. with that, it doesn't harm very much (for now).
  34.  
  35. To get GDB compiled, you'll have to symlink all /sys/vm/*.h
  36. files into (existing) /usr/include/vm directory - someone forgot
  37. this.
  38.  
  39. When working with kgdb in analyzing kernel core dumps, I found
  40. it useful to be able to set an arbitrary stack frame to something
  41. I guess it could be a stack frame. I've extended the existing hooks
  42. in GDB sources, so it can now be compiled with a macro ``FRAME_
  43. SPECIFICATOIN_DYADIC'' defined. This allows a third form of the
  44. frame command:
  45.  
  46.     frame <new_framepointer> <new_programmcounter>
  47.  
  48. resulting in a new frame (for GDB's idea) being created and making
  49. it the top one. A general recipe for analyzing kernel core dumps looks
  50. like:
  51.  
  52.     % cd /sys/compile/YOURMACHINE
  53.     % compile what you feel necessary with `-g' Option
  54.     % size 386bsd; size /var/crash/system.NN should report
  55.       identical section sizes (though 386bsd would be larger)
  56.     % gdb -k 386bsd /var/crash/ram.NN
  57.     (kgdb) up 2
  58.     [ somewhere in trap() ]
  59.     (kgdb) print/x frame
  60.     [ shows you the register contents when system trapped ]
  61.     (kgdb) print/x eva
  62.     [ shows you i386's CR2 contents - useful on vm_fault's ]
  63.     (kgdb) frame frame.tf_ebp frame.tf_eip
  64.     [ That it is! Now your stack is the stack of faulting function;
  65.     look whatever you want to find the failure. e.g.:]
  66.     (kgdb) info args
  67.     [ ... ]
  68.     (kgdb) info locals
  69.     [ ... ]
  70.     ...
  71.  
  72.         Good look!
  73.         J"org
  74.  
  75. Aah, the patch is built to fit into Terry's patchkit. Put it into
  76. /patch/inbound, and continue as you used to do. Maybe someone would
  77. include it ``officially'' sometimes.
  78.  
  79. begin 644 patchjw003.tar.Z
  80. M'YV0<,+0&8-&S1T8,&:\`,"PH<.'$"-*G$BQHL6*(#+>J%$#!(",(&%X!)E1
  81. MY$>2*$6"J#%#QHT9,VS`J$$C8XP8"&]\K'&QI\^?0(-&K#.'3A@Y&0'(>?.&
  82. MCM")=]"4*</FJ=6K6+-JW<KU:L"!!0\F?`$E")4A2+JJY0K2!HV:)T..)&D2
  83. M9489,-YF9.ER1EX;+6W&<&OC(XRUB!,/+7HTZ=*F7:-.K:JXLN7+F"N7*$&D
  84. MR)0A()!0A0,BC1LS;^2T$9CFC1L0<,H@-9.&31D0J)%"$4BPS!S82\_("=-&
  85. M0=FS2'0D2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P!@D`P(]("IL,@9?T(%A\(%&03*3MX`)<#H@8!"3U%-/\E,SD('PM!PP>`)U
  134. M,@=NP(.=!R1"`GG/0RV"(BMU(BN_X0),^#*1I`+YA`53,`5)H`4]@ERRXQLV
  135. M,G,Y^(+CQB(X<B8_B"/T$B=]DEQOX#K68U'WEC)RX`9U4X+0XED7Q87MM!Q;
  136. M4GBFXB8CR%!2,`54$`1#L`1.&(536(4R8X'=9P:=LBCA4P0^!F0;B(*&QX<J
  137. M(A`I"((XTDY.(`10L&/C5@<N4`<G&"R")S/[UTO]-T8PD4PLT6WHUD)C5`,R
  138. MX(HOH8`9H2ET\`5C<"!3TBS<TGPH`".`4BI?4"[!&($HX"A?\"5GHE<@@`)&
  139. M``5?L!U'X`15T`0I8'L;N!P)P(SG$HTI,(Z)"`)]`$_RE`9F,'JJ%U6LIV2O
  140. MUV0:\F2S)V4V-VXR2'<U"%1VN$[M='.4IXXY<AM`TBR<!SJ@IR6Q,0;JF`9=
  141. MMCBOD7J$U7QYTP*BU2SV<BZTLG5%D0=9@GVG92/K@R:_$2Q%8AL>DG;;UXY(
  142. M!D^ZN#5?<!0`1#9RD`?)*"LH8`9P8"/GD@+P9`=OD`9NH@(ZN87GTH)[@'-[
  143. M-&Y8T)0#J25I<))Q4C14DG`O4BYP(RL\LQIYX(`OE"8O(@?T]RFAXAIL$"?]
  144. MF!%30@<'\AI4N4/'^'QY$XU%"1MCD`(M>([M-`)[*)`PN'I)YGI,QE7S*'M1
  145. MQD\XJ(A+>3UI8A3#`@*K4Q0@L&&WL34LXS+6F`2`2&-?X`1(!CY)T@8MD$`+
  146. ME#J)N9A+TP9+P@:_(3O]`@(G4`1!@`77=RLSLA2!%7Y"DF%E<`;EAX.F%IS"
  147. M.9S$69S&>9S(F9S*N9S,V9S.^9S0&9W2.9W469W6>9W8F9W:N9W<V9W>^9W@
  148. '&9[B.9Y7`9S(
  149. `
  150. end
  151. -- 
  152. >>>>>>> J"org Wunsch <<<<<<< : joerg_wunsch@tcd-dresden.de
  153. If anything can go wrong...  : [...!uunet]!mcsun!unido!textild!joerg_wunsch
  154.      .o .o                   : alias: joerg@sax.de, joerg@ref.tfs.com,
  155.        <_      ... IT WILL!  :        wutcd@hadrian.hrz.tu-chemnitz.de
  156.  
  157.  
  158. -- 
  159. hellmuth michaelis    HCS Hanseatischer Computerservice GmbH   hamburg, europe
  160. hm@hcshh.hcs.de              tel: +49/40/55903-170         fax: +49/40/5591486
  161.