From efbf619bab726bad8d69c8d765cc2e6cba3d9fc3 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 10 Apr 2018 16:43:09 +0200 Subject: [PATCH] gdbhooks: Add new pretty-printers for: varpool_node, symtab_node, cgraph_edge and ipa_ref. 2018-04-10 Martin Liska * gdbhooks.py: Add pretty-printers for varpool_node, symtab_node, cgraph_edge and ipa_ref. From-SVN: r259283 --- gcc/ChangeLog | 5 +++++ gcc/gdbhooks.py | 54 ++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 52 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c339cf975e5..aee206041a3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-04-10 Martin Liska + + * gdbhooks.py: Add pretty-printers for varpool_node, symtab_node, + cgraph_edge and ipa_ref. + 2018-04-10 Jakub Jelinek PR target/85177 diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py index f13e4e67402..e9913e0eb32 100644 --- a/gcc/gdbhooks.py +++ b/gcc/gdbhooks.py @@ -105,10 +105,19 @@ it's a quick way of getting lots of debuggability quickly. Callgraph nodes are printed with the name of the function decl, if available: (gdb) frame 5 - #5 0x00000000006c288a in expand_function (node=) at ../../src/gcc/cgraphunit.c:1594 + #5 0x00000000006c288a in expand_function (node=) at ../../src/gcc/cgraphunit.c:1594 1594 execute_pass_list (g->get_passes ()->all_passes); (gdb) p node - $1 = + $1 = + +Similarly for symtab_node and varpool_node classes. + +Cgraph edges are printed with the name of caller and callee: + (gdb) p this->callees + $4 = -> )> + +IPA reference follow very similar format: + (gdb) Value returned is $5 = -> :IPA_REF_ADDR)> vec<> pointers are printed as the address followed by the elements in braces. Here's a length 2 vec: @@ -245,18 +254,45 @@ class TreePrinter: # Callgraph pretty-printers ###################################################################### -class CGraphNodePrinter: +class SymtabNodePrinter: def __init__(self, gdbval): self.gdbval = gdbval def to_string (self): - result = '