]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/gdbinit.in
PR c++/87554 - ICE with extern template and reference member.
[thirdparty/gcc.git] / gcc / gdbinit.in
CommitLineData
fbd26352 1# Copyright (C) 2001-2019 Free Software Foundation, Inc.
7dfbd804 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
8541a54a 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
071cd279 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
00ae6be7 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
255b6be7 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
88cba5b1 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
4ee9c684 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
69c149d1 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
071cd279 115define ptc
116output (enum tree_code) $.common.code
117echo \n
118end
119
120document ptc
121Print the tree-code of the tree node that is $.
122end
123
124define pdn
36eec8e7 125output $.decl_minimal.name->identifier.id.str
071cd279 126echo \n
127end
128
129document pdn
130Print the name of the decl-node that is $.
131end
132
133define ptn
36eec8e7 134output $.type.name->decl_minimal.name->identifier.id.str
071cd279 135echo \n
136end
137
138document ptn
139Print the name of the type-node that is $.
140end
141
8ee76a8d 142define pdd
143set debug_dwarf_die ($)
144end
145
146document pdd
147Print the dw_die_ref that is in $.
148end
149
071cd279 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
48bdfbc8 162print $.u.fld[0].rt_rtx@7
071cd279 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
aaa59797 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
b174be60 186define pel
187output expand_location ($)
188echo \n
189end
190
191document pel
192Print expanded location of $.
193end
194
645cec52 195define pcfun
196output debug_function (cfun ? cfun->decl : current_function_decl, 0)
197echo \n
198end
199
200document pcfun
201Print current function.
202end
203
7a59a4e4 204define break-on-diagnostic
205break diagnostic_show_locus
206end
207
208document break-on-diagnostic
209Put a breakpoint on diagnostic_show_locus, called whenever a diagnostic
210is emitted (as opposed to those warnings that are suppressed by
211command-line options).
212end
213
2b15d2ba 214# Define some macros helpful to gdb when it is expanding macros.
215macro define __FILE__ "gdb"
216macro define __LINE__ 1
910d871e 217macro define __FUNCTION__ "gdb"
832f4182 218macro define __null 0
12a7d3be 219macro define input_line expand_location(input_location).line
220macro define input_filename expand_location(input_location).file
2b15d2ba 221
af7bbac6 222# Remember previous pagination status and turn it off, so that
223# the messages for skip commands don't require pagination.
224python __gcc_prev_pagination=gdb.parameter("pagination")
225set pagination off
226
2b15d2ba 227# Gracefully handle aborts in functions used from gdb.
228set unwindonsignal on
229
97fce000 230# Put breakpoints at exit and fancy_abort in case abort is mapped
231# to either fprintf/exit or fancy_abort.
97fce000 232b fancy_abort
233
0fb7aaf2 234# Put a breakpoint on internal_error to help with debugging ICEs.
235b internal_error
236
979f9661 237set complaints 0
3bdfaae6 238# Don't let abort actually run, as it will make
239# stdio stop working and therefore the `pr' command above as well.
240# Put this last because gcc does not reference it any more unless
241# USE_SYSTEM_ABORT is defined, so gdb may complain and bail out.
d62e1a3b 242b exit
3bdfaae6 243b abort
2b15d2ba 244
5bbb7526 245# Disable strict type checking. This allows developers to (for example)
246# make inferior calls without casting absolute address to a suitable
247# pointer type.
248set check type off
249
2b15d2ba 250# Skip all inline functions in tree.h.
251# These are used in accessor macros.
252# Note that this is added at the end because older gdb versions
253# do not understand the 'skip' command.
3e76fcb4 254# See https://sourceware.org/gdb/current/onlinedocs/gdb/Skipping-Over-Functions-and-Files.html
b41251d4 255skip file tree.h
3e76fcb4 256
cc1e50b1 257# Also skip inline functions in is-a.h.
258skip file is-a.h
259
fc3cb33e 260# And line-map.h.
261skip file line-map.h
262
970969cd 263# And timevar.h.
264skip file timevar.h
265
3e76fcb4 266# Likewise, skip various inline functions in rtl.h.
267skip rtx_expr_list::next
268skip rtx_expr_list::element
269skip rtx_insn_list::next
270skip rtx_insn_list::insn
271skip rtx_sequence::len
272skip rtx_sequence::element
273skip rtx_sequence::insn
274skip INSN_UID
275skip PREV_INSN
276skip SET_PREV_INSN
277skip NEXT_INSN
278skip SET_NEXT_INSN
279skip BLOCK_FOR_INSN
280skip PATTERN
281skip INSN_LOCATION
282skip INSN_HAS_LOCATION
283skip JUMP_LABEL_AS_INSN
af7bbac6 284
285# Restore pagination to the previous state.
286python if __gcc_prev_pagination: gdb.execute("set pagination on")