From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 557 invoked by alias); 16 Jun 2009 14:58:13 -0000 Received: (qmail 544 invoked by uid 22791); 16 Jun 2009 14:58:11 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 16 Jun 2009 14:58:03 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 053E42BAB22; Tue, 16 Jun 2009 10:58:01 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id HGB9jS0diMyu; Tue, 16 Jun 2009 10:58:00 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 784EE2BAB1E; Tue, 16 Jun 2009 10:58:00 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 8AE1DF596C; Tue, 16 Jun 2009 07:57:56 -0700 (PDT) Date: Tue, 16 Jun 2009 14:58:00 -0000 From: Joel Brobecker To: Pierre Muller Cc: gdb-patches@sourceware.org, 'Daniel Jacobowitz' Subject: Re: [RFC] Improve testsuite for poor expect behavior Message-ID: <20090616145756.GB7730@adacore.com> References: <001201c9ebb1$96414b10$c2c3e130$@u-strasbg.fr> <20090613150505.GA28157@caradoc.them.org> <000001c9ec65$9bf13ca0$d3d3b5e0$@u-strasbg.fr> <20090613235454.GA1893@caradoc.them.org> <20090614002516.GO25703@adacore.com> <000001c9ed8a$21cfdc30$656f9490$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="xHFwDpU9dbj6ez1V" Content-Disposition: inline In-Reply-To: <000001c9ed8a$21cfdc30$656f9490$@u-strasbg.fr> User-Agent: Mutt/1.5.18 (2008-05-17) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-06/txt/msg00403.txt.bz2 --xHFwDpU9dbj6ez1V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 485 > > Yeah - we use that in two situations, one of them being our testsuite. > > I can resend if it helps. > > Yes, please. This would be very helpful to check if my solution > brings something more or if yours should be used. Here it is. I've extracted it from our tree, and the patch itself is pretty raw - needs testing and documentation, but it should allow you to see whether that helps or not in your case. I'll finish up the patch as soon as you confirm it's helping. -- Joel --xHFwDpU9dbj6ez1V Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="interactive.diff" Content-length: 2587 Index: top.c =================================================================== --- top.c (.../branches/gdb/FSF/current/gdb/top.c) (revision 149871) +++ top.c (.../trunk/gdb/gdb-head/gdb/top.c) (revision 149871) @@ -1288,12 +1308,38 @@ quit_force (char *args, int from_tty) exit (exit_code); } +/* If OFF, the debugger will run in non-interactive mode, which means + that it will automatically select the default answer to all the + queries made to the user. If ON, gdb will wait for the user to + answer all queries. If AUTO, gdb will determine whether to run + in interactive mode or not depending on whether stdin is a terminal + or not. */ +static enum auto_boolean interactive_mode = AUTO_BOOLEAN_AUTO; + +/* Implement the "show interactive-mode" option. */ + +static void +show_interactive_mode (struct ui_file *file, int from_tty, + struct cmd_list_element *c, + const char *value) +{ + if (interactive_mode == AUTO_BOOLEAN_AUTO) + fprintf_filtered (file, "\ +Debugger's interactive mode is %s (currently %s).\n", + value, input_from_terminal_p () ? "on" : "off"); + else + fprintf_filtered (file, "Debugger's interactive mode is %s.\n", value); +} + /* Returns whether GDB is running on a terminal and input is currently coming from that terminal. */ int input_from_terminal_p (void) { + if (interactive_mode != AUTO_BOOLEAN_AUTO) + return interactive_mode == AUTO_BOOLEAN_TRUE; + if (gdb_has_a_terminal () && instream == stdin) return 1; @@ -1625,6 +1675,19 @@ Use \"on\" to enable the notification, a show_exec_done_display_p, &setlist, &showlist); + add_setshow_auto_boolean_cmd ("interactive-mode", class_support, + &interactive_mode, _("\ +Set whether gdb should run in interactive mode or not"), _("\ +Show whether gdb runs in interactive mode"), _("\ +If on, gdb runs in interactive mode and waits for the user to answer\n\ +all its queries. If off, gdb runs in non-interactive mode and\n\ +automatically assumes the default answer to all its queries. If auto\n\ +(which is the default), automatically determine which mode to use based\n\ +on the standard input settings"), + NULL, + show_interactive_mode, + &setlist, &showlist); + add_setshow_filename_cmd ("data-directory", class_maintenance, &gdb_datadir, _("Set GDB's data directory."), _("Show GDB's data directory."), --xHFwDpU9dbj6ez1V--