public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug remote/15297] New: CTRl-C with set debug remote often crashes GDB
@ 2013-03-22 18:08 jan.kratochvil at redhat dot com
  2013-03-25 16:10 ` [Bug remote/15297] " tromey at redhat dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: jan.kratochvil at redhat dot com @ 2013-03-22 18:08 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15297

             Bug #: 15297
           Summary: CTRl-C with set debug remote often crashes GDB
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: remote
        AssignedTo: unassigned@sourceware.org
        ReportedBy: jan.kratochvil@redhat.com
    Classification: Unclassified
              Host: x86_64-unknown-linux-gnu


async_remote_interrupt and async_remote_interrupt_twice are not signal-safe,
they call functions including stdio.

"set debug remote 1" makes the crash easily reproducible but the code is unsafe
even without it.

#0  __lll_lock_wait_private at
../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95
#1  in _L_lock_12203 at malloc.c:5144
#2  in __GI___libc_malloc at malloc.c:2860
#3  in _IO_vasprintf at vasprintf.c:50
#4  in xstrvprintf at ./common/common-utils.c:130
#5  in vfprintf_unfiltered at utils.c:2341
#6  in fprintf_unfiltered at utils.c:2394
#7  in async_remote_interrupt at remote.c:4942
#8  in call_async_signal_handler at event-loop.c:957
#9  in gdb_call_async_signal_handler at posix-hdep.c:64
#10 in remote_interrupt at remote.c:4981
#11 <signal handler called>
#12 in _int_malloc at malloc.c:3721
#13 in __GI___libc_malloc at malloc.c:2863
#14 in mallochook at mcheck.c:223
#15 in _IO_vasprintf at vasprintf.c:50
#16 in xstrvprintf at ./common/common-utils.c:130
#17 in vfprintf_unfiltered at utils.c:2341
#18 in fprintf_unfiltered at utils.c:2394
#19 in printchar at utils.c:1625
#20 in fputstrn_unfiltered at utils.c:1665 
#21 in escape_buffer at remote.c:7099
#22 in getpkt_or_notif_sane_1 at remote.c:7620
#23 in getpkt_or_notif_sane at remote.c:7675
#24 in remote_wait_as at remote.c:5880
#25 in remote_wait at remote.c:5997
#26 in target_wait at target.c:2646
#27 in wait_for_inferior at infrun.c:2732
#28 in proceed at infrun.c:2324
#29 in step_once at infcmd.c:1092
#30 in step_1 at infcmd.c:927
#31 in step_command at infcmd.c:847
#32 in do_cfunc at ./cli/cli-decode.c:113
#33 in cmd_func at ./cli/cli-decode.c:1857
#34 in execute_command at top.c:486

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug remote/15297] CTRl-C with set debug remote often crashes GDB
  2013-03-22 18:08 [Bug remote/15297] New: CTRl-C with set debug remote often crashes GDB jan.kratochvil at redhat dot com
@ 2013-03-25 16:10 ` tromey at redhat dot com
  2013-03-27 16:36 ` [Bug remote/15297] CTRL-C " jan.kratochvil at redhat dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tromey at redhat dot com @ 2013-03-25 16:10 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15297

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at redhat dot com

--- Comment #1 from Tom Tromey <tromey at redhat dot com> 2013-03-25 16:10:18 UTC ---
See also PR 14408.
SIGINT handling in remote.c needs an overhaul.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug remote/15297] CTRL-C with set debug remote often crashes GDB
  2013-03-22 18:08 [Bug remote/15297] New: CTRl-C with set debug remote often crashes GDB jan.kratochvil at redhat dot com
  2013-03-25 16:10 ` [Bug remote/15297] " tromey at redhat dot com
@ 2013-03-27 16:36 ` jan.kratochvil at redhat dot com
  2013-04-12  8:35 ` jan.kratochvil at redhat dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jan.kratochvil at redhat dot com @ 2013-03-27 16:36 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15297

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jan.kratochvil at redhat
                   |                            |dot com
            Summary|CTRl-C with set debug       |CTRL-C with set debug
                   |remote often crashes GDB    |remote often crashes GDB

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug remote/15297] CTRL-C with set debug remote often crashes GDB
  2013-03-22 18:08 [Bug remote/15297] New: CTRl-C with set debug remote often crashes GDB jan.kratochvil at redhat dot com
  2013-03-25 16:10 ` [Bug remote/15297] " tromey at redhat dot com
  2013-03-27 16:36 ` [Bug remote/15297] CTRL-C " jan.kratochvil at redhat dot com
