]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/gdbinit.in
Update copyright years.
[thirdparty/gcc.git] / gcc / gdbinit.in
CommitLineData
8d9254fc 1# Copyright (C) 2001-2020 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
b3147e59
JM
19define pp
20call debug ($)
21end
22
23document pp
24Print a representation of the GCC data structure that is $.
25Works only when an inferior is executing.
26end
27
861bb6c1
JL
28define pr
29set debug_rtx ($)
30end
31
32document pr
33Print the full structure of the rtx that is $.
34Works only when an inferior is executing.
35end
36
37define prl
38set debug_rtx_list ($, debug_rtx_count)
39end
40
41document prl
42Print the full structure of all rtx insns beginning at $.
43Works only when an inferior is executing.
44Uses variable debug_rtx_count to control number of insns printed:
45 debug_rtx_count > 0: print from $ on.
46 debug_rtx_count < 0: print a window around $.
47
48There is also debug_rtx_find (rtx, uid) that will scan a list for UID and print
49it using debug_rtx_list. Usage example: set $foo=debug_rtx_find(first, 42)
50end
51
52define pt
53set debug_tree ($)
54end
55
56document pt
57Print the full structure of the tree that is $.
58Works only when an inferior is executing.
59end
60
b9d8832d
JM
61define pct
62set debug_c_tree ($)
63end
64
65document pct
66Print the tree that is $ in C syntax.
67Works only when an inferior is executing.
68end
69
f8bf9252
SP
70define pgg
71set debug_gimple_stmt ($)
72end
73
74document pgg
75Print the Gimple statement that is $ in C syntax.
76Works only when an inferior is executing.
77end
78
6e7e763e
JM
79define pgq
80set debug_gimple_seq ($)
81end
82
83document pgq
84Print the Gimple sequence that is $ in C syntax.
85Works only when an inferior is executing.
86end
87
6de9cd9a
DN
88define pgs
89set debug_generic_stmt ($)
90end
91
92document pgs
93Print the statement that is $ in C syntax.
94Works only when an inferior is executing.
95end
96
97define pge
98set debug_generic_expr ($)
99end
100
101document pge
102Print the expression that is $ in C syntax.
103Works only when an inferior is executing.
104end
105
605be31e
MS
106define pmz
107set mpz_out_str(stderr, 10, $)
108end
109
110document pmz
111Print the mpz value that is $
112Works only when an inferior is executing.
113end
114
861bb6c1 115define ptc
7c83619c 116output (enum tree_code) $.base.code
861bb6c1
JL
117echo \n
118end
119
120document ptc
121Print the tree-code of the tree node that is $.
122end
123
124define pdn
9391bc0d 125output $.decl_minimal.name->identifier.id.str
861bb6c1
JL
126echo \n
127end
128
129document pdn
130Print the name of the decl-node that is $.
131end
132
133define ptn
9391bc0d 134output $.type.name->decl_minimal.name->identifier.id.str
861bb6c1
JL
135echo \n
136end
137
138document ptn
139Print the name of the type-node that is $.
140end
141
b042534c
JM
142define pdd
143set debug_dwarf_die ($)
144end
145
146document pdd
147Print the dw_die_ref that is in $.
148end
149
861bb6c1
JL
150define prc
151output (enum rtx_code) $.code
152echo \ (
153output $.mode
154echo )\n
155end
156
157document prc
158Print the rtx-code and machine mode of the rtx that is $.
159end
160
161define pi
e0d9dfa2 162print $.u.fld[0].rt_rtx@7
861bb6c1
JL
163end
164
165document pi
166Print the fields of an instruction that is $.
167end
168
169define pbs
170set print_binding_stack ()
171end
172
173document pbs
174In cc1plus, print the current binding stack, frame by frame, up to and
175including the global binding level.
176end
177
55a9c4b2
HPN
178define pbm
179set bitmap_print (stderr, $, "", "\n")
180end
181
182document pbm
183Dump the bitmap that is in $ as a comma-separated list of numbers.
184end
185
71e55f04
MP
186define pel
187output expand_location ($)
188echo \n
189end
190
191document pel
192Print expanded location of $.
193end
194
2e1a9cdb
MP
195define pcfun
196output debug_function (cfun ? cfun->decl : current_function_decl, 0)
197echo \n
198end
199
200document pcfun
201Print current function.
202end
203
7c83619c
ML
204define trt
205print ($.typed.type)
206end
207
208document trt
209Print TREE_TYPE of the tree node that is $
210end
211
6e72eb34
DM
212define break-on-diagnostic
213break diagnostic_show_locus
214end
215
216document break-on-diagnostic
217Put a breakpoint on diagnostic_show_locus, called whenever a diagnostic
218is emitted (as opposed to those warnings that are suppressed by
219command-line options).
220end
221
d894bafc
VI
222define reload-gdbhooks
223python import imp; imp.reload(gdbhooks)
224end
225
226document reload-gdbhooks
227Load the gdbhooks.py module again in order to pick up any changes made to it.
228end
229
230alias rh = reload-gdbhooks
231
0823efed
DN
232# Define some macros helpful to gdb when it is expanding macros.
233macro define __FILE__ "gdb"
234macro define __LINE__ 1
b57ca59b 235macro define __FUNCTION__ "gdb"
0bfdb81e 236macro define __null 0
2a0da5ad
JM
237macro define input_line expand_location(input_location).line
238macro define input_filename expand_location(input_location).file
0823efed 239
35a5722c
JJ
240# Remember previous pagination status and turn it off, so that
241# the messages for skip commands don't require pagination.
242python __gcc_prev_pagination=gdb.parameter("pagination")
243set pagination off
244
0823efed
DN
245# Gracefully handle aborts in functions used from gdb.
246set unwindonsignal on
247
22c4957e
MM
248# Put breakpoints at exit and fancy_abort in case abort is mapped
249# to either fprintf/exit or fancy_abort.
22c4957e
MM
250b fancy_abort
251
c9092111
BE
252# Put a breakpoint on internal_error to help with debugging ICEs.
253b internal_error
254
3a7f50dc 255set complaints 0
b14a4f5a
AS
256# Don't let abort actually run, as it will make
257# stdio stop working and therefore the `pr' command above as well.
258# Put this last because gcc does not reference it any more unless
259# USE_SYSTEM_ABORT is defined, so gdb may complain and bail out.
3aed1981 260b exit
b14a4f5a 261b abort
0823efed 262
2a936959
JL
263# Disable strict type checking. This allows developers to (for example)
264# make inferior calls without casting absolute address to a suitable
265# pointer type.
266set check type off
267
0823efed
DN
268# Skip all inline functions in tree.h.
269# These are used in accessor macros.
270# Note that this is added at the end because older gdb versions
271# do not understand the 'skip' command.
08216dfb 272# See https://sourceware.org/gdb/current/onlinedocs/gdb/Skipping-Over-Functions-and-Files.html
865ea646 273skip file tree.h
08216dfb 274
e6e860a2
JM
275# Also skip inline functions in is-a.h.
276skip file is-a.h
277
0d1892d2
JM
278# And line-map.h.
279skip file line-map.h
280
e1d74c91
JM
281# And timevar.h.
282skip file timevar.h
283
08216dfb
DM
284# Likewise, skip various inline functions in rtl.h.
285skip rtx_expr_list::next
286skip rtx_expr_list::element
287skip rtx_insn_list::next
288skip rtx_insn_list::insn
289skip rtx_sequence::len
290skip rtx_sequence::element
291skip rtx_sequence::insn
292skip INSN_UID
293skip PREV_INSN
294skip SET_PREV_INSN
295skip NEXT_INSN
296skip SET_NEXT_INSN
297skip BLOCK_FOR_INSN
298skip PATTERN
299skip INSN_LOCATION
300skip INSN_HAS_LOCATION
301skip JUMP_LABEL_AS_INSN
35a5722c
JJ
302
303# Restore pagination to the previous state.
304python if __gcc_prev_pagination: gdb.execute("set pagination on")