public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [patch] Do not break while asking with -batch
@ 2010-07-23 17:06 Jan Kratochvil
  2010-07-23 17:40 ` Tom Tromey
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kratochvil @ 2010-07-23 17:06 UTC (permalink / raw)
  To: gdb-patches

Hi,

there was PR 9591 which originated from a request to safely `gdb_gcore.sh'
even from a very small terminal window.

FSF GDB HEAD currently still asks in such window
	---Type <return> to continue, or q <return> to quit---
and aborts.

OK to check-in?

No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.


Thanks,
Jan


gdb/
2010-07-23  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* utils.c (prompt_for_continue): Return on BATCH_FLAG or not
	INPUT_FROM_TERMINAL_P.

--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -2155,6 +2155,9 @@ prompt_for_continue (void)
   char *ignore;
   char cont_prompt[120];
 
+  if (batch_flag || ! input_from_terminal_p ())
+    return;
+
   if (annotation_level > 1)
     printf_unfiltered (("\n\032\032pre-prompt-for-continue\n"));
 

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

* Re: [patch] Do not break while asking with -batch
  2010-07-23 17:06 [patch] Do not break while asking with -batch Jan Kratochvil
@ 2010-07-23 17:40 ` Tom Tromey
  2010-07-23 18:09   ` Jan Kratochvil
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2010-07-23 17:40 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

Jan> 2010-07-23  Jan Kratochvil  <jan.kratochvil@redhat.com>
Jan> 	* utils.c (prompt_for_continue): Return on BATCH_FLAG or not
Jan> 	INPUT_FROM_TERMINAL_P.

I think it would be reasonable to disable pagination if --batch or if
!input_from_terminal_p.  Actually, I thought we already did this for
batch...

That would mean putting the check in fputs_maybe_filtered alongside all
the other ones.

What do you (& others) think?

Tom

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

* Re: [patch] Do not break while asking with -batch
  2010-07-23 17:40 ` Tom Tromey
@ 2010-07-23 18:09   ` Jan Kratochvil
  2010-07-23 22:41     ` Tom Tromey
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kratochvil @ 2010-07-23 18:09 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Fri, 23 Jul 2010 19:39:49 +0200, Tom Tromey wrote:
> I think it would be reasonable to disable pagination if --batch or if
> !input_from_terminal_p.  Actually, I thought we already did this for
> batch...
> 
> That would mean putting the check in fputs_maybe_filtered alongside all
> the other ones.

Or maybe this more radical patch?

No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.


Thanks,
Jan


2010-07-23  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* top.c (input_from_terminal_p): Return 0 on BATCH_FLAG.
	* utils.c (defaulted_query): Do not explicitly check for BATCH_FLAG.
	(fputs_maybe_filtered): Do not do filtering also on
	! INPUT_FROM_TERMINAL_P.

--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1242,6 +1242,9 @@ input_from_terminal_p (void)
   if (interactive_mode != AUTO_BOOLEAN_AUTO)
     return interactive_mode == AUTO_BOOLEAN_TRUE;
 
+  if (batch_flag)
+    return 0;
+
   if (gdb_has_a_terminal () && instream == stdin)
     return 1;
 
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1634,7 +1634,7 @@ defaulted_query (const char *ctlstr, const char defchar, va_list args)
      question we're asking, and then answer the default automatically.  This
      way, important error messages don't get lost when talking to GDB
      over a pipe.  */
-  if (batch_flag || ! input_from_terminal_p ())
+  if (! input_from_terminal_p ())
     {
       wrap_here ("");
       vfprintf_filtered (gdb_stdout, ctlstr, args);
@@ -2352,7 +2352,8 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream,
 
   /* Don't do any filtering if it is disabled.  */
   if (stream != gdb_stdout
-      || !pagination_enabled
+      || ! pagination_enabled
+      || ! input_from_terminal_p ()
       || (lines_per_page == UINT_MAX && chars_per_line == UINT_MAX)
       || top_level_interpreter () == NULL
       || ui_out_is_mi_like_p (interp_ui_out (top_level_interpreter ())))

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

* Re: [patch] Do not break while asking with -batch
  2010-07-23 18:09   ` Jan Kratochvil
@ 2010-07-23 22:41     ` Tom Tromey
  2010-07-27 16:35       ` Joel Brobecker
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2010-07-23 22:41 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

Tom> I think it would be reasonable to disable pagination if --batch or if
Tom> !input_from_terminal_p.  Actually, I thought we already did this for
Tom> batch...

From NEWS:

*** Changes in GDB 7.2
[...]
* The --batch flag now disables pagination and queries.

Apparently I missed the pagination part... oops.

Jan> 2010-07-23  Jan Kratochvil  <jan.kratochvil@redhat.com>
Jan> 	* top.c (input_from_terminal_p): Return 0 on BATCH_FLAG.
Jan> 	* utils.c (defaulted_query): Do not explicitly check for BATCH_FLAG.
Jan> 	(fputs_maybe_filtered): Do not do filtering also on
Jan> 	! INPUT_FROM_TERMINAL_P.

Ok.

I think this should go in 7.2, as well, given the above NEWS entry.

Tom

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

* Re: [patch] Do not break while asking with -batch
  2010-07-23 22:41     ` Tom Tromey
@ 2010-07-27 16:35       ` Joel Brobecker
  2010-07-27 19:17         ` Jan Kratochvil
  0 siblings, 1 reply; 6+ messages in thread
From: Joel Brobecker @ 2010-07-27 16:35 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Jan Kratochvil, gdb-patches

> I think this should go in 7.2, as well, given the above NEWS entry.

Agreed on both counts (more radical version, and branch).

-- 
Joel

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

* Re: [patch] Do not break while asking with -batch
  2010-07-27 16:35       ` Joel Brobecker
@ 2010-07-27 19:17         ` Jan Kratochvil
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Kratochvil @ 2010-07-27 19:17 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Tom Tromey, gdb-patches

On Tue, 27 Jul 2010 18:34:54 +0200, Joel Brobecker wrote:
> Agreed on both counts (more radical version, and branch).

Checked-in HEAD:
	http://sourceware.org/ml/gdb-cvs/2010-07/msg00165.html
Checked-in 7.2:
	http://sourceware.org/ml/gdb-cvs/2010-07/msg00166.html


Thanks,
Jan

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

end of thread, other threads:[~2010-07-27 19:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-23 17:06 [patch] Do not break while asking with -batch Jan Kratochvil
2010-07-23 17:40 ` Tom Tromey
2010-07-23 18:09   ` Jan Kratochvil
2010-07-23 22:41     ` Tom Tromey
2010-07-27 16:35       ` Joel Brobecker
2010-07-27 19:17         ` Jan Kratochvil

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