gdbinit 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. # -*- GDB-Script -*-
  2. handle SIGPWR noprint nostop
  3. handle SIGXCPU noprint nostop
  4. define newline
  5. call (void)scm_newline (scm_current_error_port ())
  6. end
  7. define pp
  8. call (void)scm_call_1 (scm_variable_ref (scm_c_module_lookup (scm_c_resolve_module ("ice-9 pretty-print"), "pretty-print")), $arg0)
  9. end
  10. define gdisplay
  11. call (void)scm_display ($arg0, scm_current_error_port ())
  12. newline
  13. end
  14. define gwrite
  15. call (void)scm_write ($arg0, scm_current_error_port ())
  16. newline
  17. end
  18. define sputs
  19. call (void)scm_puts ($arg0, scm_current_error_port ())
  20. end
  21. define gslot
  22. print ((SCM**)$arg0)[1][$arg1]
  23. end
  24. define pslot
  25. gslot $arg0 $arg1
  26. gwrite $
  27. end
  28. define lforeach
  29. set $l=$arg0
  30. while $l != 0x404
  31. set $x=scm_car($l)
  32. $arg1 $x
  33. set $l = scm_cdr($l)
  34. end
  35. end
  36. define modsum
  37. modname $arg0
  38. gslot $arg0 1
  39. set $uses=$
  40. output "uses:\n"
  41. lforeach $uses modname
  42. end
  43. define moduses
  44. pslot $arg0 1
  45. end
  46. define modname
  47. pslot $arg0 5
  48. end
  49. define modkind
  50. pslot $arg0 6
  51. end
  52. define car
  53. call scm_car ($arg0)
  54. end
  55. define cdr
  56. call scm_cdr ($arg0)
  57. end
  58. define smobwordtox
  59. set $x=((SCM*)$arg0)[$arg1]
  60. end
  61. define smobdatatox
  62. smobwordtox $arg0 1
  63. end
  64. define program_objcode
  65. smobdatatox $arg0
  66. set $objcode=$x
  67. smobdatatox $objcode
  68. p *(struct scm_objcode*)$x
  69. end
  70. define proglocals
  71. set $i=bp->nlocs
  72. while $i > 0
  73. set $i=$i-1
  74. gwrite fp[bp->nargs+$i]
  75. end
  76. end
  77. define progstack
  78. set $x=sp
  79. while $x > stack_base
  80. gwrite *$x
  81. set $x=$x-1
  82. end
  83. end
  84. define tc16
  85. p ((scm_t_bits)$arg0) & 0xffff
  86. end
  87. define smobdescriptor
  88. p scm_smobs[0xff & (((scm_t_bits)$arg0) >> 8)]
  89. end
  90. define vmstackinit
  91. set $vmsp=sp
  92. set $vmstack_base=stack_base
  93. set $vmfp=fp
  94. set $vmbp=bp
  95. set $vmframe=0
  96. end
  97. define nextframe
  98. set $orig_vmsp=$vmsp
  99. while $vmsp > $vmstack_base
  100. output $orig_vmsp - $vmsp
  101. sputs "\t"
  102. output $vmsp
  103. sputs "\t"
  104. gwrite *$vmsp
  105. set $vmsp=$vmsp-1
  106. end
  107. newline
  108. sputs "Frame "
  109. output $vmframe
  110. newline
  111. sputs "ra:\t"
  112. output $vmsp
  113. sputs "\t"
  114. output (SCM*)*$vmsp
  115. set $vmsp=$vmsp-1
  116. newline
  117. sputs "mvra:\t"
  118. output $vmsp
  119. sputs "\t"
  120. output (SCM*)*$vmsp
  121. set $vmsp=$vmsp-1
  122. newline
  123. sputs "dl:\t"
  124. output $vmsp
  125. sputs "\t"
  126. set $vmdl=(SCM*)(*$vmsp)
  127. output $vmdl
  128. newline
  129. set $vmsp=$vmsp-1
  130. set $vmnlocs=(int)$vmbp->nlocs
  131. while $vmnlocs > 0
  132. sputs "loc #"
  133. output $vmnlocs
  134. sputs ":\t"
  135. output $vmsp
  136. sputs "\t"
  137. gwrite *$vmsp
  138. set $vmsp=$vmsp-1
  139. set $vmnlocs=$vmnlocs-1
  140. end
  141. set $vmnargs=(int)$vmbp->nargs
  142. while $vmnargs > 0
  143. sputs "arg #"
  144. output $vmnargs
  145. sputs ":\t"
  146. output $vmsp
  147. sputs "\t"
  148. gwrite *$vmsp
  149. set $vmsp=$vmsp-1
  150. set $vmnargs=$vmnargs-1
  151. end
  152. sputs "prog:\t"
  153. output $vmsp
  154. sputs "\t"
  155. gwrite *$vmsp
  156. set $vmsp=$vmsp-1
  157. newline
  158. if $vmdl
  159. set $vmfp=$vmdl
  160. set $vmbp=(struct scm_objcode*)((SCM*)(((SCM*)($vmfp[-1]))[1])[1])
  161. set $vmstack_base=$vmfp+$vmbp->nargs+$vmbp->nlocs+4
  162. set $vmframe=$vmframe+1
  163. newline
  164. end
  165. end
  166. define vmstack
  167. vmstackinit
  168. while $vmsp > vp->stack_base
  169. nextframe
  170. end
  171. end
  172. define inst
  173. p scm_instruction_table[$arg0]
  174. end
  175. define gbt
  176. call scm_display_backtrace (scm_make_stack(0x404,0x304), scm_current_error_port (), 0x704, 0x704, 0x704)
  177. end