[Bug python/24796] New: GDB crashes when a lot of output is printed in post_event

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug python/24796] New: GDB crashes when a lot of output is printed in post_event

Martin.Jansa at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24796

            Bug ID: 24796
           Summary: GDB crashes when a lot of output is printed in
                    post_event
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: cbiesinger at google dot com
  Target Milestone: ---

Create a python module with this content:
```
import gdb

def Event():
  for x in range(0, 100):
    print("Line")

gdb.post_event(Event)
```

Import it in GDB. When the pager asks you to continue, press "c" and enter,
then press enter again.

Result:
readline: readline_callback_read_char() called with no handler!
Aborted

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug python/24796] GDB crashes when a lot of output is printed in post_event

Martin.Jansa at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24796

--- Comment #1 from Christian Biesinger <cbiesinger at google dot com> ---
The readline callback handler got removed here:

#0  gdb_rl_callback_handler_remove () at ../../gdb/event-top.c:301
#1  0x00005568afc0679d in gdb_readline_wrapper_line (line=...)
    at ../../gdb/top.c:977
#2  0x00005568af946435 in gdb_rl_callback_handler (rl=0x5568b2542310 "c")
    at ../../gdb/event-top.c:217
#3  0x00007f1263958d9e in rl_callback_read_char () at ./callback.c:283
#4  0x00005568af9462a4 in gdb_rl_callback_read_char_wrapper_noexcept ()
    at ../../gdb/event-top.c:175
#5  0x00005568af94632b in gdb_rl_callback_read_char_wrapper (
    client_data=0x5568b1e219b0) at ../../gdb/event-top.c:192
#6  0x00005568af946b57 in stdin_event_handler (error=0,
    client_data=0x5568b1e219b0) at ../../gdb/event-top.c:520
#7  0x00005568af944ae1 in handle_file_event (file_ptr=0x5568b2560c10,
    ready_mask=1) at ../../gdb/event-loop.c:731
#8  0x00005568af94509b in gdb_wait_for_event (block=1)
    at ../../gdb/event-loop.c:857
#9  0x00005568af943ed3 in gdb_do_one_event () at ../../gdb/event-loop.c:346
#10 0x00005568afc0684e in gdb_readline_wrapper (
    prompt=0x7ffecb003850 "--Type <RET> for more, q to quit, c to continue
without paging--") at ../../gdb/top.c:1059
#11 0x00005568afc68a4e in prompt_for_continue () at ../../gdb/utils.c:1500
#12 0x00005568afc690be in fputs_maybe_filtered (
    linebuffer=0x7ffecb003a00 "Line", stream=0x5568b25760c0, filter=1)
    at ../../gdb/utils.c:1737
#13 0x00005568afc69a2d in vfprintf_maybe_filtered(ui_file *, const char *,
typedef __va_list_tag __va_list_tag *, int) (stream=0x5568b25760c0,
    format=0x5568aff13d20 "%s", args=0x7ffecb003a78, filter=1)
    at ../../gdb/utils.c:2047
#14 0x00005568afc69a89 in vfprintf_filtered (stream=0x5568b25760c0,
    format=0x5568aff13d20 "%s", args=0x7ffecb003a78) at ../../gdb/utils.c:2054
#15 0x00005568afc69dae in fprintf_filtered (stream=0x5568b25760c0,
    format=0x5568aff13d20 "%s") at ../../gdb/utils.c:2102
#16 0x00005568afb0de31 in gdbpy_write (self=0x0, args=0x7f1256cd6c90,
    kw=0x7f1256c88168) at ../../gdb/python/python.c:1150
#17 0x00007f126277bdc3 in PyEval_EvalFrameEx ()
   from /lib/x86_64-linux-gnu/libpython2.7.so.1.0
#18 0x00007f12628b9dd8 in PyEval_EvalCodeEx ()
   from /lib/x86_64-linux-gnu/libpython2.7.so.1.0
#19 0x00007f1262854ae9 in ?? () from /lib/x86_64-linux-gnu/libpython2.7.so.1.0
#20 0x00007f126284ede3 in PyObject_Call ()
   from /lib/x86_64-linux-gnu/libpython2.7.so.1.0
#21 0x00007f126287c39c in ?? () from /lib/x86_64-linux-gnu/libpython2.7.so.1.0
#22 0x00007f126284ede3 in PyObject_Call ()
   from /lib/x86_64-linux-gnu/libpython2.7.so.1.0
