From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23366 invoked by alias); 30 Nov 2006 13:10:40 -0000 Received: (qmail 23351 invoked by uid 22791); 30 Nov 2006 13:10:38 -0000 X-Spam-Check-By: sourceware.org Received: from lon-del-03.spheriq.net (HELO lon-del-03.spheriq.net) (195.46.50.99) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 30 Nov 2006 13:10:19 +0000 Received: from lon-out-02.spheriq.net ([195.46.50.130]) by lon-del-03.spheriq.net with ESMTP id kAUDAG8H006860 for ; Thu, 30 Nov 2006 13:10:16 GMT Received: from lon-cus-01.spheriq.net (lon-cus-01.spheriq.net [195.46.50.37]) by lon-out-02.spheriq.net with ESMTP id kAUDADIr024680 for ; Thu, 30 Nov 2006 13:10:16 GMT Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by lon-cus-01.spheriq.net with ESMTP id kAUDAC47007884 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Thu, 30 Nov 2006 13:10:13 GMT Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 21B39DA42; Thu, 30 Nov 2006 13:10:12 +0000 (GMT) Received: from mail1.bri.st.com (mail1.bri.st.com [164.129.8.218]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 42B974745F; Thu, 30 Nov 2006 13:10:10 +0000 (GMT) Received: from [164.129.15.13] (bri1043.bri.st.com [164.129.15.13]) by mail1.bri.st.com (MOS 3.7.5a-GA) with ESMTP id CIG62907 (AUTH stubbsa); Thu, 30 Nov 2006 13:10:09 GMT Message-ID: <456ED831.6000308@st.com> Date: Thu, 30 Nov 2006 13:10:00 -0000 From: Andrew STUBBS User-Agent: Thunderbird 1.5.0.8 (Windows/20061025) MIME-Version: 1.0 To: GDB Patches Cc: john.pye@anu.edu.au Subject: [PATCH] Ctrl-D Content-Type: multipart/mixed; boundary="------------030602030601040808010503" X-IsSubscribed: yes 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: 2006-11/txt/msg00416.txt.bz2 This is a multi-part message in MIME format. --------------030602030601040808010503 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 720 Hi, In response to the recent discussion of Ctrl-D behaviour on the GDB list, here is a patch which attempts to address the issues identified. This example shows two presses of Crtl-D: Old behaviour: (gdb) The program is running. Exit anyway? (y or n) bash$ New behaviour: (gdb) quit The program is running. Exit anyway? (y or n) Y bash$ In addition to these cosmetic changes, in have adjusted the code such that hook-quit will work, as will trace-commands: (gdb) define hook-quit Type commands for definition of "hook-quit". End with a line saying just "end". >set confirm 0 >end (gdb) set trace-commands on (gdb) quit +quit ++set confirm 0 bash$ :ADDPATCH CLI: Andrew Stubbs --------------030602030601040808010503 Content-Type: text/plain; name="ctrl-d.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ctrl-d.patch" Content-length: 1290 2006-11-30 Andrew Stubbs * event-top.c (command_handler): On EOF, print 'quit' and run quit command via execute_command such that hooks and trace work. * utils.c (defaulted_query): On EOF, print default answer and newline. Index: src/gdb/event-top.c =================================================================== --- src.orig/gdb/event-top.c 2006-07-21 15:46:53.000000000 +0100 +++ src/gdb/event-top.c 2006-11-30 12:51:46.000000000 +0000 @@ -501,7 +501,10 @@ command_handler (char *command) but GDB is still alive. In such a case, we just quit gdb killing the inferior program too. */ if (command == 0) - quit_command ((char *) 0, stdin == instream); + { + printf_unfiltered ("quit\n"); + execute_command ("quit", stdin == instream); + } time_at_cmd_start = get_run_time (); Index: src/gdb/utils.c =================================================================== --- src.orig/gdb/utils.c 2006-11-30 12:23:34.000000000 +0000 +++ src/gdb/utils.c 2006-11-30 12:24:09.000000000 +0000 @@ -1230,6 +1230,7 @@ defaulted_query (const char *ctlstr, con clearerr (stdin); /* in case of C-d */ if (answer == EOF) /* C-d */ { + printf_filtered ("%c\n", def_answer); retval = def_value; break; } --------------030602030601040808010503--