bug-readline
[Top][All Lists]
Advanced

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

Re: [Bug-readline] SIGSEGV in _rl_dispatch_callback()


From: Anatol Pomozov
Subject: Re: [Bug-readline] SIGSEGV in _rl_dispatch_callback()
Date: Fri, 7 Mar 2014 15:46:46 -0800

Hi

On Thu, Mar 6, 2014 at 10:49 PM, Felix Yan <address@hidden> wrote:
> Hi,
>
> I've generated a coredump for this problem, with both python 2.7.6 (patched to
> compile with readline 6.3) and readline 6.3 enabled debug symbols.
>
> Link to download: https://paste.xinu.at/QM0Ws/
>
> I've also tried to debug it somewhat, but I'm not good at it. Just saw python
> called:
>
> p = readline_until_enter_or_signal(prompt, &signal);
>
> and the two args here are fine. Then readline called rl_callback_read_char()
> with no arg.

I did a bit of debugging here is some info. I rebuild readline with
debug symbols and it shows more correct stacktrace:

#0  _rl_dispatch_callback (cxt=0x0) at ../readline.c:728
        nkey = <optimized out>
        r = <optimized out>
#1  0x00007f9f69fa7ca0 in rl_callback_read_char () at ../callback.c:188
        line = <optimized out>
        eof = <optimized out>
        jcode = <optimized out>
        olevel = {{__jmpbuf = {140322656755864, -1667685789909389154,
0, 0, 1, 140322765665936, -1721820903567003490,
              -1667735277141757794}, __mask_was_saved = 0,
__saved_mask = {__val = {0 <repeats 16 times>}}}}
#2  0x00007f9f6a1c6acb in readline_until_enter_or_signal
(signal=<synthetic pointer>, prompt=<optimized out>)
    at /home/anatol/tmp/python/src/Python-3.3.4/Modules/readline.c:1027
        has_input = 1
        err = 0
        not_done_reading = 0x7f9f6a1c7b2e ""
        selectset = {fds_bits = {1, 0 <repeats 15 times>}}
#3  call_readline (sys_stdin=<optimized out>, sys_stdout=<optimized
out>, prompt=<optimized out>)
    at /home/anatol/tmp/python/src/Python-3.3.4/Modules/readline.c:1115
        n = <optimized out>
        p = <optimized out>
        signal = 0
        saved_locale = 0x2820b60 "C"
#4  0x00007f9f7038ae4f in PyOS_Readline (sys_stdin=0x7f9f701104e0
<_IO_2_1_stdin_>, sys_stdout=0x7f9f701102a0 <_IO_2_1_stdout_>,
    prompt=0x7f9f6bf00190 "\n\001\033[0;32m\002In
[\001\033[1;32m\002\061\001\033[0;32m\002]: \001\033[0m\002")
    at Parser/myreadline.c:214
        _save = 0x23631b0
        rv = <optimized out>
#5  0x00007f9f704346f6 in builtin_input (self=<optimized out>,
args=<optimized out>) at Python/bltinmodule.c:1734
        prompt = <optimized out>
        stdin_encoding = 0x7f9f7091ceb0
        stdin_errors = 0x7f9f6bdf5110
        stdin_encoding_str = 0x7f9f7091cee0 "ANSI_X3.4-1968"
        po = 0x7f9f6bf00170
        stdout_errors = 0x0
        PyId_encoding = {next = 0x7f9f707476e0 <PyId_fileno>, string =
0x7f9f704bcc98 "encoding", object = 0x7f9f709776f0}
        PyId_errors = {next = 0x7f9f70746f60 <PyId_encoding.12483>,
string = 0x7f9f704d6d09 "errors", object = 0x7f9f70952500}
        s = 0x0
        stdout_encoding = 0x0
        stdin_errors_str = <optimized out>
        result = <optimized out>
        len = <optimized out>
        promptarg = 0x7f9f6be51db0
        fin = <optimized out>
        fout = <optimized out>
        ferr = <optimized out>
        tmp = <optimized out>
        fd = <optimized out>
        tty = 1
#6  0x00007f9f7043f94c in call_function (oparg=<optimized out>,
pp_stack=0x7fff86b7e8b0) at Python/ceval.c:4069
        flags = <optimized out>
        tstate = 0x23631b0
        func = <optimized out>
        w = <optimized out>
        na = <optimized out>
        nk = <optimized out>
        n = <optimized out>
        pfunc = 0x281af88
        x = <optimized out>


So it is the exact place where python calls the readline function
http://hg.python.org/cpython/file/7ff62415e426/Modules/readline.c#l1115
 (the file in url points to 3.3.4 tag - it is where we see the crash).


Here is output of rl_readline_state and _rl_kscxt variables.


<PRESS UP>

(gdb) p *_rl_kscxt
$10 = {flags = 0, subseq_arg = 0, subseq_retval = 0, dmap =
0x7fb38926ad20 <emacs_meta_keymap>,
  oldmap = 0x7fb38926bd40 <emacs_standard_keymap>, okey = 27, ocxt =
0x0, childval = 42}
p /x rl_readline_state
$9 = 0x2c0006

<GDB CONTINUE>

p *_rl_kscxt
$14 = {flags = 0, subseq_arg = 0, subseq_retval = 0, dmap = 0x1e5f9d0,
oldmap = 0x7fb38926ad20 <emacs_meta_keymap>, okey = 91,
  ocxt = 0x1e1e900, childval = -3}
(gdb) p /x rl_readline_state
$15 = 0x2c0006

<PRESS DOWN>

p *_rl_kscxt
$16 = {flags = 1, subseq_arg = 0, subseq_retval = 0, dmap =
0x7fb38926ad20 <emacs_meta_keymap>,
  oldmap = 0x7fb38926bd40 <emacs_standard_keymap>, okey = 27, ocxt =
0x0, childval = 1}
(gdb) p /x rl_readline_state
$17 = 0x2c0006

<GDB CONTINUE>

(gdb) p _rl_kscxt
$18 = (_rl_keyseq_cxt *) 0x0

<CRASH>



reply via email to

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