#23 0x00007f12628b9307 in PyEval_CallObjectWithKeywords ()
   from /lib/x86_64-linux-gnu/libpython2.7.so.1.0
#24 0x00007f126285b8ae in PyFile_WriteObject ()
   from /lib/x86_64-linux-gnu/libpython2.7.so.1.0
#25 0x00007f126277b483 in PyEval_EvalFrameEx ()
   from /lib/x86_64-linux-gnu/libpython2.7.so.1.0
#26 0x00007f12628b9dd8 in PyEval_EvalCodeEx ()
   from /lib/x86_64-linux-gnu/libpython2.7.so.1.0
#27 0x00007f1262854ae9 in ?? () from /lib/x86_64-linux-gnu/libpython2.7.so.1.0
#28 0x00007f126284ede3 in PyObject_Call ()
   from /lib/x86_64-linux-gnu/libpython2.7.so.1.0
#29 0x00007f12628b9307 in PyEval_CallObjectWithKeywords ()
   from /lib/x86_64-linux-gnu/libpython2.7.so.1.0
#30 0x00005568afb0d79c in gdbpy_run_events (error=0, client_data=0x0)
    at ../../gdb/python/python.c:979
#31 0x00005568af944ae1 in handle_file_event (file_ptr=0x5568b1f020d0,
    ready_mask=1) at ../../gdb/event-loop.c:731
#32 0x00005568af94509b in gdb_wait_for_event (block=0)
    at ../../gdb/event-loop.c:857
#33 0x00005568af943e5b in gdb_do_one_event () at ../../gdb/event-loop.c:321
#34 0x00005568af943efd in start_event_loop () at ../../gdb/event-loop.c:370
#35 0x00005568afa4e71a in captured_command_loop () at ../../gdb/main.c:331
#36 0x00005568afa4fbdb in captured_main (data=0x7ffecb0045f0)
    at ../../gdb/main.c:1171
#37 0x00005568afa4fc41 in gdb_main (args=0x7ffecb0045f0)

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug python/24796] GDB crashes when a lot of output is printed in post_event

Martin.Jansa at gmail dot com
In reply to this post by Martin.Jansa at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24796

--- Comment #2 from Christian Biesinger <cbiesinger at google dot com> ---
Stack trace for the abort:

(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007f1260bcd8ad in __GI_abort () at abort.c:79
#2  0x00007f1263958c73 in rl_callback_read_char () at ./callback.c:138
#3  0x00005568af9462a4 in gdb_rl_callback_read_char_wrapper_noexcept ()
    at ../../gdb/event-top.c:175
#4  0x00005568af94632b in gdb_rl_callback_read_char_wrapper (
    client_data=0x5568b1e219b0) at ../../gdb/event-top.c:192
#5  0x00005568af946b57 in stdin_event_handler (error=0,
    client_data=0x5568b1e219b0) at ../../gdb/event-top.c:520
#6  0x00005568af944ae1 in handle_file_event (file_ptr=0x5568b2560c10,
    ready_mask=1) at ../../gdb/event-loop.c:731
#7  0x00005568af94509b in gdb_wait_for_event (block=1)
    at ../../gdb/event-loop.c:857
#8  0x00005568af943ed3 in gdb_do_one_event () at ../../gdb/event-loop.c:346
#9  0x00005568af943efd in start_event_loop () at ../../gdb/event-loop.c:370
#10 0x00005568afa4e71a in captured_command_loop () at ../../gdb/main.c:331
#11 0x00005568afa4fbdb in captured_main (data=0x7ffecb0045f0)
    at ../../gdb/main.c:1171
#12 0x00005568afa4fc41 in gdb_main (args=0x7ffecb0045f0)
    at ../../gdb/main.c:1186
#13 0x00005568af721394 in main (argc=1, argv=0x7ffecb0046f8)
    at ../../gdb/gdb.c:32
(gdb)

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug python/24796] GDB crashes when a lot of output is printed in post_event

Martin.Jansa at gmail dot com
In reply to this post by Martin.Jansa at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24796

--- Comment #3 from Christian Biesinger <cbiesinger at google dot com> ---
So I think the issue is that gdb_readline_wrapper is on the stack here twice?

--
You are receiving this mail because:
You are on the CC list for the bug.