1# Copyright (C) 2001-2018 Free Software Foundation, Inc. 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 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 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 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 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 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 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 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 116output $.decl_minimal.name->identifier.id.str 117echo \n 118end 119 120document pdn 121Print the name of the decl-node that is $. 122end 123 124define ptn 125output $.type.name->decl_minimal.name->identifier.id.str 126echo \n 127end 128 129document ptn 130Print the name of the type-node that is $. 131end 132 133define pdd 134set debug_dwarf_die ($) 135end 136 137document pdd 138Print the dw_die_ref that is in $. 139end 140 141define prc 142output (enum rtx_code) $.code 143echo \ ( 144output $.mode 145echo )\n 146end 147 148document prc 149Print the rtx-code and machine mode of the rtx that is $. 150end 151 152define pi 153print $.u.fld[0].rt_rtx@7 154end 155 156document pi 157Print the fields of an instruction that is $. 158end 159 160define pbs 161set print_binding_stack () 162end 163 164document pbs 165In cc1plus, print the current binding stack, frame by frame, up to and 166including the global binding level. 167end 168 169define pbb 170set debug ($) 171end 172 173document pbb 174Dump the basic block that is in $, including rtx. 175end 176 177define pbm 178set bitmap_print (stderr, $, "", "\n") 179end 180 181document pbm 182Dump the bitmap that is in $ as a comma-separated list of numbers. 183end 184 185define pel 186output expand_location ($) 187echo \n 188end 189 190document pel 191Print expanded location of $. 192end 193 194define pcfun 195output debug_function (cfun ? cfun->decl : current_function_decl, 0) 196echo \n 197end 198 199document pcfun 200Print current function. 201end 202 203define break-on-diagnostic 204break diagnostic_show_locus 205end 206 207document break-on-diagnostic 208Put a breakpoint on diagnostic_show_locus, called whenever a diagnostic 209is emitted (as opposed to those warnings that are suppressed by 210command-line options). 211end 212 213# Define some macros helpful to gdb when it is expanding macros. 214macro define __FILE__ "gdb" 215macro define __LINE__ 1 216macro define __FUNCTION__ "gdb" 217macro define __null 0 218macro define input_line expand_location(input_location).line 219macro define input_filename expand_location(input_location).file 220 221# Gracefully handle aborts in functions used from gdb. 222set unwindonsignal on 223 224# Put breakpoints at exit and fancy_abort in case abort is mapped 225# to either fprintf/exit or fancy_abort. 226b fancy_abort 227 228# Put a breakpoint on internal_error to help with debugging ICEs. 229b internal_error 230 231set complaints 0 232# Don't let abort actually run, as it will make 233# stdio stop working and therefore the `pr' command above as well. 234# Put this last because gcc does not reference it any more unless 235# USE_SYSTEM_ABORT is defined, so gdb may complain and bail out. 236b exit 237b abort 238 239# Disable strict type checking. This allows developers to (for example) 240# make inferior calls without casting absolute address to a suitable 241# pointer type. 242set check type off 243 244# Skip all inline functions in tree.h. 245# These are used in accessor macros. 246# Note that this is added at the end because older gdb versions 247# do not understand the 'skip' command. 248# See https://sourceware.org/gdb/current/onlinedocs/gdb/Skipping-Over-Functions-and-Files.html 249skip file tree.h 250 251# Also skip inline functions in is-a.h. 252skip file is-a.h 253 254# And line-map.h. 255skip file line-map.h 256 257# And timevar.h. 258skip file timevar.h 259 260# Likewise, skip various inline functions in rtl.h. 261skip rtx_expr_list::next 262skip rtx_expr_list::element 263skip rtx_insn_list::next 264skip rtx_insn_list::insn 265skip rtx_sequence::len 266skip rtx_sequence::element 267skip rtx_sequence::insn 268skip INSN_UID 269skip PREV_INSN 270skip SET_PREV_INSN 271skip NEXT_INSN 272skip SET_NEXT_INSN 273skip BLOCK_FOR_INSN 274skip PATTERN 275skip INSN_LOCATION 276skip INSN_HAS_LOCATION 277skip JUMP_LABEL_AS_INSN 278