RFA: PATCH to add pp command to gdbinit.in

Message ID CADzB+2mSSYbHJxP=d3KuKZForEHDWnVstx4QOtS-SL2DXqB9FQ@mail.gmail.com
State New
Headers show
Series
  • RFA: PATCH to add pp command to gdbinit.in
Related show

Commit Message

Jason Merrill Dec. 6, 2018, 8:59 p.m.
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?

Comments

Eric Gallager Dec. 10, 2018, 12:42 a.m. | #1
On 12/6/18, Jason Merrill <jason@redhat.com> 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?
Jason Merrill Dec. 10, 2018, 12:53 a.m. | #2
On Sun, Dec 9, 2018, 7:42 PM Eric Gallager <egall@gwmail.gwu.edu wrote:

> On 12/6/18, Jason Merrill <jason@redhat.com> 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

>
Jeff Law Dec. 13, 2018, 5:15 p.m. | #3
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
Marek Polacek Dec. 13, 2018, 5:26 p.m. | #4
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
Jason Merrill Dec. 13, 2018, 5:48 p.m. | #5
On Thu, Dec 13, 2018 at 12:26 PM Marek Polacek <polacek@redhat.com> 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
Marek Polacek Dec. 13, 2018, 5:52 p.m. | #6
On Thu, Dec 13, 2018 at 12:48:37PM -0500, Jason Merrill wrote:
> On Thu, Dec 13, 2018 at 12:26 PM Marek Polacek <polacek@redhat.com> 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

Patch

commit 2dd2501e3abbd9d0b70119534fa5a93e957432bf
Author: Jason Merrill <jason@redhat.com>
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
 # <http://www.gnu.org/licenses/>.
 
+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