gdbinit 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #
  2. # Commands useful for debugging the Scheme48 VM.
  3. #
  4. #Set a breakpoint at label "raise".
  5. #Obtain the proper line number using "egrep -n raise: scheme48vm.c".
  6. break scheme48vm.c:5227
  7. display/i $pc
  8. define pcont
  9. echo template id = \
  10. output *(long *)((*(long *)(($ & ~3) + 8) & ~3) + 4) / 4
  11. echo \npc = \
  12. output (*(long *)(($ & ~3) + 4) / 4)
  13. echo \nparent = \
  14. output *(long *)($ & ~3)
  15. echo \nenv = \
  16. output *(long *)(($ & ~3) + 12)
  17. echo \ncount = \
  18. output *(long *)(($ & ~3) - 4) >> 10
  19. echo \n
  20. end
  21. #
  22. document pcont
  23. Print $ as a continuation.
  24. end
  25. define parent
  26. print *(long *)($ & ~3)
  27. pcont
  28. end
  29. #
  30. document parent
  31. Select parent continuation.
  32. end
  33. define preview
  34. set $cont = ScontS
  35. preview-loop
  36. end
  37. #
  38. define preview-loop
  39. output $cont
  40. echo \040
  41. output *(long *)((*(long *)(($cont & ~3) + 8) & ~3) + 4) / 4
  42. echo \n
  43. set $cont = *(long *)($cont & ~3)
  44. preview-loop
  45. end
  46. #
  47. document preview
  48. Display Scheme stack trace. Look up the template uids in the .debug file.
  49. end
  50. define show-header
  51. echo Header length:\
  52. output $hdr >> 8
  53. echo \ type:\040
  54. output ($hdr & 127) >> 2
  55. echo \ tag:\040
  56. output $hdr & 3
  57. echo \n
  58. end
  59. define look
  60. output ($ - Snewspace_beginS)
  61. echo :\n
  62. set $hdr = *(long *)($ - 7)
  63. show-header
  64. output *(long *)($ - 3)
  65. echo \n
  66. output *(long *)($ + 1)
  67. echo \n
  68. output *(long *)($ + 5)
  69. echo \n
  70. end
  71. define go0
  72. print *(long *)($ - 3)
  73. end
  74. define bytes
  75. set $foo = RScode_pointerS
  76. output (int)*(unsigned char *)($foo + 0)
  77. echo \040
  78. output (int)*(unsigned char *)($foo + 1)
  79. echo \040
  80. output (int)*(unsigned char *)($foo + 2)
  81. echo \040
  82. output (int)*(unsigned char *)($foo + 3)
  83. echo \040
  84. output (int)*(unsigned char *)($foo + 4)
  85. echo \n
  86. end