Gdb documentation says that gdb-defined functions refer to their args as $arg0…$argN. The just "$" that gdbinit is using here refers to something else, which results in gdb errors, or even crashes of debuggee. Let's fix that.
* (debug,debug_rtx,pr,prl,pt,pct,pgg,pgq,pgq,pgs,pge,pmz,ptc, pdn,ptn,pdd,prc,pi,pbs,pbm,pel,pcfun,trt): replace $ with $arg0 --- gcc/gdbinit.in | 82 +++++++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/gcc/gdbinit.in b/gcc/gdbinit.in index a933ddc6141..71a01edaa71 100644 --- a/gcc/gdbinit.in +++ b/gcc/gdbinit.in @@ -17,153 +17,153 @@ # <http://www.gnu.org/licenses/>. define pp -call debug ($) +call debug ($arg0) end document pp -Print a representation of the GCC data structure that is $. +Print a representation of the GCC data structure that is $arg0. Works only when an inferior is executing. end define pr -call debug_rtx ($) +call debug_rtx ($arg0) end document pr -Print the full structure of the rtx that is $. +Print the full structure of the rtx that is $arg0. Works only when an inferior is executing. end define prl -call debug_rtx_list ($, debug_rtx_count) +call debug_rtx_list ($arg0, debug_rtx_count) end document prl -Print the full structure of all rtx insns beginning at $. +Print the full structure of all rtx insns beginning at $arg0. Works only when an inferior is executing. Uses variable debug_rtx_count to control number of insns printed: - debug_rtx_count > 0: print from $ on. - debug_rtx_count < 0: print a window around $. + debug_rtx_count > 0: print from $arg0 on. + debug_rtx_count < 0: print a window around $arg0. There is also debug_rtx_find (rtx, uid) that will scan a list for UID and print it using debug_rtx_list. Usage example: set $foo=debug_rtx_find(first, 42) end define pt -call debug_tree ($) +call debug_tree ($arg0) end document pt -Print the full structure of the tree that is $. +Print the full structure of the tree that is $arg0. Works only when an inferior is executing. end define pct -call debug_c_tree ($) +call debug_c_tree ($arg0) end document pct -Print the tree that is $ in C syntax. +Print the tree that is $arg0 in C syntax. Works only when an inferior is executing. end define pgg -call debug_gimple_stmt ($) +call debug_gimple_stmt ($arg0) end document pgg -Print the Gimple statement that is $ in C syntax. +Print the Gimple statement that is $arg0 in C syntax. Works only when an inferior is executing. end define pgq -call debug_gimple_seq ($) +call debug_gimple_seq ($arg0) end document pgq -Print the Gimple sequence that is $ in C syntax. +Print the Gimple sequence that is $arg0 in C syntax. Works only when an inferior is executing. end define pgs -call debug_generic_stmt ($) +call debug_generic_stmt ($arg0) end document pgs -Print the statement that is $ in C syntax. +Print the statement that is $arg0 in C syntax. Works only when an inferior is executing. end define pge -call debug_generic_expr ($) +call debug_generic_expr ($arg0) end document pge -Print the expression that is $ in C syntax. +Print the expression that is $arg0 in C syntax. Works only when an inferior is executing. end define pmz -call mpz_out_str(stderr, 10, $) +call mpz_out_str(stderr, 10, $arg0) end document pmz -Print the mpz value that is $ +Print the mpz value that is $arg0 Works only when an inferior is executing. end define ptc -output (enum tree_code) $.base.code +output (enum tree_code) $arg0.base.code echo \n end document ptc -Print the tree-code of the tree node that is $. +Print the tree-code of the tree node that is $arg0. end define pdn -output $.decl_minimal.name->identifier.id.str +output $arg0.decl_minimal.name->identifier.id.str echo \n end document pdn -Print the name of the decl-node that is $. +Print the name of the decl-node that is $arg0. end define ptn -output $.type.name->decl_minimal.name->identifier.id.str +output $arg0.type.name->decl_minimal.name->identifier.id.str echo \n end document ptn -Print the name of the type-node that is $. +Print the name of the type-node that is $arg0. end define pdd -call debug_dwarf_die ($) +call debug_dwarf_die ($arg0) end document pdd -Print the dw_die_ref that is in $. +Print the dw_die_ref that is in $arg0. end define prc -output (enum rtx_code) $.code +output (enum rtx_code) $arg0.code echo \ ( -output $.mode +output $arg0.mode echo )\n end document prc -Print the rtx-code and machine mode of the rtx that is $. +Print the rtx-code and machine mode of the rtx that is $arg0. end define pi -print $.u.fld[0].rt_rtx@7 +print $arg0.u.fld[0].rt_rtx@7 end document pi -Print the fields of an instruction that is $. +Print the fields of an instruction that is $arg0. end define pbs @@ -176,20 +176,20 @@ including the global binding level. end define pbm -call bitmap_print (stderr, $, "", "\n") +call bitmap_print (stderr, $arg0, "", "\n") end document pbm -Dump the bitmap that is in $ as a comma-separated list of numbers. +Dump the bitmap that is in $arg0 as a comma-separated list of numbers. end define pel -output expand_location ($) +output expand_location ($arg0) echo \n end document pel -Print expanded location of $. +Print expanded location of $arg0. end define pcfun @@ -202,11 +202,11 @@ Print current function. end define trt -print ($.typed.type) +print ($arg0.typed.type) end document trt -Print TREE_TYPE of the tree node that is $ +Print TREE_TYPE of the tree node that is $arg0 end define break-on-diagnostic -- 2.24.0