@ 2013-04-12  8:35 ` jan.kratochvil at redhat dot com
  2013-04-12  8:36 ` jan.kratochvil at redhat dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jan.kratochvil at redhat dot com @ 2013-04-12  8:35 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15297

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |15358

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug remote/15297] CTRL-C with set debug remote often crashes GDB
  2013-03-22 18:08 [Bug remote/15297] New: CTRl-C with set debug remote often crashes GDB jan.kratochvil at redhat dot com
                   ` (2 preceding siblings ...)
  2013-04-12  8:35 ` jan.kratochvil at redhat dot com
@ 2013-04-12  8:36 ` jan.kratochvil at redhat dot com
  2013-06-25  7:31 ` jan.kratochvil at redhat dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jan.kratochvil at redhat dot com @ 2013-04-12  8:36 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15297

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |14408

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug remote/15297] CTRL-C with set debug remote often crashes GDB
  2013-03-22 18:08 [Bug remote/15297] New: CTRl-C with set debug remote often crashes GDB jan.kratochvil at redhat dot com
                   ` (3 preceding siblings ...)
  2013-04-12  8:36 ` jan.kratochvil at redhat dot com
@ 2013-06-25  7:31 ` jan.kratochvil at redhat dot com
  2013-06-25 11:45 ` jan.kratochvil at redhat dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jan.kratochvil at redhat dot com @ 2013-06-25  7:31 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15297

--- Comment #2 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
Check also currently FAILing: gdb.base/random-signal.exp

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug remote/15297] CTRL-C with set debug remote often crashes GDB
  2013-03-22 18:08 [Bug remote/15297] New: CTRl-C with set debug remote often crashes GDB jan.kratochvil at redhat dot com
                   ` (4 preceding siblings ...)
  2013-06-25  7:31 ` jan.kratochvil at redhat dot com
@ 2013-06-25 11:45 ` jan.kratochvil at redhat dot com
  2013-07-01 20:37 ` jan.kratochvil at redhat dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jan.kratochvil at redhat dot com @ 2013-06-25 11:45 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15297

--- Comment #4 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
http://sourceware.org/gdb/wiki/TestingGDB#Testing_gdbserver_in_a_native_configuration
DEJAGNU=$HOME/src/runtest-gdbserver/site.exp runtest --target_board
native-gdbserver gdb.base/random-signal.exp

But that is correct, making remote.c+gdbserver correctly breakable is what the
pending patches of mine + Pedro are about.
  http://sourceware.org/ml/gdb-patches/2013-06/msg00363.html
  http://sourceware.org/ml/gdb-patches/2013-05/msg00933.html

Just so far there was no testcase affected by this remote.c+gdbserver bug.
You have implemented first testcase affected by it.

FYI I get randomly the following three cases:

-----------------------------------------------------------------
continue^M
Continuing.^M
PASS: gdb.base/random-signal.exp: continue
^C^M
Program received signal SIGINT, Interrupt.^M
main () at ./gdb.base/random-signal.c:28^M
28          ;^M
(gdb) PASS: gdb.base/random-signal.exp: stop with control-c
-----------------------------------------------------------------
continue^M
Continuing.^M
PASS: gdb.base/random-signal.exp: continue
^Cmain () at ./gdb.base/random-signal.c:28^M
28          ;^M
Quit^M
(gdb) FAIL: gdb.base/random-signal.exp: stop with control-c
-----------------------------------------------------------------
continue^M
Continuing.^M
PASS: gdb.base/random-signal.exp: continue
^CFAIL: gdb.base/random-signal.exp: stop with control-c (timeout)
-----------------------------------------------------------------

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug remote/15297] CTRL-C with set debug remote often crashes GDB
  2013-03-22 18:08 [Bug remote/15297] New: CTRl-C with set debug remote often crashes GDB jan.kratochvil at redhat dot com
                   ` (5 preceding siblings ...)
  2013-06-25 11:45 ` jan.kratochvil at redhat dot com
