Mercurial > hg > CbC > CbC_gcc
comparison gcc/gdbinit.in @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 # Copyright (C) 2001-2018 Free Software Foundation, Inc. | 1 # Copyright (C) 2001-2020 Free Software Foundation, Inc. |
2 # | 2 # |
3 # This file is part of GCC. | 3 # This file is part of GCC. |
4 # | 4 # |
5 # GCC is free software; you can redistribute it and/or modify | 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 | 6 # it under the terms of the GNU General Public License as published by |
14 # | 14 # |
15 # You should have received a copy of the GNU General Public License | 15 # You should have received a copy of the GNU General Public License |
16 # along with GCC; see the file COPYING3. If not see | 16 # along with GCC; see the file COPYING3. If not see |
17 # <http://www.gnu.org/licenses/>. | 17 # <http://www.gnu.org/licenses/>. |
18 | 18 |
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 | |
19 define pr | 55 define pr |
20 set debug_rtx ($) | 56 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
57 call debug_rtx ($debug_arg) | |
21 end | 58 end |
22 | 59 |
23 document pr | 60 document pr |
24 Print the full structure of the rtx that is $. | 61 GCC hook: pr [rtx] |
25 Works only when an inferior is executing. | 62 Print the full structure of given rtx. |
63 See also 'help-gcc-hooks'. | |
26 end | 64 end |
27 | 65 |
28 define prl | 66 define prl |
29 set debug_rtx_list ($, debug_rtx_count) | 67 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
68 call debug_rtx_list ($debug_arg, debug_rtx_count) | |
30 end | 69 end |
31 | 70 |
32 document prl | 71 document prl |
33 Print the full structure of all rtx insns beginning at $. | 72 GCC hook: prl [rtx] |
34 Works only when an inferior is executing. | 73 Print the full structure of all rtx insns beginning at given rtx. |
35 Uses variable debug_rtx_count to control number of insns printed: | 74 Uses variable debug_rtx_count to control number of insns printed: |
36 debug_rtx_count > 0: print from $ on. | 75 debug_rtx_count > 0: print from given rtx on. |
37 debug_rtx_count < 0: print a window around $. | 76 debug_rtx_count < 0: print a window around given rtx. |
38 | 77 |
39 There is also debug_rtx_find (rtx, uid) that will scan a list for UID and print | 78 There is also debug_rtx_find (rtx, uid) that will scan a list for UID and print |
40 it using debug_rtx_list. Usage example: set $foo=debug_rtx_find(first, 42) | 79 it using debug_rtx_list. Usage example: set $foo=debug_rtx_find(first, 42) |
41 end | 80 end |
42 | 81 |
43 define pt | 82 define pt |
44 set debug_tree ($) | 83 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
84 call debug_tree ($debug_arg) | |
45 end | 85 end |
46 | 86 |
47 document pt | 87 document pt |
48 Print the full structure of the tree that is $. | 88 GCC hook: pt [tree] |
49 Works only when an inferior is executing. | 89 Print the full structure of given tree. |
90 See also 'help-gcc-hooks'. | |
50 end | 91 end |
51 | 92 |
52 define pct | 93 define pct |
53 set debug_c_tree ($) | 94 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
95 call debug_c_tree ($debug_arg) | |
54 end | 96 end |
55 | 97 |
56 document pct | 98 document pct |
57 Print the tree that is $ in C syntax. | 99 GCC hook: pct [tree] |
58 Works only when an inferior is executing. | 100 Print given tree in C syntax. |
101 See also 'help-gcc-hooks'. | |
59 end | 102 end |
60 | 103 |
61 define pgg | 104 define pgg |
62 set debug_gimple_stmt ($) | 105 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
106 call debug_gimple_stmt ($debug_arg) | |
63 end | 107 end |
64 | 108 |
65 document pgg | 109 document pgg |
66 Print the Gimple statement that is $ in C syntax. | 110 GCC hook: pgg [gimple] |
67 Works only when an inferior is executing. | 111 Print given GIMPLE statement in C syntax. |
112 See also 'help-gcc-hooks'. | |
68 end | 113 end |
69 | 114 |
70 define pgq | 115 define pgq |
71 set debug_gimple_seq ($) | 116 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
117 call debug_gimple_seq ($debug_arg) | |
72 end | 118 end |
73 | 119 |
74 document pgq | 120 document pgq |
75 Print the Gimple sequence that is $ in C syntax. | 121 GCC hook: pgq [gimple_seq] |
76 Works only when an inferior is executing. | 122 Print given GIMPLE sequence in C syntax. |
123 See also 'help-gcc-hooks'. | |
77 end | 124 end |
78 | 125 |
79 define pgs | 126 define pgs |
80 set debug_generic_stmt ($) | 127 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
128 call debug_generic_stmt ($debug_arg) | |
81 end | 129 end |
82 | 130 |
83 document pgs | 131 document pgs |
84 Print the statement that is $ in C syntax. | 132 GCC hook: pgq [tree] |
85 Works only when an inferior is executing. | 133 Print given GENERIC statement in C syntax. |
134 See also 'help-gcc-hooks'. | |
86 end | 135 end |
87 | 136 |
88 define pge | 137 define pge |
89 set debug_generic_expr ($) | 138 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
139 call debug_generic_expr ($debug_arg) | |
90 end | 140 end |
91 | 141 |
92 document pge | 142 document pge |
93 Print the expression that is $ in C syntax. | 143 GCC hook: pge [tree] |
94 Works only when an inferior is executing. | 144 Print given GENERIC expression in C syntax. |
145 See also 'help-gcc-hooks'. | |
95 end | 146 end |
96 | 147 |
97 define pmz | 148 define pmz |
98 set mpz_out_str(stderr, 10, $) | 149 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
150 call mpz_out_str(stderr, 10, $debug_arg) | |
99 end | 151 end |
100 | 152 |
101 document pmz | 153 document pmz |
102 Print the mpz value that is $ | 154 GCC hook: pmz [mpz_t] |
103 Works only when an inferior is executing. | 155 Print given mpz value. |
156 See also 'help-gcc-hooks'. | |
104 end | 157 end |
105 | 158 |
106 define ptc | 159 define ptc |
107 output (enum tree_code) $.common.code | 160 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
161 output (enum tree_code) $debug_arg.base.code | |
108 echo \n | 162 echo \n |
109 end | 163 end |
110 | 164 |
111 document ptc | 165 document ptc |
112 Print the tree-code of the tree node that is $. | 166 GCC hook: ptc [tree] |
167 Print the tree-code of given tree node. | |
168 See also 'help-gcc-hooks'. | |
113 end | 169 end |
114 | 170 |
115 define pdn | 171 define pdn |
116 output $.decl_minimal.name->identifier.id.str | 172 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
173 output $debug_arg.decl_minimal.name->identifier.id.str | |
117 echo \n | 174 echo \n |
118 end | 175 end |
119 | 176 |
120 document pdn | 177 document pdn |
121 Print the name of the decl-node that is $. | 178 GCC hook: pdn [tree] |
179 Print the name of given decl-node. | |
180 See also 'help-gcc-hooks'. | |
122 end | 181 end |
123 | 182 |
124 define ptn | 183 define ptn |
125 output $.type.name->decl_minimal.name->identifier.id.str | 184 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
185 output $debug_arg.type.name->decl_minimal.name->identifier.id.str | |
126 echo \n | 186 echo \n |
127 end | 187 end |
128 | 188 |
129 document ptn | 189 document ptn |
130 Print the name of the type-node that is $. | 190 GCC hook: ptn [tree] |
191 Print the name of given type-node. | |
192 See also 'help-gcc-hooks'. | |
131 end | 193 end |
132 | 194 |
133 define pdd | 195 define pdd |
134 set debug_dwarf_die ($) | 196 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
197 call debug_dwarf_die ($debug_arg) | |
135 end | 198 end |
136 | 199 |
137 document pdd | 200 document pdd |
138 Print the dw_die_ref that is in $. | 201 GCC hook: pdd [dw_die_ref] |
202 Print given dw_die_ref. | |
203 See also 'help-gcc-hooks'. | |
139 end | 204 end |
140 | 205 |
141 define prc | 206 define prc |
142 output (enum rtx_code) $.code | 207 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
208 output (enum rtx_code) $debug_arg.code | |
143 echo \ ( | 209 echo \ ( |
144 output $.mode | 210 output $debug_arg.mode |
145 echo )\n | 211 echo )\n |
146 end | 212 end |
147 | 213 |
148 document prc | 214 document prc |
149 Print the rtx-code and machine mode of the rtx that is $. | 215 GCC hook: prc [rtx] |
216 Print the rtx-code and machine mode of given rtx. | |
217 See also 'help-gcc-hooks'. | |
150 end | 218 end |
151 | 219 |
152 define pi | 220 define pi |
153 print $.u.fld[0].rt_rtx@7 | 221 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
222 print $debug_arg.u.fld[0].rt_rtx@7 | |
154 end | 223 end |
155 | 224 |
156 document pi | 225 document pi |
157 Print the fields of an instruction that is $. | 226 GCC hook: pi [rtx_insn] |
227 Print the fields of given RTL instruction. | |
228 See also 'help-gcc-hooks'. | |
158 end | 229 end |
159 | 230 |
160 define pbs | 231 define pbs |
161 set print_binding_stack () | 232 call print_binding_stack () |
162 end | 233 end |
163 | 234 |
164 document pbs | 235 document pbs |
165 In cc1plus, print the current binding stack, frame by frame, up to and | 236 In cc1plus, print the current binding stack, frame by frame, up to and |
166 including the global binding level. | 237 including the global binding level. |
167 end | 238 end |
168 | 239 |
169 define pbb | |
170 set debug ($) | |
171 end | |
172 | |
173 document pbb | |
174 Dump the basic block that is in $, including rtx. | |
175 end | |
176 | |
177 define pbm | 240 define pbm |
178 set bitmap_print (stderr, $, "", "\n") | 241 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
242 call bitmap_print (stderr, $debug_arg, "", "\n") | |
179 end | 243 end |
180 | 244 |
181 document pbm | 245 document pbm |
182 Dump the bitmap that is in $ as a comma-separated list of numbers. | 246 GCC hook: pbm [bitmap] |
247 Dump given bitmap as a comma-separated list of numbers. | |
248 See also 'help-gcc-hooks'. | |
183 end | 249 end |
184 | 250 |
185 define pel | 251 define pel |
186 output expand_location ($) | 252 eval "set $debug_arg = $%s", $argc ? "arg0" : "" |
253 output expand_location ($debug_arg) | |
187 echo \n | 254 echo \n |
188 end | 255 end |
189 | 256 |
190 document pel | 257 document pel |
191 Print expanded location of $. | 258 GCC hook: pel [location_t] |
259 Print given location. | |
260 See also 'help-gcc-hooks'. | |
192 end | 261 end |
193 | 262 |
194 define pcfun | 263 define pcfun |
195 output debug_function (cfun ? cfun->decl : current_function_decl, 0) | 264 output debug_function (cfun ? cfun->decl : current_function_decl, 0) |
196 echo \n | 265 echo \n |
197 end | 266 end |
198 | 267 |
199 document pcfun | 268 document pcfun |
200 Print current function. | 269 Print current function. |
270 end | |
271 | |
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'. | |
201 end | 281 end |
202 | 282 |
203 define break-on-diagnostic | 283 define break-on-diagnostic |
204 break diagnostic_show_locus | 284 break diagnostic_show_locus |
205 end | 285 end |
207 document break-on-diagnostic | 287 document break-on-diagnostic |
208 Put a breakpoint on diagnostic_show_locus, called whenever a diagnostic | 288 Put a breakpoint on diagnostic_show_locus, called whenever a diagnostic |
209 is emitted (as opposed to those warnings that are suppressed by | 289 is emitted (as opposed to those warnings that are suppressed by |
210 command-line options). | 290 command-line options). |
211 end | 291 end |
292 | |
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 | |
212 | 312 |
213 # Define some macros helpful to gdb when it is expanding macros. | 313 # Define some macros helpful to gdb when it is expanding macros. |
214 macro define __FILE__ "gdb" | 314 macro define __FILE__ "gdb" |
215 macro define __LINE__ 1 | 315 macro define __LINE__ 1 |
216 macro define __FUNCTION__ "gdb" | 316 macro define __FUNCTION__ "gdb" |
217 macro define __null 0 | 317 macro define __null 0 |
218 macro define input_line expand_location(input_location).line | 318 macro define input_line expand_location(input_location).line |
219 macro define input_filename expand_location(input_location).file | 319 macro define input_filename expand_location(input_location).file |
320 | |
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 | |
220 | 325 |
221 # Gracefully handle aborts in functions used from gdb. | 326 # Gracefully handle aborts in functions used from gdb. |
222 set unwindonsignal on | 327 set unwindonsignal on |
223 | 328 |
224 # Put breakpoints at exit and fancy_abort in case abort is mapped | 329 # Put breakpoints at exit and fancy_abort in case abort is mapped |
273 skip BLOCK_FOR_INSN | 378 skip BLOCK_FOR_INSN |
274 skip PATTERN | 379 skip PATTERN |
275 skip INSN_LOCATION | 380 skip INSN_LOCATION |
276 skip INSN_HAS_LOCATION | 381 skip INSN_HAS_LOCATION |
277 skip JUMP_LABEL_AS_INSN | 382 skip JUMP_LABEL_AS_INSN |
383 | |
384 # Restore pagination to the previous state. | |
385 python if __gcc_prev_pagination: gdb.execute("set pagination on") |