gdbinit.in 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. # Copyright (C) 2001-2015 Free Software Foundation, Inc.
  2. #
  3. # This file is part of GCC.
  4. #
  5. # GCC is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 3, or (at your option)
  8. # any later version.
  9. #
  10. # GCC is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with GCC; see the file COPYING3. If not see
  17. # <http://www.gnu.org/licenses/>.
  18. define pr
  19. set debug_rtx ($)
  20. end
  21. document pr
  22. Print the full structure of the rtx that is $.
  23. Works only when an inferior is executing.
  24. end
  25. define prl
  26. set debug_rtx_list ($, debug_rtx_count)
  27. end
  28. document prl
  29. Print the full structure of all rtx insns beginning at $.
  30. Works only when an inferior is executing.
  31. Uses variable debug_rtx_count to control number of insns printed:
  32. debug_rtx_count > 0: print from $ on.
  33. debug_rtx_count < 0: print a window around $.
  34. There is also debug_rtx_find (rtx, uid) that will scan a list for UID and print
  35. it using debug_rtx_list. Usage example: set $foo=debug_rtx_find(first, 42)
  36. end
  37. define pt
  38. set debug_tree ($)
  39. end
  40. document pt
  41. Print the full structure of the tree that is $.
  42. Works only when an inferior is executing.
  43. end
  44. define pct
  45. set debug_c_tree ($)
  46. end
  47. document pct
  48. Print the tree that is $ in C syntax.
  49. Works only when an inferior is executing.
  50. end
  51. define pgg
  52. set debug_gimple_stmt ($)
  53. end
  54. document pgg
  55. Print the Gimple statement that is $ in C syntax.
  56. Works only when an inferior is executing.
  57. end
  58. define pgq
  59. set debug_gimple_seq ($)
  60. end
  61. document pgq
  62. Print the Gimple sequence that is $ in C syntax.
  63. Works only when an inferior is executing.
  64. end
  65. define pgs
  66. set debug_generic_stmt ($)
  67. end
  68. document pgs
  69. Print the statement that is $ in C syntax.
  70. Works only when an inferior is executing.
  71. end
  72. define pge
  73. set debug_generic_expr ($)
  74. end
  75. document pge
  76. Print the expression that is $ in C syntax.
  77. Works only when an inferior is executing.
  78. end
  79. define pmz
  80. set mpz_out_str(stderr, 10, $)
  81. end
  82. document pmz
  83. Print the mpz value that is $
  84. Works only when an inferior is executing.
  85. end
  86. define ptc
  87. output (enum tree_code) $.common.code
  88. echo \n
  89. end
  90. document ptc
  91. Print the tree-code of the tree node that is $.
  92. end
  93. define pdn
  94. output $.decl_minimal.name->identifier.id.str
  95. echo \n
  96. end
  97. document pdn
  98. Print the name of the decl-node that is $.
  99. end
  100. define ptn
  101. output $.type.name->decl_minimal.name->identifier.id.str
  102. echo \n
  103. end
  104. document ptn
  105. Print the name of the type-node that is $.
  106. end
  107. define pvt
  108. set debug_vec_tree ($)
  109. end
  110. document pvt
  111. Print the VEC(tree) that is in $.
  112. end
  113. define pdd
  114. set debug_dwarf_die ($)
  115. end
  116. document pdd
  117. Print the dw_die_ref that is in $.
  118. end
  119. define prc
  120. output (enum rtx_code) $.code
  121. echo \ (
  122. output $.mode
  123. echo )\n
  124. end
  125. document prc
  126. Print the rtx-code and machine mode of the rtx that is $.
  127. end
  128. define pi
  129. print $.u.fld[0].rt_rtx@7
  130. end
  131. document pi
  132. Print the fields of an instruction that is $.
  133. end
  134. define pbs
  135. set print_binding_stack ()
  136. end
  137. document pbs
  138. In cc1plus, print the current binding stack, frame by frame, up to and
  139. including the global binding level.
  140. end
  141. define pbb
  142. set debug ($)
  143. end
  144. document pbb
  145. Dump the basic block that is in $, including rtx.
  146. end
  147. define pbm
  148. set bitmap_print (stderr, $, "", "\n")
  149. end
  150. document pbm
  151. Dump the bitmap that is in $ as a comma-separated list of numbers.
  152. end
  153. define pel
  154. output expand_location ($)
  155. echo \n
  156. end
  157. document pel
  158. Print expanded location of $.
  159. end
  160. define pcfun
  161. output debug_function (cfun ? cfun->decl : current_function_decl, 0)
  162. echo \n
  163. end
  164. document pcfun
  165. Print current function.
  166. end
  167. # Define some macros helpful to gdb when it is expanding macros.
  168. macro define __FILE__ "gdb"
  169. macro define __LINE__ 1
  170. macro define __FUNCTION__ "gdb"
  171. macro define __null 0
  172. macro define input_line expand_location(input_location).line
  173. macro define input_filename expand_location(input_location).file
  174. # Gracefully handle aborts in functions used from gdb.
  175. set unwindonsignal on
  176. # Put breakpoints at exit and fancy_abort in case abort is mapped
  177. # to either fprintf/exit or fancy_abort.
  178. b fancy_abort
  179. # Put a breakpoint on internal_error to help with debugging ICEs.
  180. b internal_error
  181. set complaints 0
  182. # Don't let abort actually run, as it will make
  183. # stdio stop working and therefore the `pr' command above as well.
  184. # Put this last because gcc does not reference it any more unless
  185. # USE_SYSTEM_ABORT is defined, so gdb may complain and bail out.
  186. b exit
  187. b abort
  188. # Disable strict type checking. This allows developers to (for example)
  189. # make inferior calls without casting absolute address to a suitable
  190. # pointer type.
  191. set check type off
  192. # Skip all inline functions in tree.h.
  193. # These are used in accessor macros.
  194. # Note that this is added at the end because older gdb versions
  195. # do not understand the 'skip' command.
  196. # See https://sourceware.org/gdb/current/onlinedocs/gdb/Skipping-Over-Functions-and-Files.html
  197. skip file tree.h
  198. # Likewise, skip various inline functions in rtl.h.
  199. skip rtx_expr_list::next
  200. skip rtx_expr_list::element
  201. skip rtx_insn_list::next
  202. skip rtx_insn_list::insn
  203. skip rtx_sequence::len
  204. skip rtx_sequence::element
  205. skip rtx_sequence::insn
  206. skip INSN_UID
  207. skip PREV_INSN
  208. skip SET_PREV_INSN
  209. skip NEXT_INSN
  210. skip SET_NEXT_INSN
  211. skip BLOCK_FOR_INSN
  212. skip PATTERN
  213. skip INSN_LOCATION
  214. skip INSN_HAS_LOCATION
  215. skip JUMP_LABEL_AS_INSN