@ 2013-07-01 20:37 ` jan.kratochvil at redhat dot com
  2013-07-03  5:31 ` jan.kratochvil at redhat dot com
  2023-02-15 21:34 ` pedro at palves dot net
  8 siblings, 0 replies; 10+ messages in thread
From: jan.kratochvil at redhat dot com @ 2013-07-01 20:37 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15297

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at sourceware dot org   |jan.kratochvil at redhat dot com

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug remote/15297] CTRL-C with set debug remote often crashes GDB
  2013-03-22 18:08 [Bug remote/15297] New: CTRl-C with set debug remote often crashes GDB jan.kratochvil at redhat dot com
                   ` (6 preceding siblings ...)
  2013-07-01 20:37 ` jan.kratochvil at redhat dot com
@ 2013-07-03  5:31 ` jan.kratochvil at redhat dot com
  2023-02-15 21:34 ` pedro at palves dot net
  8 siblings, 0 replies; 10+ messages in thread
From: jan.kratochvil at redhat dot com @ 2013-07-03  5:31 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15297

--- Comment #5 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
[patchv2 2/2] Fix CTRL-C for remote.c (PR remote/15297)
http://sourceware.org/ml/gdb-patches/2013-06/msg00943.html

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug remote/15297] CTRL-C with set debug remote often crashes GDB
  2013-03-22 18:08 [Bug remote/15297] New: CTRl-C with set debug remote often crashes GDB jan.kratochvil at redhat dot com
                   ` (7 preceding siblings ...)
  2013-07-03  5:31 ` jan.kratochvil at redhat dot com
@ 2023-02-15 21:34 ` pedro at palves dot net
  8 siblings, 0 replies; 10+ messages in thread
From: pedro at palves dot net @ 2023-02-15 21:34 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=15297

Pedro Alves <pedro at palves dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.1
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Pedro Alves <pedro at palves dot net> ---
> However, running Jan's test, on current master reveals we still have problems 
> with a Ctrl-c coming in while Python code is running:
> ...
>
> That "^CPython Exception <class 'KeyboardInterrupt'> <class 
> 'KeyboardInterrupt'>: " is probably from the Python frame unwinder machinery.
> At that point the target has the terminal, and since 
> 2f99e8fc9cb84ca80cfca6c119f1f22bbfd2a314 this should not have happened (Change 
> SIGINT handler for extension languages only when target terminal is ours), but 
> something's still not right over there.  I suspect that it's because now 
> remote.c uses the standard SIGINT handler, which calls set_quit_flag, which 
> calls active_ext_lang->ops->set_quit_flag.

So I think this issue is finally fixed by this series:

https://inbox.sourceware.org/gdb-patches/20230210233604.2228450-1-pedro@palves.net/T/#m79098ae4ed85a49c9693a47a0ad7a139f63d47dd

There's a separate PR about Ctrl-C and Python unwinder during execution:

  https://sourceware.org/bugzilla/show_bug.cgi?id=26266

which is really the same thing, and I'm leaving that open, hoping for a
testcase.  So we can close this one.

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-02-15 21:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-22 18:08 [Bug remote/15297] New: CTRl-C with set debug remote often crashes GDB jan.kratochvil at redhat dot com
2013-03-25 16:10 ` [Bug remote/15297] " tromey at redhat dot com
2013-03-27 16:36 ` [Bug remote/15297] CTRL-C " jan.kratochvil at redhat dot com
2013-04-12  8:35 ` jan.kratochvil at redhat dot com
2013-04-12  8:36 ` jan.kratochvil at redhat dot com
2013-06-25  7:31 ` jan.kratochvil at redhat dot com
2013-06-25 11:45 ` jan.kratochvil at redhat dot com
2013-07-01 20:37 ` jan.kratochvil at redhat dot com
2013-07-03  5:31 ` jan.kratochvil at redhat dot com
2023-02-15 21:34 ` pedro at palves dot net

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).