bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pending signal after rl_callback_read_char


From: Chet Ramey
Subject: Re: pending signal after rl_callback_read_char
Date: Fri, 30 Sep 2022 10:55:43 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.0

On 9/21/22 10:53 AM, Simon Marchi wrote:

So, I'm not entirely sure how things work when you are sitting at the
GDB prompt and press ^C.  Does readline get involved at all in that
case?

If readline is in the middle of a call to rl_callback_read_char, then yes.
If not, then no.

Ok...  I thought GDB would need to tell readline to flush the current
line somehow.  When the user has typed some text and not pressed enter
yet, the current line is saved in readline, right?

If you want to make sure the right thing happens to abort the current line,
gdb can call rl_cleanup_after_signal if it gets SIGINT while readline's
signal handlers aren't installed. Otherwise it gets cleaned up on the next
call to rl_callback_handler_install. I assume gdb does something like this now.


What are readline signals useful for?

Readline changes the terminal settings and other user state, and allocates
per-call memory and other resources, and has to catch signals so it can
clean that up.

I see we can also disable
readline's signal handling (set rl_catch_signals to 0), I'm wondering if
that would work for us.

Sure, if you want to do all that work for yourself.

Difficult to say without knowing what "that work" consists of exactly
(haven't had time to dig in that).

You can look at what _rl_handle_signal does and the functions it calls.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]