Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew STUBBS <andrew.stubbs@st.com>
To: GDB Patches <gdb-patches@sourceware.org>
Cc: john.pye@anu.edu.au
Subject: [PATCH] Ctrl-D
Date: Thu, 30 Nov 2006 13:10:00 -0000	[thread overview]
Message-ID: <456ED831.6000308@st.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 720 bytes --]

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) <C-d>The program is running.  Exit anyway? (y or n) <C-d>bash$

New behaviour:

(gdb) <C-d>quit
The program is running.  Exit anyway? (y or n) <C-d>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) <C-d>quit
+quit
++set confirm 0
bash$


:ADDPATCH CLI:

Andrew Stubbs

[-- Attachment #2: ctrl-d.patch --]
[-- Type: text/plain, Size: 1290 bytes --]

2006-11-30  Andrew Stubbs  <andrew.stubbs@st.com>

	* 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;
 	}

             reply	other threads:[~2006-11-30 13:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-30 13:10 Andrew STUBBS [this message]
2006-12-04 12:17 ` Andrew STUBBS
2006-12-05  4:28   ` Joel Brobecker
2006-12-05 20:50 ` Daniel Jacobowitz
2006-12-06  1:06   ` Joel Brobecker
2006-12-06 16:54   ` Andrew STUBBS

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=456ED831.6000308@st.com \
    --to=andrew.stubbs@st.com \
    --cc=gdb-patches@sourceware.org \
    --cc=john.pye@anu.edu.au \
    /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