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