From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Chet Ramey <chet.ramey@case.edu>
Cc: "H. J. Lu" <hjl@lucon.org>, GDB <gdb-patches@sources.redhat.com>,
bug-readline@gnu.org
Subject: Re: PATCH: PR tui/2173: Arrow keys no longer works in breakpoint command list
Date: Sun, 17 Dec 2006 23:46:00 -0000 [thread overview]
Message-ID: <20061217234530.GA20773@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <45725FC9.9070304@case.edu>
On Sun, 03 Dec 2006 06:25:29 +0100, Chet Ramey wrote:
...
> More appropriate in the sense that the application controls the state
> and switches between the callback and synchronous readline modes.
> Since it's the app that's supposed to be calling into readline when in
> callback mode anyway, I think this patch will work better.
Chet, is it right it is more a design than implementation problem of readline?
readline cannot determine how many nested readline calls have been abandoned by
signal handler's longjmp (). Therefore it cannot determine if the current mode
(the last unabandoned call) is a callback or synchronous one.
The sample code should be readline documentation compliant, still the called
function `_rl_next_macro_key' has undeterministic value of
`RL_ISSTATE (RL_STATE_CALLBACK)'.
Also any longjmp () from inside a signal handler is too dangerous as the data
structures are not locked against signals. The signal handler should only set
some flag. And the synchronous readline () function should be never used if
one needs to quit the input mode by SIGINT (as one cannot abort readline () if
not using the dangerous longjmp ()).
IMO the right way is to stop using longjmp from GDB's signal handlers.
Therefore to always use callbacked readline and stop the loop if detected
a flag set by the installed signal handler.
Thanks for info,
Jan
------------------------------------------------------------------------------
main ()
{
if (setjmp (buf_A))
{
rl_read_key (); /* -> _rl_next_macro_key () */
}
signal (SIGINT, handle_SIGINT_at_A);
readline("mode-A");
...
}
handle_SIGINT_at_A ()
{
if (setjmp (buf_B))
{
rl_read_key (); /* -> _rl_next_macro_key () */
}
signal (SIGINT, handle_SIGINT_at_B);
rl_callback_handler_install ("mode-B", mode_B_command);
for (;;)
rl_callback_read_char ();
}
handle_SIGINT_at_B ()
{
if (rand () & 1)
longjmp (buf_A);
else
longjmp (buf_B);
}
next prev parent reply other threads:[~2006-12-17 23:46 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-21 21:32 H. J. Lu
2006-11-28 16:53 ` Daniel Jacobowitz
2006-11-28 17:09 ` H. J. Lu
2006-11-28 17:15 ` Daniel Jacobowitz
2006-12-02 18:44 ` H. J. Lu
2006-12-02 18:55 ` Daniel Jacobowitz
2006-12-02 18:59 ` Joel Brobecker
2006-12-02 19:17 ` Chet Ramey
2006-12-02 19:09 ` Chet Ramey
2006-12-02 22:15 ` H. J. Lu
2006-12-02 23:06 ` Daniel Jacobowitz
2006-12-03 5:25 ` Chet Ramey
2006-12-17 23:46 ` Jan Kratochvil [this message]
2006-12-18 20:09 ` Chet Ramey
2006-12-19 23:20 ` Jan Kratochvil
2006-12-26 6:00 ` Jan Kratochvil
2007-01-03 21:46 ` Daniel Jacobowitz
2007-01-03 21:47 ` Daniel Jacobowitz
[not found] <18019.18081.448928.93993@kahikatea.snap.net.nz>
[not found] ` <20070604010633.GA927@caradoc.them.org>
2007-06-05 12:56 ` Nick Roberts
2007-06-05 13:27 ` Daniel Jacobowitz
2007-06-24 15:46 ` Daniel Jacobowitz
2007-06-24 21:55 ` Nick Roberts
2007-07-01 22:38 ` Daniel Jacobowitz
2007-07-03 1:28 ` Nick Roberts
2007-07-03 3:03 ` Daniel Jacobowitz
2007-07-03 15:39 ` Daniel Jacobowitz
2007-06-26 13:49 ` Jan Kratochvil
2007-06-26 14:33 ` Daniel Jacobowitz
2008-03-21 20:34 ` Jan Kratochvil
2008-03-21 21:22 ` Daniel Jacobowitz
2008-03-21 21:26 ` Jan Kratochvil
2008-03-21 21:41 ` Daniel Jacobowitz
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=20061217234530.GA20773@host0.dyn.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=bug-readline@gnu.org \
--cc=chet.ramey@case.edu \
--cc=gdb-patches@sources.redhat.com \
--cc=hjl@lucon.org \
/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