Mercurial > hg > CbC > CbC_gcc
annotate gcc/gdbinit.in @ 158:494b0b89df80 default tip
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 18:13:55 +0900 |
parents | 1830386684a0 |
children |
rev | line source |
---|---|
145 | 1 # Copyright (C) 2001-2020 Free Software Foundation, Inc. |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2 # |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3 # This file is part of GCC. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
4 # |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
5 # GCC is free software; you can redistribute it and/or modify |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
6 # it under the terms of the GNU General Public License as published by |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
7 # the Free Software Foundation; either version 3, or (at your option) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
8 # any later version. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
9 # |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
10 # GCC is distributed in the hope that it will be useful, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
13 # GNU General Public License for more details. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
14 # |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
15 # You should have received a copy of the GNU General Public License |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
16 # along with GCC; see the file COPYING3. If not see |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
17 # <http://www.gnu.org/licenses/>. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
18 |
145 | 19 define help-gcc-hooks |
20 help help-gcc-hooks | |
21 end | |
22 | |
23 document help-gcc-hooks | |
24 GCC 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], | |
34 pp, pbs, pcfun | |
35 | |
36 They are generally implemented by calling a function that prints to stderr, | |
37 and therefore will not work when the compiler is not executing. | |
38 | |
39 Most shorthands accept an optional argument. When it is not supplied, | |
40 they use value in GDB register $, i.e. the last printed value. | |
41 end | |
42 | |
43 define pp | |
44 eval "set $debug_arg = $%s", $argc ? "arg0" : "" | |
45 call debug ($debug_arg) | |
46 end | |
47 | |
48 document pp | |
49 GCC hook: pp [any] | |
50 Print a representation of any GCC data structure for which an instance of | |
51 overloaded function 'debug' is available. | |
52 See also 'help-gcc-hooks'. | |
53 end | |
54 | |
0 | 55 define pr |
145 | 56 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
57 call debug_rtx ($debug_arg) | |
0 | 58 end |
59 | |
60 document pr | |
145 | 61 GCC hook: pr [rtx] |
62 Print the full structure of given rtx. | |
63 See also 'help-gcc-hooks'. | |
0 | 64 end |
65 | |
66 define prl | |
145 | 67 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
68 call debug_rtx_list ($debug_arg, debug_rtx_count) | |
0 | 69 end |
70 | |
71 document prl | |
145 | 72 GCC hook: prl [rtx] |
73 Print the full structure of all rtx insns beginning at given rtx. | |
0 | 74 Uses variable debug_rtx_count to control number of insns printed: |
145 | 75 debug_rtx_count > 0: print from given rtx on. |
76 debug_rtx_count < 0: print a window around given rtx. | |
0 | 77 |
78 There is also debug_rtx_find (rtx, uid) that will scan a list for UID and print | |
79 it using debug_rtx_list. Usage example: set $foo=debug_rtx_find(first, 42) | |
80 end | |
81 | |
82 define pt | |
145 | 83 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
84 call debug_tree ($debug_arg) | |
0 | 85 end |
86 | |
87 document pt | |
145 | 88 GCC hook: pt [tree] |
89 Print the full structure of given tree. | |
90 See also 'help-gcc-hooks'. | |
0 | 91 end |
92 | |
93 define pct | |
145 | 94 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
95 call debug_c_tree ($debug_arg) | |
0 | 96 end |
97 | |
98 document pct | |
145 | 99 GCC hook: pct [tree] |
100 Print given tree in C syntax. | |
101 See also 'help-gcc-hooks'. | |
0 | 102 end |
103 | |
104 define pgg | |
145 | 105 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
106 call debug_gimple_stmt ($debug_arg) | |
0 | 107 end |
108 | |
109 document pgg | |
145 | 110 GCC hook: pgg [gimple] |
111 Print given GIMPLE statement in C syntax. | |
112 See also 'help-gcc-hooks'. | |
0 | 113 end |
114 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
115 define pgq |
145 | 116 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
117 call debug_gimple_seq ($debug_arg) | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
118 end |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
119 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
120 document pgq |
145 | 121 GCC hook: pgq [gimple_seq] |
122 Print given GIMPLE sequence in C syntax. | |
123 See also 'help-gcc-hooks'. | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
124 end |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
125 |
0 | 126 define pgs |
145 | 127 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
128 call debug_generic_stmt ($debug_arg) | |
0 | 129 end |
130 | |
131 document pgs | |
145 | 132 GCC hook: pgq [tree] |
133 Print given GENERIC statement in C syntax. | |
134 See also 'help-gcc-hooks'. | |
0 | 135 end |
136 | |
137 define pge | |
145 | 138 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
139 call debug_generic_expr ($debug_arg) | |
0 | 140 end |
141 | |
142 document pge | |
145 | 143 GCC hook: pge [tree] |
144 Print given GENERIC expression in C syntax. | |
145 See also 'help-gcc-hooks'. | |
0 | 146 end |
147 | |
111 | 148 define pmz |
145 | 149 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
150 call mpz_out_str(stderr, 10, $debug_arg) | |
111 | 151 end |
152 | |
153 document pmz | |
145 | 154 GCC hook: pmz [mpz_t] |
155 Print given mpz value. | |
156 See also 'help-gcc-hooks'. | |
111 | 157 end |
158 | |
0 | 159 define ptc |
145 | 160 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
161 output (enum tree_code) $debug_arg.base.code | |
0 | 162 echo \n |
163 end | |
164 | |
165 document ptc | |
145 | 166 GCC hook: ptc [tree] |
167 Print the tree-code of given tree node. | |
168 See also 'help-gcc-hooks'. | |
0 | 169 end |
170 | |
171 define pdn | |
145 | 172 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
173 output $debug_arg.decl_minimal.name->identifier.id.str | |
0 | 174 echo \n |
175 end | |
176 | |
177 document pdn | |
145 | 178 GCC hook: pdn [tree] |
179 Print the name of given decl-node. | |
180 See also 'help-gcc-hooks'. | |
0 | 181 end |
182 | |
183 define ptn | |
145 | 184 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
185 output $debug_arg.type.name->decl_minimal.name->identifier.id.str | |
0 | 186 echo \n |
187 end | |
188 | |
189 document ptn | |
145 | 190 GCC hook: ptn [tree] |
191 Print the name of given type-node. | |
192 See also 'help-gcc-hooks'. | |
0 | 193 end |
194 | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
195 define pdd |
145 | 196 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
197 call debug_dwarf_die ($debug_arg) | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
198 end |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
199 |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
200 document pdd |
145 | 201 GCC hook: pdd [dw_die_ref] |
202 Print given dw_die_ref. | |
203 See also 'help-gcc-hooks'. | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
204 end |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
205 |
0 | 206 define prc |
145 | 207 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
208 output (enum rtx_code) $debug_arg.code | |
0 | 209 echo \ ( |
145 | 210 output $debug_arg.mode |
0 | 211 echo )\n |
212 end | |
213 | |
214 document prc | |
145 | 215 GCC hook: prc [rtx] |
216 Print the rtx-code and machine mode of given rtx. | |
217 See also 'help-gcc-hooks'. | |
0 | 218 end |
219 | |
220 define pi | |
145 | 221 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
222 print $debug_arg.u.fld[0].rt_rtx@7 | |
0 | 223 end |
224 | |
225 document pi | |
145 | 226 GCC hook: pi [rtx_insn] |
227 Print the fields of given RTL instruction. | |
228 See also 'help-gcc-hooks'. | |
0 | 229 end |
230 | |
231 define pbs | |
145 | 232 call print_binding_stack () |
0 | 233 end |
234 | |
235 document pbs | |
236 In cc1plus, print the current binding stack, frame by frame, up to and | |
237 including the global binding level. | |
238 end | |
239 | |
240 define pbm | |
145 | 241 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
242 call bitmap_print (stderr, $debug_arg, "", "\n") | |
0 | 243 end |
244 | |
245 document pbm | |
145 | 246 GCC hook: pbm [bitmap] |
247 Dump given bitmap as a comma-separated list of numbers. | |
248 See also 'help-gcc-hooks'. | |
0 | 249 end |
250 | |
111 | 251 define pel |
145 | 252 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
253 output expand_location ($debug_arg) | |
111 | 254 echo \n |
255 end | |
256 | |
257 document pel | |
145 | 258 GCC hook: pel [location_t] |
259 Print given location. | |
260 See also 'help-gcc-hooks'. | |
111 | 261 end |
262 | |
263 define pcfun | |
264 output debug_function (cfun ? cfun->decl : current_function_decl, 0) | |
265 echo \n | |
266 end | |
267 | |
268 document pcfun | |
269 Print current function. | |
270 end | |
271 | |
145 | 272 define trt |
273 eval "set $debug_arg = $%s", $argc ? "arg0" : "" | |
274 print ($debug_arg.typed.type) | |
275 end | |
276 | |
277 document trt | |
278 GCC hook: trt [tree] | |
279 Print TREE_TYPE of given tree node. | |
280 See also 'help-gcc-hooks'. | |
281 end | |
282 | |
131 | 283 define break-on-diagnostic |
284 break diagnostic_show_locus | |
285 end | |
286 | |
287 document break-on-diagnostic | |
288 Put a breakpoint on diagnostic_show_locus, called whenever a diagnostic | |
289 is emitted (as opposed to those warnings that are suppressed by | |
290 command-line options). | |
291 end | |
292 | |
145 | 293 define break-on-saved-diagnostic |
294 break ana::diagnostic_manager::add_diagnostic | |
295 end | |
296 | |
297 document break-on-saved-diagnostic | |
298 Put a breakpoint on ana::diagnostic_manager::add_diagnostic, called within | |
299 the analyzer whenever a diagnostic is saved for later de-duplication and | |
300 possible emission. | |
301 end | |
302 | |
303 define reload-gdbhooks | |
304 python import imp; imp.reload(gdbhooks) | |
305 end | |
306 | |
307 document reload-gdbhooks | |
308 Load the gdbhooks.py module again in order to pick up any changes made to it. | |
309 end | |
310 | |
311 alias rh = reload-gdbhooks | |
312 | |
111 | 313 # Define some macros helpful to gdb when it is expanding macros. |
314 macro define __FILE__ "gdb" | |
315 macro define __LINE__ 1 | |
316 macro define __FUNCTION__ "gdb" | |
317 macro define __null 0 | |
318 macro define input_line expand_location(input_location).line | |
319 macro define input_filename expand_location(input_location).file | |
320 | |
145 | 321 # Remember previous pagination status and turn it off, so that |
322 # the messages for skip commands don't require pagination. | |
323 python __gcc_prev_pagination=gdb.parameter("pagination") | |
324 set pagination off | |
325 | |
111 | 326 # Gracefully handle aborts in functions used from gdb. |
327 set unwindonsignal on | |
328 | |
0 | 329 # Put breakpoints at exit and fancy_abort in case abort is mapped |
330 # to either fprintf/exit or fancy_abort. | |
331 b fancy_abort | |
332 | |
333 # Put a breakpoint on internal_error to help with debugging ICEs. | |
334 b internal_error | |
335 | |
336 set complaints 0 | |
337 # Don't let abort actually run, as it will make | |
338 # stdio stop working and therefore the `pr' command above as well. | |
339 # Put this last because gcc does not reference it any more unless | |
340 # USE_SYSTEM_ABORT is defined, so gdb may complain and bail out. | |
341 b exit | |
342 b abort | |
111 | 343 |
344 # Disable strict type checking. This allows developers to (for example) | |
345 # make inferior calls without casting absolute address to a suitable | |
346 # pointer type. | |
347 set check type off | |
348 | |
349 # Skip all inline functions in tree.h. | |
350 # These are used in accessor macros. | |
351 # Note that this is added at the end because older gdb versions | |
352 # do not understand the 'skip' command. | |
353 # See https://sourceware.org/gdb/current/onlinedocs/gdb/Skipping-Over-Functions-and-Files.html | |
354 skip file tree.h | |
355 | |
356 # Also skip inline functions in is-a.h. | |
357 skip file is-a.h | |
358 | |
359 # And line-map.h. | |
360 skip file line-map.h | |
361 | |
131 | 362 # And timevar.h. |
363 skip file timevar.h | |
364 | |
111 | 365 # Likewise, skip various inline functions in rtl.h. |
366 skip rtx_expr_list::next | |
367 skip rtx_expr_list::element | |
368 skip rtx_insn_list::next | |
369 skip rtx_insn_list::insn | |
370 skip rtx_sequence::len | |
371 skip rtx_sequence::element | |
372 skip rtx_sequence::insn | |
373 skip INSN_UID | |
374 skip PREV_INSN | |
375 skip SET_PREV_INSN | |
376 skip NEXT_INSN | |
377 skip SET_NEXT_INSN | |
378 skip BLOCK_FOR_INSN | |
379 skip PATTERN | |
380 skip INSN_LOCATION | |
381 skip INSN_HAS_LOCATION | |
382 skip JUMP_LABEL_AS_INSN | |
145 | 383 |
384 # Restore pagination to the previous state. | |
385 python if __gcc_prev_pagination: gdb.execute("set pagination on") |