TEXT   31
how to debug
Guest on 4th February 2023 01:21:45 PM


  1. Here is a brief look at how to debug from the screen
  2. dump that occurs when the kernel panics..
  3.  
  4. Suppose the kernel dump provides an EIP address of
  5.  
  6.    0xC8865270
  7.  
  8. Inspect /var/log/messages looking for where the driver
  9. was last loaded.  Suppose you find:
  10.  
  11. IA 5515: Alloc buffers is at c886235c
  12.  
  13. Then you know that the fault occurred at offset
  14.  
  15.    0xc886235c
  16.  - 0xC8865270
  17.    ==========
  18.          2f14
  19.  
  20. from ia_alloc_buffers
  21.  
  22. Now open the file atm.map and find
  23.  
  24.   0x00000308                ia_alloc_buffers
  25.  
  26. This tells you the fault occured at offset....
  27.  
  28.  
  29.   0x00000308
  30.   +     2f14
  31.   ==========
  32.         321c
  33.  
  34. from the start of the module.
  35.  
  36. Now sort the map file by address and locate the relative
  37. address of the fault...
  38.  
  39.     36  0x00002ff4                ia_host_rx_intr
  40.     37  0x000032e0                ia_recv5u
  41.  
  42. This indicates that the fault occured in  ia_host_rx_intr
  43. since the fault address is greater than 0x00002ff4 but
  44. less than 0x000032e0.
  45.  
  46. Finally find the relative address within ia_host_rx_intr
  47. by subtracting:
  48.  
  49.  0x321c
  50.  - 2ff4
  51.  ======
  52.   0x228
  53.  
  54. To find the faulting instruction add -S to the CFLAGS in
  55. the makefile, touch ia_rfred.c (which contains  ia_host_rx_intr)
  56. and run make.  This creates ia_rfred.s.  Now run
  57.  
  58.   as -A ia_rfred.s > ia_rfred.lst
  59.   or
  60.   as -alh ia_..
  61.  
  62. creating an assembler listing.
  63.  
  64. Locate the start of the offending function in the listing:
  65.  
  66.  959                    .type  ia_host_rx_intr,@function
  67.  960                 ia_host_rx_intr:
  68.  961 0a90 55            pushl %ebp
  69.  962 0a91 57            pushl %edi
  70.  
  71. Here we see that it is at offset 0xa90 in the module
  72.  
  73. Add
  74.  
  75.   0x0a90     The offset of ia_host_rx_intr
  76.  +0x0228     The offset of the fault relative to ia_host_rx_intr
  77.  =======
  78.    0xcb8      The offset of the fault relative to the start of the module
  79.  
  80. Find offset 0xcb8 in the listing
  81.  
  82.  1133 0ca5 E8FCFFFF     call  ia5515_getvcc
  83.  1133      FF
  84.  1134 0caa 83C410       addl  $16, %esp
  85.  1135 0cad 837C2414     cmpl  $64, 20(%esp)
  86.  1135      40
  87.  1136 0cb2 761B         jbe   .L2251
  88.  1137 0cb4 8B442428     movl  40(%esp), %eax
  89.  1138 0cb8 8378081F     cmpl  $31, 8(%eax)
  90.  1139 0cbc 7E15         jle   .L2239
  91.  
  92. The code string shown there  8378081F should match that at the bottom
  93. of the original dump screen.  Finally map that code back to
  94. the source and hopefully figure out what the problem was.
  95.  
  96.  
  97.       ia5515_getvcc(rx_buf->desc->vci & R_VC_MASK, &vcc);
  98.       if ((len > 64) && (vcc->vci > 31))
  99.               /*  (softc->vcctab[vcc->vci].r_ipaddr == 0)) */
  100.       {
  101.          /*  softc->vcctab[vcc->vci].l_ipaddr = ia_ipfromvcc(vcc); */
  102.              ia5515_ips(softc, vcc, skb, 1);
  103.       }
  104.  
  105.       if (vcc != NULL)
  106.       {
  107.          if ((len > 64) && (vcc->vci > 31))
  108.  
  109. Here some diagnostic code had been improperly inserted before
  110. the check for null vcc and the attempt to dereference the
  111. vcc pointer in   0cb8 8378081F     cmpl  $31, 8(%eax) caused
  112. the fault.

Raw Paste

Login or Register to edit or fork this paste. It's free.