Re: GDB crashing on gdb.python/py-linetable.exp

Phil Muldoon
2014-02-07T10:45:10Z

On 06/02/14 21:30, Jan Kratochvil wrote:
> Hi Phil,
>
> at least on CentOS-6.5 x86_64 with -lmcheck I get the following crash.
>
> I have seen the crash also once on Fedora Rawhide x86_64 but I do not have it
> reproducible there. But it suggests to me it does not have to be necessarily
> just CentOS-6 specific. I have not tried real RHEL.
>

I've tried most of the morning to reproduce this on Fedora 19, with
-lmcheck and after several thousand test runs I can't reproduce. Is
there access to a machine where I can reproduce this?

> $ gdb ../gdb ./core.*
> Program terminated with signal 11, Segmentation fault.
> #0 0x00007f4d77642b1f in PyEval_EvalFrameEx (f=<value optimized out>, throwflag=<value optimized out>)
> at Python/ceval.c:952
> 952 f->f_lasti = INSTR_OFFSET();
> (gdb) bt
> #0 in PyEval_EvalFrameEx (f=<value optimized out>, throwflag=<value optimized out>) at Python/ceval.c:952
> #1 in PyEval_EvalCodeEx (co=0x7f4d78731468, globals=<value optimized out>, locals=<value optimized out>, args=<value optimized out>, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3044
> #2 in PyEval_EvalCode (co=<value optimized out>, globals=<value optimized out>, locals=<value optimized out>) at Python/ceval.c:545
> #3 in run_mod (mod=<value optimized out>, filename=<value optimized out>, globals={'__builtins__': <module at remote 0x7f4d787d4868>, 'GdbRemoveReadlineFinder': <classobj at remote 0x7f4d78728590>, 'lt': <gdb.LineTable at remote 0x7f4d7871b138>, 'list_lines': <function at remote 0x7f4d78731578>, '__package__': None, 'sys': <module at remote 0x7f4d787d4c20>, 'gdb': <module at remote 0x7f4d787431a0>, '__name__': '__main__', '__doc__': None}, locals={'__builtins__': <module at remote 0x7f4d787d4868>, 'GdbRemoveReadlineFinder': <classobj at remote 0x7f4d78728590>, 'lt': <gdb.LineTable at remote 0x7f4d7871b138>, 'list_lines': <function at remote 0x7f4d78731578>, '__package__': None, 'sys': <module at remote 0x7f4d787d4c20>, 'gdb': <module at remote 0x7f4d787431a0>, '__name__': '__main__', '__doc__': None}, flags=<value optimized out>, arena=<value optimized out>) at Python/pythonrun.c:1358
> #4 in PyRun_StringFlags (str=0x3cbe3a7 "print len(lt.line(42))", start=257, globals={'__builtins__': <module at remote 0x7f4d787d4868>, 'GdbRemoveReadlineFinder': <classobj at remote 0x7f4d78728590>, 'lt': <gdb.LineTable at remote 0x7f4d7871b138>, 'list_lines': <function at remote 0x7f4d78731578>, '__package__': None, 'sys': <module at remote 0x7f4d787d4c20>, 'gdb': <module at remote 0x7f4d787431a0>, '__name__': '__main__', '__doc__': None}, locals={'__builtins__': <module at remote 0x7f4d787d4868>, 'GdbRemoveReadlineFinder': <classobj at remote 0x7f4d78728590>, 'lt': <gdb.LineTable at remote 0x7f4d7871b138>, 'list_lines': <function at remote 0x7f4d78731578>, '__package__': None, 'sys': <module at remote 0x7f4d787d4c20>, 'gdb': <module at remote 0x7f4d787431a0>, '__name__': '__main__', '__doc__': None}, flags=0x0) at Python/pythonrun.c:1321
> #5 in PyRun_SimpleStringFlags (command=0x3cbe3a7 "print len(lt.line(42))", flags=0x0) at Python/pythonrun.c:974

I suspect the linetable information in GDB is not what this test
expects it to be.

The method that causes this crash just uses:

pcs = find_pcs_for_symtab_line (symtab, py_line, &best_entry);

But as this is happening in the C evaluation part of the code in
Python I can't tell if this happened earlier and screwed up Python, or
if there is something wrong with the Python tuple holding the line
table data.

Cheers

Phil