Re: RFA: PATCH to add pp command to gdbinit.in

2018-12-13 Thread Marek Polacek
On Thu, Dec 13, 2018 at 12:48:37PM -0500, Jason Merrill wrote:
> On Thu, Dec 13, 2018 at 12:26 PM Marek Polacek  wrote:
> > On Thu, Dec 13, 2018 at 10:15:07AM -0700, Jeff Law wrote:
> > > On 12/6/18 1:59 PM, Jason Merrill wrote:
> > > > Since pvt was removed, it's bugged me that to pretty-print a vec I
> > > > needed to write out "call debug($)".  So this patch adds a generic
> > > > command "pp" to print anything handled by a debug overload.
> > > >
> > > > OK for trunk?
> > > >
> > > Seems quite reasonable.  I didn't even know we had a debug method for 
> > > vecs.
> 
> > > I wonder if we should standardize this stuff so that every significant
> > > datastructure has a debug method.
> 
> Yes, I thought that was the idea.
> 
> > Yeah, I think go ahead.  Speaking of which, in the C++ FE, I used to could 
> > do
> > this:
> >
> > (gdb) call debug(parser)
> >
> > but that now prints some crap like [128], and so I have to type
> >
> > (gdb) call cp_debug_parser(stderr,parser)
> >
> > which bothers me very very much.  Anyone know what's up with that?  It used 
> > to
> > work.
> 
> Hmm, it works for me.

Aha -- I had to
(gdb) set overload-resolution on
which I had had set to off for some other reasons.

Marek


Re: RFA: PATCH to add pp command to gdbinit.in

2018-12-13 Thread Jason Merrill
On Thu, Dec 13, 2018 at 12:26 PM Marek Polacek  wrote:
> On Thu, Dec 13, 2018 at 10:15:07AM -0700, Jeff Law wrote:
> > On 12/6/18 1:59 PM, Jason Merrill wrote:
> > > Since pvt was removed, it's bugged me that to pretty-print a vec I
> > > needed to write out "call debug($)".  So this patch adds a generic
> > > command "pp" to print anything handled by a debug overload.
> > >
> > > OK for trunk?
> > >
> > Seems quite reasonable.  I didn't even know we had a debug method for vecs.

> > I wonder if we should standardize this stuff so that every significant
> > datastructure has a debug method.

Yes, I thought that was the idea.

> Yeah, I think go ahead.  Speaking of which, in the C++ FE, I used to could do
> this:
>
> (gdb) call debug(parser)
>
> but that now prints some crap like [128], and so I have to type
>
> (gdb) call cp_debug_parser(stderr,parser)
>
> which bothers me very very much.  Anyone know what's up with that?  It used to
> work.

Hmm, it works for me.

Jason


Re: RFA: PATCH to add pp command to gdbinit.in

2018-12-13 Thread Marek Polacek
On Thu, Dec 13, 2018 at 10:15:07AM -0700, Jeff Law wrote:
> On 12/6/18 1:59 PM, Jason Merrill wrote:
> > Since pvt was removed, it's bugged me that to pretty-print a vec I
> > needed to write out "call debug($)".  So this patch adds a generic
> > command "pp" to print anything handled by a debug overload.
> > 
> > OK for trunk?
> > 
> Seems quite reasonable.  I didn't even know we had a debug method for vecs.

Yeah, I think go ahead.  Speaking of which, in the C++ FE, I used to could do
this:

(gdb) call debug(parser)

but that now prints some crap like [128], and so I have to type

(gdb) call cp_debug_parser(stderr,parser)

which bothers me very very much.  Anyone know what's up with that?  It used to
work.

Marek


Re: RFA: PATCH to add pp command to gdbinit.in

2018-12-13 Thread Jeff Law
On 12/6/18 1:59 PM, Jason Merrill wrote:
> Since pvt was removed, it's bugged me that to pretty-print a vec I
> needed to write out "call debug($)".  So this patch adds a generic
> command "pp" to print anything handled by a debug overload.
> 
> OK for trunk?
> 
Seems quite reasonable.  I didn't even know we had a debug method for vecs.

I wonder if we should standardize this stuff so that every significant
datastructure has a debug method.

jeff



Re: RFA: PATCH to add pp command to gdbinit.in

2018-12-09 Thread Jason Merrill
On Sun, Dec 9, 2018, 7:42 PM Eric Gallager  On 12/6/18, Jason Merrill  wrote:
> > Since pvt was removed, it's bugged me that to pretty-print a vec I
> > needed to write out "call debug($)".  So this patch adds a generic
> > command "pp" to print anything handled by a debug overload.
> >
> > OK for trunk?
> >
>
> Why does it also change pbb to do the same thing as the new pp command
> you're adding?
>

I assumed that some people were used to using pbb for basic_blocks. But on
reflection, the command before my patch didn't work at all, so it's
unlikely anyone was relying on it, so it's probably better to remove it.

Jason

>


Re: RFA: PATCH to add pp command to gdbinit.in

2018-12-09 Thread Eric Gallager
On 12/6/18, Jason Merrill  wrote:
> Since pvt was removed, it's bugged me that to pretty-print a vec I
> needed to write out "call debug($)".  So this patch adds a generic
> command "pp" to print anything handled by a debug overload.
>
> OK for trunk?
>

Why does it also change pbb to do the same thing as the new pp command
you're adding?


RFA: PATCH to add pp command to gdbinit.in

2018-12-06 Thread Jason Merrill
Since pvt was removed, it's bugged me that to pretty-print a vec I
needed to write out "call debug($)".  So this patch adds a generic
command "pp" to print anything handled by a debug overload.

OK for trunk?
commit 2dd2501e3abbd9d0b70119534fa5a93e957432bf
Author: Jason Merrill 
Date:   Tue Nov 20 01:18:00 2018 -0500

* gdbinit.in (pp): New macro.

(pbb): Fix.

diff --git a/gcc/gdbinit.in b/gcc/gdbinit.in
index 4db977f0bab..e7d34686864 100644
--- a/gcc/gdbinit.in
+++ b/gcc/gdbinit.in
@@ -16,6 +16,15 @@
 # along with GCC; see the file COPYING3.  If not see
 # .
 
+define pp
+call debug ($)
+end
+
+document pp
+Print a representation of the GCC data structure that is $.
+Works only when an inferior is executing.
+end
+
 define pr
 set debug_rtx ($)
 end
@@ -167,7 +176,7 @@ including the global binding level.
 end
 
 define pbb
-set debug ($)
+call debug ($)
 end
 
 document pbb