public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] GDB hooks: improve documentation
@ 2020-12-02  9:22 Martin Liška
  2020-12-02  9:47 ` Alexander Monakov
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Liška @ 2020-12-02  9:22 UTC (permalink / raw)
  To: gcc-patches; +Cc: David Malcolm, Alexander Monakov

Hey.

I see the current help description of GCC hooks not much useful:

$ help user-defined
break-on-diagnostic -- Put a breakpoint on diagnostic_show_locus, called whenever a diagnostic
break-on-saved-diagnostic -- Put a breakpoint on ana::diagnostic_manager::add_diagnostic, called within
dot-fn --
dump-fn --
help-gcc-hooks -- GCC gdbinit file introduces several debugging shorthands:
pbm -- GCC hook: pbm [bitmap]
pbs -- In cc1plus, print the current binding stack, frame by frame, up to and
pcfun -- Print current function.
pct -- GCC hook: pct [tree]
pdd -- GCC hook: pdd [dw_die_ref]
pdn -- GCC hook: pdn [tree]
pel -- GCC hook: pel [location_t]
pge -- GCC hook: pge [tree]
pgg -- GCC hook: pgg [gimple]
pgq -- GCC hook: pgq [gimple_seq]
pgs -- GCC hook: pgs [tree]
pi -- GCC hook: pi [rtx_insn]
pmz -- GCC hook: pmz [mpz_t]
pp -- GCC hook: pp [any]
pr -- GCC hook: pr [rtx]
prc -- GCC hook: prc [rtx]
prl -- GCC hook: prl [rtx]
pt -- GCC hook: pt [tree]
ptc -- GCC hook: ptc [tree]
ptn -- GCC hook: ptn [tree]
reload-gdbhooks, rh -- Load the gdbhooks.py module again in order to pick up any changes made to it.
trt -- GCC hook: trt [tree]

It's quite hard to be familiar what each hooks means and rather suggest:

break-on-diagnostic -- Put a breakpoint on diagnostic_show_locus, called whenever a diagnostic
break-on-saved-diagnostic -- Put a breakpoint on ana::diagnostic_manager::add_diagnostic, called within
dot-fn --
dump-fn --
help-gcc-hooks -- GCC gdbinit file introduces several debugging shorthands:
pbm -- GCC hook: bitmap_print (bitmap)
pbs -- In cc1plus, print the current binding stack, frame by frame, up to and
pcfun -- Print current function.
pct -- GCC hook: debug_c_tree (tree)
pdd -- GCC hook: debug_dwarf_die (dw_die_ref)
pdn -- GCC hook: IDENTIFIER_POINTER (DECL_NAME (tree))
pel -- GCC hook: expand_location (location_t)
pge -- GCC hook: debug_generic_expr (tree)
pgg -- GCC hook: debug_gimple_stmt (gimple)
pgq -- GCC hook: debug_gimple_seq (gimple_seq)
pgs -- GCC hook: debug_generic_stmt (tree)
pi -- GCC hook: X0EXP (rtx_insn)
pmz -- GCC hook: mpz_out_str (mpz_t)
pp -- GCC hook: pp [any]
pr -- GCC hook: debug_rtx_list (rtx)
prc -- GCC hook: GET_CODE (rtx)
prl -- GCC hook: prl debug_rtx_list (rtx)
pt -- GCC hook: debug_tree (tree)
ptc -- GCC hook: TREE_CODE (tree)
ptn -- GCC hook: IDENTIFIER_POINTER (DECL_NAME (TREE_TYPE (tree)))
reload-gdbhooks, rh -- Load the gdbhooks.py module again in order to pick up any changes made to it.
trt -- GCC hook: TREE_TYPE (tree)

Thoughts?
Thanks,
Martin

gcc/ChangeLog:

	* gdbinit.in: Write what each command calls
	for a debugging function.
---
  gcc/gdbinit.in | 36 ++++++++++++++++++------------------
  1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/gcc/gdbinit.in b/gcc/gdbinit.in
index e951c19db63..e69de8081e9 100644
--- a/gcc/gdbinit.in
+++ b/gcc/gdbinit.in
@@ -58,7 +58,7 @@ call debug_rtx ($debug_arg)
  end
  
  document pr
-GCC hook: pr [rtx]
+GCC hook: debug_rtx_list (rtx)
  Print the full structure of given rtx.
  See also 'help-gcc-hooks'.
  end
@@ -69,7 +69,7 @@ call debug_rtx_list ($debug_arg, debug_rtx_count)
  end
  
  document prl
-GCC hook: prl [rtx]
+GCC hook: prl debug_rtx_list (rtx)
  Print the full structure of all rtx insns beginning at given rtx.
  Uses variable debug_rtx_count to control number of insns printed:
    debug_rtx_count > 0: print from given rtx on.
@@ -85,7 +85,7 @@ call debug_tree ($debug_arg)
  end
  
  document pt
-GCC hook: pt [tree]
+GCC hook: debug_tree (tree)
  Print the full structure of given tree.
  See also 'help-gcc-hooks'.
  end
@@ -96,7 +96,7 @@ call debug_c_tree ($debug_arg)
  end
  
  document pct
-GCC hook: pct [tree]
+GCC hook: debug_c_tree (tree)
  Print given tree in C syntax.
  See also 'help-gcc-hooks'.
  end
@@ -107,7 +107,7 @@ call debug_gimple_stmt ($debug_arg)
  end
  
  document pgg
-GCC hook: pgg [gimple]
+GCC hook: debug_gimple_stmt (gimple)
  Print given GIMPLE statement in C syntax.
  See also 'help-gcc-hooks'.
  end
@@ -118,7 +118,7 @@ call debug_gimple_seq ($debug_arg)
  end
  
  document pgq
-GCC hook: pgq [gimple_seq]
+GCC hook: debug_gimple_seq (gimple_seq)
  Print given GIMPLE sequence in C syntax.
  See also 'help-gcc-hooks'.
  end
@@ -129,7 +129,7 @@ call debug_generic_stmt ($debug_arg)
  end
  
  document pgs
-GCC hook: pgs [tree]
+GCC hook: debug_generic_stmt (tree)
  Print given GENERIC statement in C syntax.
  See also 'help-gcc-hooks'.
  end
@@ -140,7 +140,7 @@ call debug_generic_expr ($debug_arg)
  end
  
  document pge
-GCC hook: pge [tree]
+GCC hook: debug_generic_expr (tree)
  Print given GENERIC expression in C syntax.
  See also 'help-gcc-hooks'.
  end
@@ -151,7 +151,7 @@ call mpz_out_str(stderr, 10, $debug_arg)
  end
  
  document pmz
-GCC hook: pmz [mpz_t]
+GCC hook: mpz_out_str (mpz_t)
  Print given mpz value.
  See also 'help-gcc-hooks'.
  end
@@ -163,7 +163,7 @@ echo \n
  end
  
  document ptc
-GCC hook: ptc [tree]
+GCC hook: TREE_CODE (tree)
  Print the tree-code of given tree node.
  See also 'help-gcc-hooks'.
  end
@@ -175,7 +175,7 @@ echo \n
  end
  
  document pdn
-GCC hook: pdn [tree]
+GCC hook: IDENTIFIER_POINTER (DECL_NAME (tree))
  Print the name of given decl-node.
  See also 'help-gcc-hooks'.
  end
@@ -187,7 +187,7 @@ echo \n
  end
  
  document ptn
-GCC hook: ptn [tree]
+GCC hook: IDENTIFIER_POINTER (DECL_NAME (TREE_TYPE (tree)))
  Print the name of given type-node.
  See also 'help-gcc-hooks'.
  end
@@ -198,7 +198,7 @@ call debug_dwarf_die ($debug_arg)
  end
  
  document pdd
-GCC hook: pdd [dw_die_ref]
+GCC hook: debug_dwarf_die (dw_die_ref)
  Print given dw_die_ref.
  See also 'help-gcc-hooks'.
  end
@@ -212,7 +212,7 @@ echo )\n
  end
  
  document prc
-GCC hook: prc [rtx]
+GCC hook: GET_CODE (rtx)
  Print the rtx-code and machine mode of given rtx.
  See also 'help-gcc-hooks'.
  end
@@ -223,7 +223,7 @@ print $debug_arg.u.fld[0].rt_rtx@7
  end
  
  document pi
-GCC hook: pi [rtx_insn]
+GCC hook: X0EXP (rtx_insn)
  Print the fields of given RTL instruction.
  See also 'help-gcc-hooks'.
  end
@@ -243,7 +243,7 @@ call bitmap_print (stderr, $debug_arg, "", "\n")
  end
  
  document pbm
-GCC hook: pbm [bitmap]
+GCC hook: bitmap_print (bitmap)
  Dump given bitmap as a comma-separated list of numbers.
  See also 'help-gcc-hooks'.
  end
@@ -255,7 +255,7 @@ echo \n
  end
  
  document pel
-GCC hook: pel [location_t]
+GCC hook: expand_location (location_t)
  Print given location.
  See also 'help-gcc-hooks'.
  end
@@ -275,7 +275,7 @@ print ($debug_arg.typed.type)
  end
  
  document trt
-GCC hook: trt [tree]
+GCC hook: TREE_TYPE (tree)
  Print TREE_TYPE of given tree node.
  See also 'help-gcc-hooks'.
  end
-- 
2.29.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] GDB hooks: improve documentation
  2020-12-02  9:22 [PATCH] GDB hooks: improve documentation Martin Liška
@ 2020-12-02  9:47 ` Alexander Monakov
  2020-12-02 10:30   ` Martin Liška
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Monakov @ 2020-12-02  9:47 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches, David Malcolm

Hi,

On Wed, 2 Dec 2020, Martin Liška wrote:

> Hey.
> 
> I see the current help description of GCC hooks not much useful:
> 
> $ help user-defined
[snip]
> trt -- GCC hook: trt [tree]
> 
> It's quite hard to be familiar what each hooks means and rather suggest:
> 
[snip]
> trt -- GCC hook: TREE_TYPE (tree)
> 
> Thoughts?

Yes please! I did not know about 'help user-defined' when updating those
mini-doc snippets. I think your patch is a nice improvement.

It seems you are leaving 'pp' unchanged:

> pp -- GCC hook: pp [any]

I'd suggest perhaps "GCC hook: debug (<multiple overloads>)".

And one nit:

> @@ -69,7 +69,7 @@ call debug_rtx_list ($debug_arg, debug_rtx_count)
>  end
>   document prl
> -GCC hook: prl [rtx]
> +GCC hook: prl debug_rtx_list (rtx)

I think 'prl' before 'debug_rtx_list' should have been deleted.

Thanks.
Alexander

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] GDB hooks: improve documentation
  2020-12-02  9:47 ` Alexander Monakov
