diff mbox series

Disable gdb pagination temporarily in gdbinit.in

Message ID 20190103230702.GX30353@tucnak
State New
Headers show
Series Disable gdb pagination temporarily in gdbinit.in | expand

Commit Message

Jakub Jelinek Jan. 3, 2019, 11:07 p.m. UTC
Hi!

After upgrading gdb recently gdb ./cc1 etc. asks me to
--Type <RET> for more, q to quit, c to continue without paging--
on start, because the stuff it prints by default + all the
File tree.h will be skipped when stepping.
File is-a.h will be skipped when stepping.
File line-map.h will be skipped when stepping.
File timevar.h will be skipped when stepping.
Function rtx_expr_list::next will be skipped when stepping.
Function rtx_expr_list::element will be skipped when stepping.
Function rtx_insn_list::next will be skipped when stepping.
Function rtx_insn_list::insn will be skipped when stepping.
Function rtx_sequence::len will be skipped when stepping.
Function rtx_sequence::element will be skipped when stepping.
Function rtx_sequence::insn will be skipped when stepping.
Function INSN_UID will be skipped when stepping.
Function PREV_INSN will be skipped when stepping.
Function SET_PREV_INSN will be skipped when stepping.
Function NEXT_INSN will be skipped when stepping.
Function SET_NEXT_INSN will be skipped when stepping.
Function BLOCK_FOR_INSN will be skipped when stepping.
Function PATTERN will be skipped when stepping.
Function INSN_LOCATION will be skipped when stepping.
Function INSN_HAS_LOCATION will be skipped when stepping.
Function JUMP_LABEL_AS_INSN will be skipped when stepping.

lines don't fit into my 41 line terminal anymore.  The following patch
temporarily switches pagination off when printing all those skipped when
stepping messages and restores it back afterwards.

It uses python, but it seems we already unconditionally add to .gdbinit
python import sys; sys.path.append('../../gcc'); import gdbhooks
so I'd hope we don't regress with this anywhere.

Even better would be to tell gdb not to print the skip messages, but it
doesn't have such a support right now.

Tested on x86_64-linux, ok for trunk?

2019-01-03  Jakub Jelinek  <jakub@redhat.com>

	* gdbinit.in: Turn off pagination for the skip commands, restore
	it to previous state afterwards.


	Jakub

Comments

Richard Sandiford Jan. 4, 2019, 5:10 p.m. UTC | #1
Jakub Jelinek <jakub@redhat.com> writes:
> Hi!
>
> After upgrading gdb recently gdb ./cc1 etc. asks me to
> --Type <RET> for more, q to quit, c to continue without paging--
> on start, because the stuff it prints by default + all the
> File tree.h will be skipped when stepping.
> File is-a.h will be skipped when stepping.
> File line-map.h will be skipped when stepping.
> File timevar.h will be skipped when stepping.
> Function rtx_expr_list::next will be skipped when stepping.
> Function rtx_expr_list::element will be skipped when stepping.
> Function rtx_insn_list::next will be skipped when stepping.
> Function rtx_insn_list::insn will be skipped when stepping.
> Function rtx_sequence::len will be skipped when stepping.
> Function rtx_sequence::element will be skipped when stepping.
> Function rtx_sequence::insn will be skipped when stepping.
> Function INSN_UID will be skipped when stepping.
> Function PREV_INSN will be skipped when stepping.
> Function SET_PREV_INSN will be skipped when stepping.
> Function NEXT_INSN will be skipped when stepping.
> Function SET_NEXT_INSN will be skipped when stepping.
> Function BLOCK_FOR_INSN will be skipped when stepping.
> Function PATTERN will be skipped when stepping.
> Function INSN_LOCATION will be skipped when stepping.
> Function INSN_HAS_LOCATION will be skipped when stepping.
> Function JUMP_LABEL_AS_INSN will be skipped when stepping.
>
> lines don't fit into my 41 line terminal anymore.  The following patch
> temporarily switches pagination off when printing all those skipped when
> stepping messages and restores it back afterwards.
>
> It uses python, but it seems we already unconditionally add to .gdbinit
> python import sys; sys.path.append('../../gcc'); import gdbhooks
> so I'd hope we don't regress with this anywhere.
>
> Even better would be to tell gdb not to print the skip messages, but it
> doesn't have such a support right now.
>
> Tested on x86_64-linux, ok for trunk?
>
> 2019-01-03  Jakub Jelinek  <jakub@redhat.com>
>
> 	* gdbinit.in: Turn off pagination for the skip commands, restore
> 	it to previous state afterwards.

OK, thanks.

Richard
diff mbox series

Patch

--- gcc/gdbinit.in.jj	2019-01-01 12:37:17.890962924 +0100
+++ gcc/gdbinit.in	2019-01-03 21:41:44.649355028 +0100
@@ -219,6 +219,11 @@  macro define __null 0
 macro define input_line expand_location(input_location).line
 macro define input_filename expand_location(input_location).file
 
+# Remember previous pagination status and turn it off, so that
+# the messages for skip commands don't require pagination.
+python __gcc_prev_pagination=gdb.parameter("pagination")
+set pagination off
+
 # Gracefully handle aborts in functions used from gdb.
 set unwindonsignal on
 
@@ -276,3 +281,6 @@  skip PATTERN
 skip INSN_LOCATION
 skip INSN_HAS_LOCATION
 skip JUMP_LABEL_AS_INSN
+
+# Restore pagination to the previous state.
+python if __gcc_prev_pagination: gdb.execute("set pagination on")