[PATCH] Add cfun printing to gdbinit.in

Richard Biener richard.guenther@gmail.com
Tue Mar 10 10:33:00 GMT 2015


On Tue, Mar 10, 2015 at 11:31 AM, Marek Polacek <polacek@redhat.com> wrote:
> Typing "call debug_function (current_function_decl, 0)" every time I want to see
> the current function is bothersome, the more so if I accidentally tap TAB and gdb
> tries to autocomplete the current word (argh!).  The following adds an alias so I
> can just type "pcfun" and be happy.

Isn't cfun->decl much more likely to work?

> Ok?
>
> 2015-03-10  Marek Polacek  <polacek@redhat.com>
>
>         * gdbinit.in (pcfun): Define and document.
>
> diff --git gcc/gdbinit.in gcc/gdbinit.in
> index 10fe5ad..436de06 100644
> --- gcc/gdbinit.in
> +++ gcc/gdbinit.in
> @@ -199,6 +199,15 @@ document pel
>  Print expanded location of $.
>  end
>
> +define pcfun
> +output debug_function (current_function_decl, 0)
> +echo \n
> +end
> +
> +document pcfun
> +Print current function.
> +end
> +
>  # Define some macros helpful to gdb when it is expanding macros.
>  macro define __FILE__ "gdb"
>  macro define __LINE__ 1
>
>         Marek



More information about the Gcc-patches mailing list