This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Ctrl-D


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]