From: Daniel Jacobowitz <drow@false.org>
To: gdb-patches@sourceware.org
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>,
Chet Ramey <chet.ramey@case.edu>
Subject: Re: [patch] Fix testsuite annotate-quit race (PR 544)
Date: Fri, 21 Mar 2008 21:45:00 -0000 [thread overview]
Message-ID: <20080321214448.GB29593@caradoc.them.org> (raw)
In-Reply-To: <20080321210323.GA30247@caradoc.them.org>
On Fri, Mar 21, 2008 at 05:03:24PM -0400, Daniel Jacobowitz wrote:
> We have a --with-system-readline option, which many distributors use
> instead of the internal readline. So I would rather fix it in GDB.
> I did it just the way you suggested.
>
> I'm running some stress tests with this patch. So far it hasn't
> failed once.
Checked in as so.
--
Daniel Jacobowitz
CodeSourcery
2008-03-21 Daniel Jacobowitz <dan@codesourcery.com>
PR gdb/544
Suggested by Jan Kratochvil:
* top.c (gdb_rl_operate_and_get_next_completion): Call
rl_redisplay_function.
(gdb_rl_redisplay): New.
(init_main): Set rl_redisplay_function.
2008-03-21 Daniel Jacobowitz <dan@codesourcery.com>
* gdb.cp/annota2.exp, gdb.cp/annota3.exp: Remove KFAIL for
fixed PR gdb/544.
Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.135
diff -u -p -r1.135 top.c
--- top.c 21 Mar 2008 14:39:22 -0000 1.135
+++ top.c 21 Mar 2008 21:01:37 -0000
@@ -921,7 +921,7 @@ gdb_rl_operate_and_get_next_completion (
operate_saved_history = -1;
/* readline doesn't automatically update the display for us. */
- rl_redisplay ();
+ rl_redisplay_function ();
after_char_processing_hook = NULL;
rl_pre_input_hook = NULL;
@@ -956,6 +956,29 @@ gdb_rl_operate_and_get_next (int count,
return rl_newline (1, key);
}
+
+/* Readline 5.2 and earlier do not block SIGINT while redrawing the prompt.
+ This can lead to corrupted internal state. As long as we do not require
+ a newer readline version, compensate for it. */
+static void
+gdb_rl_redisplay (void)
+{
+#if HAVE_SIGPROCMASK
+ sigset_t sigint_set, sigint_oset;
+
+ sigemptyset (&sigint_set);
+ sigemptyset (&sigint_oset);
+ sigaddset (&sigint_set, SIGINT);
+ sigprocmask (SIG_BLOCK, &sigint_set, &sigint_oset);
+#endif
+
+ rl_redisplay ();
+
+#if HAVE_SIGPROCMASK
+ sigprocmask (SIG_SETMASK, &sigint_oset, (sigset_t *)NULL);
+#endif
+}
+
\f
/* Read one line from the command input stream `instream'
into the local static buffer `linebuffer' (whose current length
@@ -1581,6 +1604,7 @@ init_main (void)
rl_completer_quote_characters = get_gdb_completer_quote_characters ();
rl_readline_name = "gdb";
rl_terminal_name = getenv ("TERM");
+ rl_redisplay_function = gdb_rl_redisplay;
/* The name for this defun comes from Bash, where it originated.
15 is Control-o, the same binding this function has in Bash. */
Index: testsuite/gdb.cp/annota2.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/annota2.exp,v
retrieving revision 1.10
diff -u -p -r1.10 annota2.exp
--- testsuite/gdb.cp/annota2.exp 28 Feb 2008 16:24:25 -0000 1.10
+++ testsuite/gdb.cp/annota2.exp 21 Mar 2008 21:43:11 -0000
@@ -205,13 +205,10 @@ gdb_expect {
# test:
# annotate-quit
#
-# This test sometimes fails, but not reproducibly. See gdb/544.
-#
send_gdb "\003"
gdb_expect {
-re "\r\n\032\032error-begin\r\nQuit\r\n\r\n\032\032quit\r\n$gdb_prompt$" \
{ pass "annotate-quit" }
- -re "$gdb_prompt$" { kfail "gdb/544" "annotate-quit" }
-re ".*$gdb_prompt$" { fail "annotate-quit" }
timeout { fail "annotate-quit (timeout)" }
}
Index: testsuite/gdb.cp/annota3.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/annota3.exp,v
retrieving revision 1.11
diff -u -p -r1.11 annota3.exp
--- testsuite/gdb.cp/annota3.exp 1 Jan 2008 22:53:19 -0000 1.11
+++ testsuite/gdb.cp/annota3.exp 21 Mar 2008 21:43:11 -0000
@@ -208,8 +208,6 @@ gdb_expect {
# test:
# annotate-quit
#
-# This test sometimes fails, but not reproducibly. See gdb/544.
-#
send_gdb "\003"
gdb_expect_list "annotate-quit" "$gdb_prompt$" {
"\r\n\032\032error-begin\r\n"
next prev parent reply other threads:[~2008-03-21 21:45 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-18 22:55 Jan Kratochvil
2008-03-18 23:18 ` Daniel Jacobowitz
2008-03-19 8:11 ` Jan Kratochvil
2008-03-19 8:46 ` Nick Roberts
2008-03-19 9:31 ` Jan Kratochvil
2008-03-19 9:56 ` Nick Roberts
2008-03-19 10:13 ` Jan Kratochvil
2008-03-21 20:45 ` Jan Kratochvil
2008-03-21 21:04 ` Daniel Jacobowitz
2008-03-21 21:45 ` Daniel Jacobowitz [this message]
2008-03-23 11:01 ` Nick Roberts
2008-03-23 16:30 ` Daniel Jacobowitz
2008-03-23 16:44 ` Jan Kratochvil
2008-03-23 17:30 ` Daniel Jacobowitz
2008-03-24 0:07 ` Nick Roberts
2008-03-24 2:58 ` Daniel Jacobowitz
2008-03-24 7:42 ` Jan Kratochvil
2008-03-24 12:00 ` Daniel Jacobowitz
2008-03-24 13:03 ` Jan Kratochvil
2008-03-24 13:27 ` Daniel Jacobowitz
2008-03-25 1:02 ` Chet Ramey
2008-03-25 2:53 ` Daniel Jacobowitz
2008-03-25 15:56 ` Chet Ramey
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=20080321214448.GB29593@caradoc.them.org \
--to=drow@false.org \
--cc=chet.ramey@case.edu \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
/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