@ 2020-12-02 10:30   ` Martin Liška
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Liška @ 2020-12-02 10:30 UTC (permalink / raw)
  To: Alexander Monakov; +Cc: gcc-patches, David Malcolm

On 12/2/20 10:47 AM, Alexander Monakov wrote:
> Hi,
> 
> On Wed, 2 Dec 2020, Martin Liška wrote:
> 
>> Hey.
>>
>> I see the current help description of GCC hooks not much useful:
>>
>> $ help user-defined
> [snip]
>> trt -- GCC hook: trt [tree]
>>
>> It's quite hard to be familiar what each hooks means and rather suggest:
>>
> [snip]
>> trt -- GCC hook: TREE_TYPE (tree)
>>
>> Thoughts?
> 
> Yes please! I did not know about 'help user-defined' when updating those
> mini-doc snippets. I think your patch is a nice improvement.

Thanks! To be honest I use the help command quite often.

> 
> It seems you are leaving 'pp' unchanged:
> 
>> pp -- GCC hook: pp [any]
> 
> I'd suggest perhaps "GCC hook: debug (<multiple overloads>)".

Yep!

> 
> And one nit:
> 
>> @@ -69,7 +69,7 @@ call debug_rtx_list ($debug_arg, debug_rtx_count)
>>   end
>>    document prl
>> -GCC hook: prl [rtx]
>> +GCC hook: prl debug_rtx_list (rtx)
> 
> I think 'prl' before 'debug_rtx_list' should have been deleted.

Changed that as well.

I'm going to push the commit.
Martin

> 
> Thanks.
> Alexander
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-02 10:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-02  9:22 [PATCH] GDB hooks: improve documentation Martin Liška
2020-12-02  9:47 ` Alexander Monakov
2020-12-02 10:30   ` Martin Liška

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).