Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: Re: [RFC] Never silently discard internal errors
Date: Mon, 25 Sep 2006 21:17:00 -0000	[thread overview]
Message-ID: <m3ejtz63wx.fsf@codesourcery.com> (raw)
In-Reply-To: <20060925200303.GA18759@nevyn.them.org> (Daniel Jacobowitz's message of "Mon, 25 Sep 2006 16:03:03 -0400")


Daniel Jacobowitz <drow@false.org> writes:
> On Mon, Sep 25, 2006 at 12:38:40PM -0700, Jim Blandy wrote:
>> What if we simply had 'query' itself print out the prompt, followed by
>> "[answering 'y', since standard input is not a terminal]" (or
>> something more tasteful)?  Then you wouldn't have to go around
>> decorating all the calls to query.
>
> I assume that would be wrong for "set confirm off"?

I don't want to turn this into a bikeshed discussion, but here's what
I had in mind:

*** utils.c	12 Jul 2006 11:50:18 -0700	1.168
--- utils.c	25 Sep 2006 14:17:20 -0700	
***************
*** 1142,1152 ****
    int ans2;
    int retval;
  
!   /* Automatically answer "yes" if input is not from the user
!      directly, or if the user did not want prompts.  */
!   if (!input_from_terminal_p () || !caution)
      return 1;
  
    if (deprecated_query_hook)
      {
        va_start (args, ctlstr);
--- 1142,1168 ----
    int ans2;
    int retval;
  
!   /* If the user does not want prompts, answer "yes" automatically.  */
!   if (! caution)
      return 1;
  
+   /* If input isn't coming from the user directly, just say what
+      question we're asking, and then answer "yes" automatically.  This
+      way, important error messages don't get lost when talking to GDB
+      over a pipe.  */
+   if (! input_from_terminal_p ())
+     {
+       wrap_here ("");
+ 
+       va_start (args, ctlstr);
+       vfprintf_filtered (gdb_stdout, ctlstr, args);
+       va_end (args);
+       printf_filtered (_("(y or n) [answered yes; input not from terminal]"));
+       gdb_flush (gdb_stdout);
+ 
+       return 1;
+     }
+ 
    if (deprecated_query_hook)
      {
        va_start (args, ctlstr);


  reply	other threads:[~2006-09-25 21:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-25 18:42 Daniel Jacobowitz
2006-09-25 19:10 ` Michael Snyder
2006-09-25 19:37 ` Jim Blandy
2006-09-25 20:03   ` Daniel Jacobowitz
2006-09-25 21:17     ` Jim Blandy [this message]
2006-09-26  3:56       ` Daniel Jacobowitz
2006-10-18 22:21         ` Daniel Jacobowitz
2006-09-25 19:43 ` Eli Zaretskii
2006-09-25 20:05   ` Daniel Jacobowitz
2006-09-26  3:29     ` Eli Zaretskii
2006-09-26  3:56       ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3ejtz63wx.fsf@codesourcery.com \
    --to=jimb@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox