1 # Copyright (C) 2001-2019 Free Software Foundation, Inc.
3 # This file is part of GCC.
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)
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.
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/>.
24 Print a representation of the GCC data structure that is $.
25 Works only when an inferior is executing.
33 Print the full structure of the rtx that is $.
34 Works only when an inferior is executing.
38 set debug_rtx_list ($, debug_rtx_count)
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 $.
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)
57 Print the full structure of the tree that is $.
58 Works only when an inferior is executing.
66 Print the tree that is $ in C syntax.
67 Works only when an inferior is executing.
71 set debug_gimple_stmt ($)
75 Print the Gimple statement that is $ in C syntax.
76 Works only when an inferior is executing.
80 set debug_gimple_seq ($)
84 Print the Gimple sequence that is $ in C syntax.
85 Works only when an inferior is executing.
89 set debug_generic_stmt ($)
93 Print the statement that is $ in C syntax.
94 Works only when an inferior is executing.
98 set debug_generic_expr ($)
102 Print the expression that is $ in C syntax.
103 Works only when an inferior is executing.
107 set mpz_out_str(stderr, 10, $)
111 Print the mpz value that is $
112 Works only when an inferior is executing.
116 output (enum tree_code) $.base.code
121 Print the tree-code of the tree node that is $.
125 output $.decl_minimal.name->identifier.id.str
130 Print the name of the decl-node that is $.
134 output $.type.name->decl_minimal.name->identifier.id.str
139 Print the name of the type-node that is $.
143 set debug_dwarf_die ($)
147 Print the dw_die_ref that is in $.
151 output (enum rtx_code) $.code
158 Print the rtx-code and machine mode of the rtx that is $.
162 print $.u.fld[0].rt_rtx@7
166 Print the fields of an instruction that is $.
170 set print_binding_stack ()
174 In cc1plus, print the current binding stack, frame by frame, up to and
175 including the global binding level.
179 set bitmap_print (stderr, $, "", "\n")
183 Dump the bitmap that is in $ as a comma-separated list of numbers.
187 output expand_location ($)
192 Print expanded location of $.
196 output debug_function (cfun ? cfun->decl : current_function_decl, 0)
201 Print current function.
209 Print TREE_TYPE of the tree node that is $
212 define break-on-diagnostic
213 break diagnostic_show_locus
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).
222 define reload-gdbhooks
223 python import imp; imp.reload(gdbhooks)
226 document reload-gdbhooks
227 Load the gdbhooks.py module again in order to pick up any changes made to it.
230 alias rh = reload-gdbhooks
232 # Define some macros helpful to gdb when it is expanding macros.
233 macro define __FILE__ "gdb"
234 macro define __LINE__ 1
235 macro define __FUNCTION__ "gdb"
236 macro define __null 0
237 macro define input_line expand_location(input_location).line
238 macro define input_filename expand_location(input_location).file
240 # Remember previous pagination status and turn it off, so that
241 # the messages for skip commands don't require pagination.
242 python __gcc_prev_pagination=gdb.parameter("pagination")
245 # Gracefully handle aborts in functions used from gdb.
246 set unwindonsignal on
248 # Put breakpoints at exit and fancy_abort in case abort is mapped
249 # to either fprintf/exit or fancy_abort.
252 # Put a breakpoint on internal_error to help with debugging ICEs.
256 # Don't let abort actually run, as it will make
257 # stdio stop working and therefore the `pr' command above as well.
258 # Put this last because gcc does not reference it any more unless
259 # USE_SYSTEM_ABORT is defined, so gdb may complain and bail out.
263 # Disable strict type checking. This allows developers to (for example)
264 # make inferior calls without casting absolute address to a suitable
268 # Skip all inline functions in tree.h.
269 # These are used in accessor macros.
270 # Note that this is added at the end because older gdb versions
271 # do not understand the 'skip' command.
272 # See https://sourceware.org/gdb/current/onlinedocs/gdb/Skipping-Over-Functions-and-Files.html
275 # Also skip inline functions in is-a.h.
284 # Likewise, skip various inline functions in rtl.h.
285 skip rtx_expr_list::next
286 skip rtx_expr_list::element
287 skip rtx_insn_list::next
288 skip rtx_insn_list::insn
289 skip rtx_sequence::len
290 skip rtx_sequence::element
291 skip rtx_sequence::insn
300 skip INSN_HAS_LOCATION
301 skip JUMP_LABEL_AS_INSN
303 # Restore pagination to the previous state.
304 python if __gcc_prev_pagination: gdb.execute("set pagination on")