Support TI mode and soft float on PA64
[official-gcc.git] / gcc / gdbinit.in
blob7d7c2be22970c69efce799942fac8d9465df6fb5
1 # Copyright (C) 2001-2021 Free Software Foundation, Inc.
3 # This file is part of GCC.
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.
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.
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/>.
19 define help-gcc-hooks
20 help help-gcc-hooks
21 end
23 document help-gcc-hooks
24 GCC gdbinit file introduces several debugging shorthands:
26     pr [rtx], prl [rtx], prc [rtx], pi [rtx_insn],
27     pt [tree], pct [tree], ptc [tree], trt [tree],
28     pgs [tree], pge [tree], pdn [tree], ptn [tree],
29     pgg [gimple], pgq [gimple_seq],
30     pmz [mpz_t],
31     pdd [dw_die_ref],
32     pbm [bitmap],
33     pel [location_t],
34     pp, pbs, pcfun
36 They are generally implemented by calling a function that prints to stderr,
37 and therefore will not work when the compiler is not executing.
39 Most shorthands accept an optional argument. When it is not supplied,
40 they use value in GDB register $, i.e. the last printed value.
41 end
43 define pp
44 eval "set $debug_arg = $%s", $argc ? "arg0" : ""
45 call debug ($debug_arg)
46 end
48 document pp
49 GCC hook: debug (<multiple overloads>)
50 Print a representation of any GCC data structure for which an instance of
51 overloaded function 'debug' is available.
52 See also 'help-gcc-hooks'.
53 end
55 define pr
56 eval "set $debug_arg = $%s", $argc ? "arg0" : ""
57 call debug_rtx ($debug_arg)
58 end
60 document pr
61 GCC hook: debug_rtx (rtx)
62 Print the full structure of given rtx.
63 See also 'help-gcc-hooks'.
64 end
66 define prl
67 eval "set $debug_arg = $%s", $argc ? "arg0" : ""
68 call debug_rtx_list ($debug_arg, debug_rtx_count)
69 end
71 document prl
72 GCC hook: debug_rtx_list (rtx)
73 Print the full structure of all rtx insns beginning at given rtx.
74 Uses variable debug_rtx_count to control number of insns printed:
75   debug_rtx_count > 0: print from given rtx on.
76   debug_rtx_count < 0: print a window around given rtx.
78 There is also debug_rtx_find (rtx, uid) that will scan a list for UID and print
79 it using debug_rtx_list. Usage example: set $foo=debug_rtx_find(first, 42)
80 end
82 define pt
83 eval "set $debug_arg = $%s", $argc ? "arg0" : ""
84 call debug_tree ($debug_arg)
85 end
87 document pt
88 GCC hook: debug_tree (tree)
89 Print the full structure of given tree.
90 See also 'help-gcc-hooks'.
91 end
93 define pct
94 eval "set $debug_arg = $%s", $argc ? "arg0" : ""
95 call debug_c_tree ($debug_arg)
96 end
98 document pct
99 GCC hook: debug_c_tree (tree)
100 Print given tree in C syntax.
101 See also 'help-gcc-hooks'.
104 define pgg
105 eval "set $debug_arg = $%s", $argc ? "arg0" : ""
106 call debug_gimple_stmt ($debug_arg)
109 document pgg
110 GCC hook: debug_gimple_stmt (gimple)
111 Print given GIMPLE statement in C syntax.
112 See also 'help-gcc-hooks'.
115 define pgq
116 eval "set $debug_arg = $%s", $argc ? "arg0" : ""
117 call debug_gimple_seq ($debug_arg)
120 document pgq
121 GCC hook: debug_gimple_seq (gimple_seq)
122 Print given GIMPLE sequence in C syntax.
123 See also 'help-gcc-hooks'.
126 define pgs
127 eval "set $debug_arg = $%s", $argc ? "arg0" : ""
128 call debug_generic_stmt ($debug_arg)
131 document pgs
132 GCC hook: debug_generic_stmt (tree)
133 Print given GENERIC statement in C syntax.
134 See also 'help-gcc-hooks'.
137 define pge
138 eval "set $debug_arg = $%s", $argc ? "arg0" : ""
139 call debug_generic_expr ($debug_arg)
142 document pge
143 GCC hook: debug_generic_expr (tree)
144 Print given GENERIC expression in C syntax.
145 See also 'help-gcc-hooks'.
148 define pmz
149 eval "set $debug_arg = $%s", $argc ? "arg0" : ""
150 call mpz_out_str(stderr, 10, $debug_arg)
153 document pmz
154 GCC hook: mpz_out_str (mpz_t)
155 Print given mpz value.
156 See also 'help-gcc-hooks'.
159 define ptc
160 eval "set $debug_arg = $%s", $argc ? "arg0" : ""
161 output (enum tree_code) $debug_arg.base.code
162 echo \n
165 document ptc
166 GCC hook: TREE_CODE (tree)
167 Print the tree-code of given tree node.
168 See also 'help-gcc-hooks'.
171 define pdn
172 eval "set $debug_arg = $%s", $argc ? "arg0" : ""
173 output $debug_arg.decl_minimal.name->identifier.id.str
174 echo \n
177 document pdn
178 GCC hook: IDENTIFIER_POINTER (DECL_NAME (tree))
179 Print the name of given decl-node.
180 See also 'help-gcc-hooks'.
183 define ptn
184 eval "set $debug_arg = $%s", $argc ? "arg0" : ""
185 output $debug_arg.type.name->decl_minimal.name->identifier.id.str
186 echo \n
189 document ptn
190 GCC hook: IDENTIFIER_POINTER (DECL_NAME (TREE_TYPE (tree)))
191 Print the name of given type-node.
192 See also 'help-gcc-hooks'.
195 define pdd
196 eval "set $debug_arg = $%s", $argc ? "arg0" : ""
197 call debug_dwarf_die ($debug_arg)
200 document pdd
201 GCC hook: debug_dwarf_die (dw_die_ref)
202 Print given dw_die_ref.
203 See also 'help-gcc-hooks'.
206 define prc
207 eval "set $debug_arg = $%s", $argc ? "arg0" : ""
208 output (enum rtx_code) $debug_arg.code
209 echo \ (
210 output $debug_arg.mode
211 echo )\n
214 document prc
215 GCC hook: GET_CODE (rtx)
216 Print the rtx-code and machine mode of given rtx.
217 See also 'help-gcc-hooks'.
220 define pi
221 eval "set $debug_arg = $%s", $argc ? "arg0" : ""
222 print $debug_arg.u.fld[0].rt_rtx@7
225 document pi
226 GCC hook: X0EXP (rtx_insn)
227 Print the fields of given RTL instruction.
228 See also 'help-gcc-hooks'.
231 define pbs
232 call print_binding_stack ()
235 document pbs
236 In cc1plus, print the current binding stack, frame by frame, up to and
237 including the global binding level.
240 define pbm
241 eval "set $debug_arg = $%s", $argc ? "arg0" : ""
242 call bitmap_print (stderr, $debug_arg, "", "\n")
245 document pbm
246 GCC hook: bitmap_print (bitmap)
247 Dump given bitmap as a comma-separated list of numbers.
248 See also 'help-gcc-hooks'.
251 define pel
252 eval "set $debug_arg = $%s", $argc ? "arg0" : ""
253 output expand_location ($debug_arg)
254 echo \n
257 document pel
258 GCC hook: expand_location (location_t)
259 Print given location.
260 See also 'help-gcc-hooks'.
263 define pcfun
264 output debug_function (cfun ? cfun->decl : current_function_decl, 0)
265 echo \n
268 document pcfun
269 Print current function.
272 define trt
273 eval "set $debug_arg = $%s", $argc ? "arg0" : ""
274 print ($debug_arg.typed.type)
277 document trt
278 GCC hook: TREE_TYPE (tree)
279 Print TREE_TYPE of given tree node.
280 See also 'help-gcc-hooks'.
283 define break-on-diagnostic
284 break diagnostic_show_locus
287 document break-on-diagnostic
288 Put a breakpoint on diagnostic_show_locus, called whenever a diagnostic
289 is emitted (as opposed to those warnings that are suppressed by
290 command-line options).
293 define break-on-saved-diagnostic
294 break ana::diagnostic_manager::add_diagnostic
297 document break-on-saved-diagnostic
298 Put a breakpoint on ana::diagnostic_manager::add_diagnostic, called within
299 the analyzer whenever a diagnostic is saved for later de-duplication and
300 possible emission.
303 define reload-gdbhooks
304 python import imp; imp.reload(gdbhooks)
307 document reload-gdbhooks
308 Load the gdbhooks.py module again in order to pick up any changes made to it.
311 alias rh = reload-gdbhooks
313 # Define some macros helpful to gdb when it is expanding macros.
314 macro define __FILE__ "gdb"
315 macro define __LINE__ 1
316 macro define __FUNCTION__ "gdb"
317 macro define __null 0
318 macro define input_line expand_location(input_location).line
319 macro define input_filename expand_location(input_location).file
321 # Remember previous pagination status and turn it off, so that
322 # the messages for skip commands don't require pagination.
323 python __gcc_prev_pagination=gdb.parameter("pagination")
324 set pagination off
326 # Gracefully handle aborts in functions used from gdb.
327 set unwindonsignal on
329 # Put breakpoints at exit and fancy_abort in case abort is mapped
330 # to either fprintf/exit or fancy_abort.
331 b fancy_abort
333 # Put a breakpoint on internal_error to help with debugging ICEs.
334 b internal_error
336 set complaints 0
337 # Don't let abort actually run, as it will make
338 # stdio stop working and therefore the `pr' command above as well.
339 # Put this last because gcc does not reference it any more unless
340 # USE_SYSTEM_ABORT is defined, so gdb may complain and bail out.
341 b exit
342 b abort
344 # Disable strict type checking.  This allows developers to (for example)
345 # make inferior calls without casting absolute address to a suitable
346 # pointer type.
347 set check type off
349 # Skip all inline functions in tree.h.
350 # These are used in accessor macros.
351 # Note that this is added at the end because older gdb versions
352 # do not understand the 'skip' command.
353 # See https://sourceware.org/gdb/current/onlinedocs/gdb/Skipping-Over-Functions-and-Files.html
354 skip file tree.h
356 # Also skip inline functions in is-a.h.
357 skip file is-a.h
359 # And line-map.h.
360 skip file line-map.h
362 # And timevar.h.
363 skip file timevar.h
365 # Likewise, skip various inline functions in rtl.h.
366 skip rtx_expr_list::next
367 skip rtx_expr_list::element
368 skip rtx_insn_list::next
369 skip rtx_insn_list::insn
370 skip rtx_sequence::len
371 skip rtx_sequence::element
372 skip rtx_sequence::insn
373 skip INSN_UID
374 skip PREV_INSN
375 skip SET_PREV_INSN
376 skip NEXT_INSN
377 skip SET_NEXT_INSN
378 skip BLOCK_FOR_INSN
379 skip PATTERN
380 skip INSN_LOCATION
381 skip INSN_HAS_LOCATION
382 skip JUMP_LABEL_AS_INSN
384 # Restore pagination to the previous state.
385 python if __gcc_prev_pagination: gdb.execute("set pagination on")