public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@redhat.com>
To: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch] implement generic debug() for vectors and hash sets
Date: Mon, 16 Oct 2017 14:47:00 -0000	[thread overview]
Message-ID: <CAGm3qMW+oyrK8ytaC+pU2nMkDVsUG8raJdtxj18rMKDgMf-FmA@mail.gmail.com> (raw)
In-Reply-To: <CAGm3qMWSp34AbxpXXO+RdcS0zy+q-KcNMCdoU7pW+tqGvcDGXg@mail.gmail.com>

One more thing.

I see we have a "pvt" macro in gdbinit.in:

define pvt
set debug_vec_tree ($)
end

I propose we either remove this altogether, since we have a generic
debug() way of dumping things, or implement it with "set debug($)" if
somebody's finger memory will be adversely affected.  (I'm looking at
you Jakub ;-)).


On Mon, Oct 16, 2017 at 9:52 AM, Aldy Hernandez <aldyh@redhat.com> wrote:
> We have a generic mechanism for dumping types from the debugger with:
>
> (gdb) call debug(some_type)
>
> However, even though most types are implemented, we have no canonical
> way of dumping vectors or hash sets.
>
> The attached patch fixes this oversight.  With it you can call
> debug(vec<>) and debug(hash_set<>) with the following types: rtx,
> tree, basic_block, edge, rtx_insn.  More can be added simply by adding
> a debug_slim(your_type) overload and calling:
>
>   DEFINE_DEBUG_VEC (your_type)
>   DEFINE_DEBUG_HASH_SET (your_type)
>
> Here is an example of how things look with this patch:
>
> vec of edges:
> [0] = <edge 0x0x7f3f81c0d700 (6 -> 10)>
>
> vec of bbs:
> [0] = <basic_block 0x7f3f81ac9410 (6)>
> [1] = <basic_block 0x7f3f81ac96e8 (10)>
>
> vec of trees:
> [0] =  <integer_type 0x7f3f81ad55e8 int>
> [1] =  <integer_type 0x7f3f81ad5498 short int>
> [2] =  <integer_cst 0x7f3f81ada078 0>
>
> vec of rtx:
> [0] = (reg:SI 87)
> [1] = (reg:SI 87)
>
> hash of bbs:
> <basic_block 0x7f3f81ac96e8 (10)>
> <basic_block 0x7f3f81ac9410 (6)>
>
> OK for mainline?

  reply	other threads:[~2017-10-16 14:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16 13:56 Aldy Hernandez
2017-10-16 14:47 ` Aldy Hernandez [this message]
2017-10-23  9:49 ` PING Fwd: " Aldy Hernandez
2017-11-19 22:56   ` Jeff Law
2017-11-20 11:57     ` Aldy Hernandez
2017-11-21 11:33       ` Gerald Pfeifer
2017-11-21 12:46         ` Aldy Hernandez
2017-11-21 13:35           ` Gerald Pfeifer
2017-11-23 19:32         ` Gerald Pfeifer
2017-11-27 15:18           ` Aldy Hernandez
2017-11-27 17:33             ` Jeff Law
2018-02-12 21:31       ` PING Fwd: " Jason Merrill
2017-11-13  8:46 ` Aldy Hernandez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGm3qMW+oyrK8ytaC+pU2nMkDVsUG8raJdtxj18rMKDgMf-FmA@mail.gmail.com \
    --to=aldyh@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).