* [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* Re: [PATCH] Ctrl-D
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
1 sibling, 1 reply; 6+ messages in thread
From: Andrew STUBBS @ 2006-12-04 12:17 UTC (permalink / raw)
To: GDB Patches
Any chance of getting this nice-to-have into 6.6? I'm away from Friday
onwards.
Andrew STUBBS wrote:
> 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;
> }
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] Ctrl-D
2006-12-04 12:17 ` Andrew STUBBS
@ 2006-12-05 4:28 ` Joel Brobecker
0 siblings, 0 replies; 6+ messages in thread
From: Joel Brobecker @ 2006-12-05 4:28 UTC (permalink / raw)
To: Andrew STUBBS; +Cc: GDB Patches
Hi Andrew,
> Any chance of getting this nice-to-have into 6.6? I'm away from Friday
> onwards.
My rationale is that this patch is only a nice-to-have. Also, it is
not completely obvious for me either (the effect of changing the call
to quit_command into a call to execute_command needs to be looked at).
--
Joel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Ctrl-D
2006-11-30 13:10 [PATCH] Ctrl-D Andrew STUBBS
2006-12-04 12:17 ` Andrew STUBBS
@ 2006-12-05 20:50 ` Daniel Jacobowitz
2006-12-06 1:06 ` Joel Brobecker
2006-12-06 16:54 ` Andrew STUBBS
1 sibling, 2 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2006-12-05 20:50 UTC (permalink / raw)
To: Andrew STUBBS; +Cc: GDB Patches, john.pye
On Thu, Nov 30, 2006 at 01:10:09PM +0000, Andrew STUBBS wrote:
> New behaviour:
>
> (gdb) <C-d>quit
> The program is running. Exit anyway? (y or n) <C-d>Y
> bash$
How'd you feel about "EOF [assumed %c]" or something like that? I'd
look at that and think I typed the Y.
> 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.
OK for HEAD with or without that change, as you prefer. I'd recommend
this for 6.6 now that it's in HEAD; Joel, is that OK?
:REVIEWMAIL:
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Ctrl-D
2006-12-05 20:50 ` Daniel Jacobowitz
@ 2006-12-06 1:06 ` Joel Brobecker
2006-12-06 16:54 ` Andrew STUBBS
1 sibling, 0 replies; 6+ messages in thread
From: Joel Brobecker @ 2006-12-06 1:06 UTC (permalink / raw)
To: Andrew STUBBS, GDB Patches, john.pye
> > New behaviour:
> >
> > (gdb) <C-d>quit
> > The program is running. Exit anyway? (y or n) <C-d>Y
> > bash$
>
> How'd you feel about "EOF [assumed %c]" or something like that? I'd
> look at that and think I typed the Y.
I really like Daniel's suggestion.
> > 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.
>
> OK for HEAD with or without that change, as you prefer. I'd recommend
> this for 6.6 now that it's in HEAD; Joel, is that OK?
Sure. I was a bit nervious about any unexpected side-effect of the change
in event-top.c (changing the call to quit_command() into a call to
execute_command ("quit")) But if you think it's low risk, then I don't
have any problem.
--
Joel
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] Ctrl-D
2006-12-05 20:50 ` Daniel Jacobowitz
2006-12-06 1:06 ` Joel Brobecker
@ 2006-12-06 16:54 ` Andrew STUBBS
1 sibling, 0 replies; 6+ messages in thread
From: Andrew STUBBS @ 2006-12-06 16:54 UTC (permalink / raw)
To: Andrew STUBBS, GDB Patches, john.pye
[-- Attachment #1: Type: text/plain, Size: 262 bytes --]
Daniel Jacobowitz wrote:
> OK for HEAD with or without that change, as you prefer. I'd recommend
> this for 6.6 now that it's in HEAD; Joel, is that OK?
Committed to both HEAD and gdb_6_6-branch with the suggested change.
The final patch is attached.
Andrew
[-- Attachment #2: ctrl-d.patch --]
[-- Type: text/plain, Size: 1304 bytes --]
2006-12-06 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-12-06 10:49:25.000000000 +0000
+++ src/gdb/event-top.c 2006-12-06 13:52: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-12-06 10:49:26.000000000 +0000
+++ src/gdb/utils.c 2006-12-06 13:54:01.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 ("EOF [assumed %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