Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Ctrl-D
@ 2006-11-30 13:10 Andrew STUBBS
  2006-12-04 12:17 ` Andrew STUBBS
  2006-12-05 20:50 ` Daniel Jacobowitz
  0 siblings, 2 replies; 6+ messages in thread
From: Andrew STUBBS @ 2006-11-30 13:10 UTC (permalink / raw)
  To: GDB Patches; +Cc: john.pye

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

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

end of thread, other threads:[~2006-12-06 16:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-30 13:10 [PATCH] Ctrl-D Andrew STUBBS
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox