public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Add cfun printing to gdbinit.in
@ 2015-03-10 10:31 Marek Polacek
  2015-03-10 10:33 ` Richard Biener
  0 siblings, 1 reply; 4+ messages in thread
From: Marek Polacek @ 2015-03-10 10:31 UTC (permalink / raw)
  To: GCC Patches; +Cc: David Malcolm

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.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Add cfun printing to gdbinit.in
  2015-03-10 10:31 [PATCH] Add cfun printing to gdbinit.in Marek Polacek
@ 2015-03-10 10:33 ` Richard Biener
  2015-03-10 10:38   ` Marek Polacek
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Biener @ 2015-03-10 10:33 UTC (permalink / raw)
  To: Marek Polacek; +Cc: GCC Patches, David Malcolm

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Add cfun printing to gdbinit.in
  2015-03-10 10:33 ` Richard Biener
@ 2015-03-10 10:38   ` Marek Polacek
  2015-03-10 11:11     ` Richard Biener
  0 siblings, 1 reply; 4+ messages in thread
From: Marek Polacek @ 2015-03-10 10:38 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches, David Malcolm

On Tue, Mar 10, 2015 at 11:33:13AM +0100, Richard Biener wrote:
> Isn't cfun->decl much more likely to work?

Dunno, if that's the case, then:

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 (cfun->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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Add cfun printing to gdbinit.in
  2015-03-10 10:38   ` Marek Polacek
@ 2015-03-10 11:11     ` Richard Biener
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Biener @ 2015-03-10 11:11 UTC (permalink / raw)
  To: Marek Polacek; +Cc: GCC Patches, David Malcolm

On Tue, Mar 10, 2015 at 11:38 AM, Marek Polacek <polacek@redhat.com> wrote:
> On Tue, Mar 10, 2015 at 11:33:13AM +0100, Richard Biener wrote:
>> Isn't cfun->decl much more likely to work?
>
> Dunno, if that's the case, then:

Ok (or use cfun ? cfun->decl : current_function_decl).

Thanks,
Richard.

> 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 (cfun->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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-03-10 11:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-10 10:31 [PATCH] Add cfun printing to gdbinit.in Marek Polacek
2015-03-10 10:33 ` Richard Biener
2015-03-10 10:38   ` Marek Polacek
2015-03-10 11:11     ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).