]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/gdbinit.in
Update libbid according to the latest Intel Decimal Floating-Point Math Library.
[thirdparty/gcc.git] / gcc / gdbinit.in
CommitLineData
a945c346 1# Copyright (C) 2001-2024 Free Software Foundation, Inc.
ad41bd84
JM
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
2c2e9f7a
AM
19define help-gcc-hooks
20help help-gcc-hooks
21end
22
23document help-gcc-hooks
24GCC gdbinit file introduces several debugging shorthands:
25
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],
abbdb623 34 phrs [HARD_REG_SET]
2c2e9f7a
AM
35 pp, pbs, pcfun
36
37They are generally implemented by calling a function that prints to stderr,
38and therefore will not work when the compiler is not executing.
39
40Most shorthands accept an optional argument. When it is not supplied,
41they use value in GDB register $, i.e. the last printed value.
42end
43
b3147e59 44define pp
2c2e9f7a
AM
45eval "set $debug_arg = $%s", $argc ? "arg0" : ""
46call debug ($debug_arg)
b3147e59
JM
47end
48
49document pp
ee42f826 50GCC hook: debug (<multiple overloads>)
2c2e9f7a
AM
51Print a representation of any GCC data structure for which an instance of
52overloaded function 'debug' is available.
53See also 'help-gcc-hooks'.
b3147e59
JM
54end
55
861bb6c1 56define pr
2c2e9f7a
AM
57eval "set $debug_arg = $%s", $argc ? "arg0" : ""
58call debug_rtx ($debug_arg)
861bb6c1
JL
59end
60
61document pr
ee42f826 62GCC hook: debug_rtx (rtx)
2c2e9f7a
AM
63Print the full structure of given rtx.
64See also 'help-gcc-hooks'.
861bb6c1
JL
65end
66
67define prl
2c2e9f7a
AM
68eval "set $debug_arg = $%s", $argc ? "arg0" : ""
69call debug_rtx_list ($debug_arg, debug_rtx_count)
861bb6c1
JL
70end
71
72document prl
ee42f826 73GCC hook: debug_rtx_list (rtx)
2c2e9f7a 74Print the full structure of all rtx insns beginning at given rtx.
861bb6c1 75Uses variable debug_rtx_count to control number of insns printed:
2c2e9f7a
AM
76 debug_rtx_count > 0: print from given rtx on.
77 debug_rtx_count < 0: print a window around given rtx.
861bb6c1
JL
78
79There is also debug_rtx_find (rtx, uid) that will scan a list for UID and print
80it using debug_rtx_list. Usage example: set $foo=debug_rtx_find(first, 42)
81end
82
83define pt
2c2e9f7a
AM
84eval "set $debug_arg = $%s", $argc ? "arg0" : ""
85call debug_tree ($debug_arg)
861bb6c1
JL
86end
87
88document pt
ee42f826 89GCC hook: debug_tree (tree)
2c2e9f7a
AM
90Print the full structure of given tree.
91See also 'help-gcc-hooks'.
861bb6c1
JL
92end
93
b9d8832d 94define pct
2c2e9f7a
AM
95eval "set $debug_arg = $%s", $argc ? "arg0" : ""
96call debug_c_tree ($debug_arg)
b9d8832d
JM
97end
98
99document pct
ee42f826 100GCC hook: debug_c_tree (tree)
2c2e9f7a
AM
101Print given tree in C syntax.
102See also 'help-gcc-hooks'.
b9d8832d
JM
103end
104
f8bf9252 105define pgg
2c2e9f7a
AM
106eval "set $debug_arg = $%s", $argc ? "arg0" : ""
107call debug_gimple_stmt ($debug_arg)
f8bf9252
SP
108end
109
110document pgg
ee42f826 111GCC hook: debug_gimple_stmt (gimple)
2c2e9f7a
AM
112Print given GIMPLE statement in C syntax.
113See also 'help-gcc-hooks'.
f8bf9252
SP
114end
115
6e7e763e 116define pgq
2c2e9f7a
AM
117eval "set $debug_arg = $%s", $argc ? "arg0" : ""
118call debug_gimple_seq ($debug_arg)
6e7e763e
JM
119end
120
121document pgq
ee42f826 122GCC hook: debug_gimple_seq (gimple_seq)
2c2e9f7a
AM
123Print given GIMPLE sequence in C syntax.
124See also 'help-gcc-hooks'.
6e7e763e
JM
125end
126
6de9cd9a 127define pgs
2c2e9f7a
AM
128eval "set $debug_arg = $%s", $argc ? "arg0" : ""
129call debug_generic_stmt ($debug_arg)
6de9cd9a
DN
130end
131
132document pgs
ee42f826 133GCC hook: debug_generic_stmt (tree)
2c2e9f7a
AM
134Print given GENERIC statement in C syntax.
135See also 'help-gcc-hooks'.
6de9cd9a
DN
136end
137
138define pge
2c2e9f7a
AM
139eval "set $debug_arg = $%s", $argc ? "arg0" : ""
140call debug_generic_expr ($debug_arg)
6de9cd9a
DN
141end
142
143document pge
ee42f826 144GCC hook: debug_generic_expr (tree)
2c2e9f7a
AM
145Print given GENERIC expression in C syntax.
146See also 'help-gcc-hooks'.
6de9cd9a
DN
147end
148
abbdb623
HPN
149define phrs
150eval "set $debug_arg = $%s", $argc ? "arg0" : ""
151call debug_hard_reg_set ($debug_arg)
152end
153
154document phrs
155GCC hook: debug_hard_reg_set (HARD_REG_SET)
156Print given HARD_REG_SET.
157See also 'help-gcc-hooks'.
158end
159
605be31e 160define pmz
2c2e9f7a
AM
161eval "set $debug_arg = $%s", $argc ? "arg0" : ""
162call mpz_out_str(stderr, 10, $debug_arg)
605be31e
MS
163end
164
165document pmz
ee42f826 166GCC hook: mpz_out_str (mpz_t)
2c2e9f7a
AM
167Print given mpz value.
168See also 'help-gcc-hooks'.
605be31e
MS
169end
170
861bb6c1 171define ptc
2c2e9f7a
AM
172eval "set $debug_arg = $%s", $argc ? "arg0" : ""
173output (enum tree_code) $debug_arg.base.code
861bb6c1
JL
174echo \n
175end
176
177document ptc
ee42f826 178GCC hook: TREE_CODE (tree)
2c2e9f7a
AM
179Print the tree-code of given tree node.
180See also 'help-gcc-hooks'.
861bb6c1
JL
181end
182
183define pdn
2c2e9f7a
AM
184eval "set $debug_arg = $%s", $argc ? "arg0" : ""
185output $debug_arg.decl_minimal.name->identifier.id.str
861bb6c1
JL
186echo \n
187end
188
189document pdn
ee42f826 190GCC hook: IDENTIFIER_POINTER (DECL_NAME (tree))
2c2e9f7a
AM
191Print the name of given decl-node.
192See also 'help-gcc-hooks'.
861bb6c1
JL
193end
194
195define ptn
2c2e9f7a
AM
196eval "set $debug_arg = $%s", $argc ? "arg0" : ""
197output $debug_arg.type.name->decl_minimal.name->identifier.id.str
861bb6c1
JL
198echo \n
199end
200
201document ptn
ee42f826 202GCC hook: IDENTIFIER_POINTER (DECL_NAME (TREE_TYPE (tree)))
2c2e9f7a
AM
203Print the name of given type-node.
204See also 'help-gcc-hooks'.
861bb6c1
JL
205end
206
b042534c 207define pdd
2c2e9f7a
AM
208eval "set $debug_arg = $%s", $argc ? "arg0" : ""
209call debug_dwarf_die ($debug_arg)
b042534c
JM
210end
211
212document pdd
ee42f826 213GCC hook: debug_dwarf_die (dw_die_ref)
2c2e9f7a
AM
214Print given dw_die_ref.
215See also 'help-gcc-hooks'.
b042534c
JM
216end
217
861bb6c1 218define prc
2c2e9f7a
AM
219eval "set $debug_arg = $%s", $argc ? "arg0" : ""
220output (enum rtx_code) $debug_arg.code
861bb6c1 221echo \ (
2c2e9f7a 222output $debug_arg.mode
861bb6c1
JL
223echo )\n
224end
225
226document prc
ee42f826 227GCC hook: GET_CODE (rtx)
2c2e9f7a
AM
228Print the rtx-code and machine mode of given rtx.
229See also 'help-gcc-hooks'.
861bb6c1
JL
230end
231
232define pi
2c2e9f7a
AM
233eval "set $debug_arg = $%s", $argc ? "arg0" : ""
234print $debug_arg.u.fld[0].rt_rtx@7
861bb6c1
JL
235end
236
237document pi
ee42f826 238GCC hook: X0EXP (rtx_insn)
2c2e9f7a
AM
239Print the fields of given RTL instruction.
240See also 'help-gcc-hooks'.
861bb6c1
JL
241end
242
243define pbs
582097cb 244call print_binding_stack ()
861bb6c1
JL
245end
246
247document pbs
248In cc1plus, print the current binding stack, frame by frame, up to and
249including the global binding level.
250end
251
55a9c4b2 252define pbm
2c2e9f7a
AM
253eval "set $debug_arg = $%s", $argc ? "arg0" : ""
254call bitmap_print (stderr, $debug_arg, "", "\n")
55a9c4b2
HPN
255end
256
257document pbm
ee42f826 258GCC hook: bitmap_print (bitmap)
2c2e9f7a
AM
259Dump given bitmap as a comma-separated list of numbers.
260See also 'help-gcc-hooks'.
55a9c4b2
HPN
261end
262
71e55f04 263define pel
2c2e9f7a
AM
264eval "set $debug_arg = $%s", $argc ? "arg0" : ""
265output expand_location ($debug_arg)
71e55f04
MP
266echo \n
267end
268
269document pel
ee42f826 270GCC hook: expand_location (location_t)
2c2e9f7a
AM
271Print given location.
272See also 'help-gcc-hooks'.
71e55f04
MP
273end
274
2e1a9cdb
MP
275define pcfun
276output debug_function (cfun ? cfun->decl : current_function_decl, 0)
277echo \n
278end
279
280document pcfun
281Print current function.
282end
283
7c83619c 284define trt
2c2e9f7a
AM
285eval "set $debug_arg = $%s", $argc ? "arg0" : ""
286print ($debug_arg.typed.type)
7c83619c
ML
287end
288
289document trt
ee42f826 290GCC hook: TREE_TYPE (tree)
2c2e9f7a
AM
291Print TREE_TYPE of given tree node.
292See also 'help-gcc-hooks'.
7c83619c
ML
293end
294
6e72eb34 295define break-on-diagnostic
8625aa24 296break diagnostic_context::maybe_show_locus
6e72eb34
DM
297end
298
299document break-on-diagnostic
300Put a breakpoint on diagnostic_show_locus, called whenever a diagnostic
301is emitted (as opposed to those warnings that are suppressed by
302command-line options).
303end
304
757bf1df 305define break-on-saved-diagnostic
75038aa6 306break ana::diagnostic_manager::add_diagnostic
757bf1df
DM
307end
308
309document break-on-saved-diagnostic
75038aa6 310Put a breakpoint on ana::diagnostic_manager::add_diagnostic, called within
757bf1df
DM
311the analyzer whenever a diagnostic is saved for later de-duplication and
312possible emission.
313end
314
d894bafc
VI
315define reload-gdbhooks
316python import imp; imp.reload(gdbhooks)
317end
318
319document reload-gdbhooks
320Load the gdbhooks.py module again in order to pick up any changes made to it.
321end
322
323alias rh = reload-gdbhooks
324
0823efed
DN
325# Define some macros helpful to gdb when it is expanding macros.
326macro define __FILE__ "gdb"
327macro define __LINE__ 1
b57ca59b 328macro define __FUNCTION__ "gdb"
0bfdb81e 329macro define __null 0
2a0da5ad
JM
330macro define input_line expand_location(input_location).line
331macro define input_filename expand_location(input_location).file
0823efed 332
35a5722c
JJ
333# Remember previous pagination status and turn it off, so that
334# the messages for skip commands don't require pagination.
335python __gcc_prev_pagination=gdb.parameter("pagination")
336set pagination off
337
0823efed
DN
338# Gracefully handle aborts in functions used from gdb.
339set unwindonsignal on
340
22c4957e
MM
341# Put breakpoints at exit and fancy_abort in case abort is mapped
342# to either fprintf/exit or fancy_abort.
22c4957e
MM
343b fancy_abort
344
c9092111
BE
345# Put a breakpoint on internal_error to help with debugging ICEs.
346b internal_error
347
3a7f50dc 348set complaints 0
b14a4f5a
AS
349# Don't let abort actually run, as it will make
350# stdio stop working and therefore the `pr' command above as well.
351# Put this last because gcc does not reference it any more unless
352# USE_SYSTEM_ABORT is defined, so gdb may complain and bail out.
3aed1981 353b exit
b14a4f5a 354b abort
0823efed 355
2a936959
JL
356# Disable strict type checking. This allows developers to (for example)
357# make inferior calls without casting absolute address to a suitable
358# pointer type.
359set check type off
360
0823efed
DN
361# Skip all inline functions in tree.h.
362# These are used in accessor macros.
363# Note that this is added at the end because older gdb versions
364# do not understand the 'skip' command.
08216dfb 365# See https://sourceware.org/gdb/current/onlinedocs/gdb/Skipping-Over-Functions-and-Files.html
865ea646 366skip file tree.h
08216dfb 367
e6e860a2
JM
368# Also skip inline functions in is-a.h.
369skip file is-a.h
370
0d1892d2
JM
371# And line-map.h.
372skip file line-map.h
373
e1d74c91
JM
374# And timevar.h.
375skip file timevar.h
376
08216dfb
DM
377# Likewise, skip various inline functions in rtl.h.
378skip rtx_expr_list::next
379skip rtx_expr_list::element
380skip rtx_insn_list::next
381skip rtx_insn_list::insn
382skip rtx_sequence::len
383skip rtx_sequence::element
384skip rtx_sequence::insn
385skip INSN_UID
386skip PREV_INSN
387skip SET_PREV_INSN
388skip NEXT_INSN
389skip SET_NEXT_INSN
390skip BLOCK_FOR_INSN
391skip PATTERN
392skip INSN_LOCATION
393skip INSN_HAS_LOCATION
394skip JUMP_LABEL_AS_INSN
35a5722c
JJ
395
396# Restore pagination to the previous state.
397python if __gcc_prev_pagination: gdb.execute("set pagination on")