]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/gdbinit.in
Implement C++17 [[maybe_unused]] attribute.
[thirdparty/gcc.git] / gcc / gdbinit.in
CommitLineData
f1717362 1# Copyright (C) 2001-2016 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
071cd279 19define pr
20set debug_rtx ($)
21end
22
23document pr
24Print the full structure of the rtx that is $.
25Works only when an inferior is executing.
26end
27
28define prl
29set debug_rtx_list ($, debug_rtx_count)
30end
31
32document prl
33Print the full structure of all rtx insns beginning at $.
34Works only when an inferior is executing.
35Uses variable debug_rtx_count to control number of insns printed:
36 debug_rtx_count > 0: print from $ on.
37 debug_rtx_count < 0: print a window around $.
38
39There is also debug_rtx_find (rtx, uid) that will scan a list for UID and print
40it using debug_rtx_list. Usage example: set $foo=debug_rtx_find(first, 42)
41end
42
43define pt
44set debug_tree ($)
45end
46
47document pt
48Print the full structure of the tree that is $.
49Works only when an inferior is executing.
50end
51
00ae6be7 52define pct
53set debug_c_tree ($)
54end
55
56document pct
57Print the tree that is $ in C syntax.
58Works only when an inferior is executing.
59end
60
255b6be7 61define pgg
62set debug_gimple_stmt ($)
63end
64
65document pgg
66Print the Gimple statement that is $ in C syntax.
67Works only when an inferior is executing.
68end
69
88cba5b1 70define pgq
71set debug_gimple_seq ($)
72end
73
74document pgq
75Print the Gimple sequence that is $ in C syntax.
76Works only when an inferior is executing.
77end
78
4ee9c684 79define pgs
80set debug_generic_stmt ($)
81end
82
83document pgs
84Print the statement that is $ in C syntax.
85Works only when an inferior is executing.
86end
87
88define pge
89set debug_generic_expr ($)
90end
91
92document pge
93Print the expression that is $ in C syntax.
94Works only when an inferior is executing.
95end
96
69c149d1 97define pmz
98set mpz_out_str(stderr, 10, $)
99end
100
101document pmz
102Print the mpz value that is $
103Works only when an inferior is executing.
104end
105
071cd279 106define ptc
107output (enum tree_code) $.common.code
108echo \n
109end
110
111document ptc
112Print the tree-code of the tree node that is $.
113end
114
115define pdn
36eec8e7 116output $.decl_minimal.name->identifier.id.str
071cd279 117echo \n
118end
119
120document pdn
121Print the name of the decl-node that is $.
122end
123
124define ptn
36eec8e7 125output $.type.name->decl_minimal.name->identifier.id.str
071cd279 126echo \n
127end
128
129document ptn
130Print the name of the type-node that is $.
131end
132
8ee76a8d 133define pvt
134set debug_vec_tree ($)
135end
136
137document pvt
138Print the VEC(tree) that is in $.
139end
140
141define pdd
142set debug_dwarf_die ($)
143end
144
145document pdd
146Print the dw_die_ref that is in $.
147end
148
071cd279 149define prc
150output (enum rtx_code) $.code
151echo \ (
152output $.mode
153echo )\n
154end
155
156document prc
157Print the rtx-code and machine mode of the rtx that is $.
158end
159
160define pi
48bdfbc8 161print $.u.fld[0].rt_rtx@7
071cd279 162end
163
164document pi
165Print the fields of an instruction that is $.
166end
167
168define pbs
169set print_binding_stack ()
170end
171
172document pbs
173In cc1plus, print the current binding stack, frame by frame, up to and
174including the global binding level.
175end
176
aaa59797 177define pbb
0a56fff4 178set debug ($)
aaa59797 179end
180
181document pbb
182Dump the basic block that is in $, including rtx.
183end
184
185define pbm
186set bitmap_print (stderr, $, "", "\n")
187end
188
189document pbm
190Dump the bitmap that is in $ as a comma-separated list of numbers.
191end
192
b174be60 193define pel
194output expand_location ($)
195echo \n
196end
197
198document pel
199Print expanded location of $.
200end
201
645cec52 202define pcfun
203output debug_function (cfun ? cfun->decl : current_function_decl, 0)
204echo \n
205end
206
207document pcfun
208Print current function.
209end
210
2b15d2ba 211# Define some macros helpful to gdb when it is expanding macros.
212macro define __FILE__ "gdb"
213macro define __LINE__ 1
910d871e 214macro define __FUNCTION__ "gdb"
832f4182 215macro define __null 0
12a7d3be 216macro define input_line expand_location(input_location).line
217macro define input_filename expand_location(input_location).file
2b15d2ba 218
219# Gracefully handle aborts in functions used from gdb.
220set unwindonsignal on
221
97fce000 222# Put breakpoints at exit and fancy_abort in case abort is mapped
223# to either fprintf/exit or fancy_abort.
97fce000 224b fancy_abort
225
0fb7aaf2 226# Put a breakpoint on internal_error to help with debugging ICEs.
227b internal_error
228
979f9661 229set complaints 0
3bdfaae6 230# Don't let abort actually run, as it will make
231# stdio stop working and therefore the `pr' command above as well.
232# Put this last because gcc does not reference it any more unless
233# USE_SYSTEM_ABORT is defined, so gdb may complain and bail out.
d62e1a3b 234b exit
3bdfaae6 235b abort
2b15d2ba 236
5bbb7526 237# Disable strict type checking. This allows developers to (for example)
238# make inferior calls without casting absolute address to a suitable
239# pointer type.
240set check type off
241
2b15d2ba 242# Skip all inline functions in tree.h.
243# These are used in accessor macros.
244# Note that this is added at the end because older gdb versions
245# do not understand the 'skip' command.
3e76fcb4 246# See https://sourceware.org/gdb/current/onlinedocs/gdb/Skipping-Over-Functions-and-Files.html
b41251d4 247skip file tree.h
3e76fcb4 248
249# Likewise, skip various inline functions in rtl.h.
250skip rtx_expr_list::next
251skip rtx_expr_list::element
252skip rtx_insn_list::next
253skip rtx_insn_list::insn
254skip rtx_sequence::len
255skip rtx_sequence::element
256skip rtx_sequence::insn
257skip INSN_UID
258skip PREV_INSN
259skip SET_PREV_INSN
260skip NEXT_INSN
261skip SET_NEXT_INSN
262skip BLOCK_FOR_INSN
263skip PATTERN
264skip INSN_LOCATION
265skip INSN_HAS_LOCATION
266skip JUMP_LABEL_AS_INSN