1 GDB PR 544: gdb.cp/annota2.exp and gdb.cp/annota3.exp sometimes FAIL with:
2 FAIL: gdb.cp/annota3.exp: annotate-quit (pattern 1)
4 One can put `sleep (1)' at the end of _RL_OUTPUT_SOME_CHARS and type
6 to abort the prompt printing. Before the patch:
12 [bash]jkratoch@host0.dyn.jankratochvil.net:/home/jkratoch/redhat/sources/readline# ../gdb/gdb -nx -silent(gdb) p 1
17 The readline patch posted upstream:
18 http://sourceware.org/ml/gdb-patches/2008-03/msg00317.html
20 On Fri, 21 Mar 2008 19:37:31 +0100, Chet Ramey wrote:
21 > I will add something like your block_sigint/release_sigint changes around
22 > the guts of rl_redisplay. That's the right thing to do anyway. It will
23 > probably not come out as a patch for readline-5.2; you can use your
24 > current patch (though the names will change to _rl_block_sigint and
25 > _rl_release_sigint -- fair warning).
27 Application cannot easily supply its own RL_REDISPLAY_FUNCTION as a custom
28 function there changes the readline behavior:
29 http://sourceware.org/ml/gdb-patches/2008-03/msg00340.html
31 BLOCK_SIGINT / RELEASE_SIGINT: Make it public and prefix it by `_rl_'.
32 RL_REDISPLAY: Wrap it by _RL_BLOCK_SIGINT / _RL_RELEASE_SIGINT.
34 --- readline-5.2-orig/display.c 2008-03-23 20:52:12.000000000 +0100
35 +++ readline-5.2/display.c 2008-03-23 20:56:58.000000000 +0100
36 @@ -472,6 +472,10 @@ rl_redisplay ()
37 if (!readline_echoing_p)
40 + /* Signals are blocked through this function as the global data structures
41 + could get corrupted upon modifications from an invoked signal handler. */
42 + _rl_block_sigint ();
44 if (!rl_display_prompt)
45 rl_display_prompt = "";
47 @@ -1180,6 +1184,8 @@ rl_redisplay ()
49 visible_wrap_offset = wrap_offset;
52 + _rl_release_sigint ();
55 /* PWP: update_line() is based on finding the middle difference of each
56 --- readline-5.2-orig/rltty.c 2005-12-26 23:21:50.000000000 +0100
57 +++ readline-5.2/rltty.c 2008-03-23 20:57:26.000000000 +0100
58 @@ -52,8 +52,8 @@ extern int errno;
59 rl_vintfunc_t *rl_prep_term_function = rl_prep_terminal;
60 rl_voidfunc_t *rl_deprep_term_function = rl_deprep_terminal;
62 -static void block_sigint PARAMS((void));
63 -static void release_sigint PARAMS((void));
64 +void _rl_block_sigint PARAMS((void));
65 +void _rl_release_sigint PARAMS((void));
67 static void set_winsize PARAMS((int));
69 @@ -74,9 +74,9 @@ static int sigint_oldmask;
70 static int sigint_blocked;
72 /* Cause SIGINT to not be delivered until the corresponding call to
73 - release_sigint(). */
76 + _rl_release_sigint(). */
82 @@ -100,8 +100,8 @@ block_sigint ()
85 /* Allow SIGINT to be delivered. */
89 +_rl_release_sigint ()
91 if (sigint_blocked == 0)
93 @@ -663,7 +663,7 @@ rl_prep_terminal (meta_flag)
96 /* Try to keep this function from being INTerrupted. */
98 + _rl_block_sigint ();
100 tty = fileno (rl_instream);
102 @@ -676,7 +676,7 @@ rl_prep_terminal (meta_flag)
105 readline_echoing_p = 1; /* XXX */
107 + _rl_release_sigint ();
111 @@ -711,7 +711,7 @@ rl_prep_terminal (meta_flag)
113 if (set_tty_settings (tty, &tio) < 0)
116 + _rl_release_sigint ();
120 @@ -722,7 +722,7 @@ rl_prep_terminal (meta_flag)
121 terminal_prepped = 1;
122 RL_SETSTATE(RL_STATE_TERMPREPPED);
125 + _rl_release_sigint ();
128 /* Restore the terminal's normal settings and modes. */
129 @@ -735,7 +735,7 @@ rl_deprep_terminal ()
132 /* Try to keep this function from being interrupted. */
134 + _rl_block_sigint ();
136 tty = fileno (rl_instream);
138 @@ -746,14 +746,14 @@ rl_deprep_terminal ()
140 if (set_tty_settings (tty, &otio) < 0)
143 + _rl_release_sigint ();
147 terminal_prepped = 0;
148 RL_UNSETSTATE(RL_STATE_TERMPREPPED);
151 + _rl_release_sigint ();
153 #endif /* !NO_TTY_DRIVER */
155 --- readline-5.2-orig/rltty.h 2003-02-01 04:43:11.000000000 +0100
156 +++ readline-5.2/rltty.h 2008-03-23 20:57:30.000000000 +0100
157 @@ -79,4 +79,7 @@ typedef struct _rl_tty_chars {
158 unsigned char t_status;
161 +extern void _rl_block_sigint PARAMS((void));
162 +extern void _rl_release_sigint PARAMS((void));
164 #endif /* _RLTTY_H_ */