[patch] implement generic debug() for vectors and hash sets

Aldy Hernandez aldyh@redhat.com
Mon Oct 16 14:47:00 GMT 2017


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?



More information about the Gcc-patches mailing list