From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 81568 invoked by alias); 18 Mar 2016 19:18:50 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 81352 invoked by uid 89); 18 Mar 2016 19:18:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=825, quit, sigint, SIGINT X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 18 Mar 2016 19:18:37 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id ACD51C000418 for ; Fri, 18 Mar 2016 19:18:35 +0000 (UTC) Received: from cascais.lan (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2IJIYjw028091 for ; Fri, 18 Mar 2016 15:18:35 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 00/30] Stop throwing exceptions from signal handlers Date: Fri, 18 Mar 2016 19:19:00 -0000 Message-Id: <1458328714-4938-1-git-send-email-palves@redhat.com> X-SW-Source: 2016-03/txt/msg00351.txt.bz2 Aka, get rid of immediate_quit. Throwing exceptions from signal handlers is undefined C++. So for C++ conversion we need to replace the immediate_quit mechanism by something else. This series: - Replaces all immediate_quit uses with something else. - Removes a few custom SIGINT handlers, centralizing more on the "quit" flag and GDB's default SIGINT handler. - Fixes several classical signal handler / mainline code races, using the self-pipe trick. - Introduces a "struct serial_event" abstraction to hide the self-pipe trick -- on Windows we don't use pipes at all, and on Linux, we could use eventfd (but I didn't do that, at least yet). - Stumbles on a few bogus clear_quit_flag uses, and thus completely eliminates it, for good measure. - Decouples target_interrupt from all-stop/non-stop modes - Fixes a few cases of indefinitely-delayed Ctrl-C handling. - Fixes/incorrect handling of EINTR in ser-*.c backends - Goes through the tree fixing all target_terminal_ours calls that should be target_terminal_ours_for_output instead. We only end up with a few target_terminal_ours calls, at places were we need to handle input. - Plugs a few leaks along the way. - Fixes a bug where you can't answer y/n to an internal error if the target has the terminal. - Introduces the concept of quit handlers. - Does a few clean ups along the way. Tested on x86-64 Fedora 23, native and gdbserver. A slightly older version manually test on mingw64/Windows 7, to make sure Ctrl-C still works as expected there. This applies on top of the "target mips" elimination patch: https://sourceware.org/ml/gdb-patches/2016-03/msg00313.html I've pushed the whole series to users/palves/immediate_quit. Pedro Alves (30): Don't rely on immediate_quit in command_line_input Inline command_loop in read_command_line TUI: check whether in secondary prompt instead of immediate_quit Don't set immediate_quit in prompt_for_continue Stop remote-fileio.c from throwing from SIGINT handler Remove unused struct serial::name field Introduce a serial interface for select'able events Fix signal handler/event-loop races Introduce interruptible_select Make Python use a struct serial event Don't call clear_quit_flag after check_quit_flag Don't call clear_quit_flag in command_handler Don't call clear_quit_flag in prepare_to_throw_exception Don't call clear_quit_flag in captured_main Eliminate clear_quit_flag Decouple target_interrupt from all-stop/non-stop modes Pass Ctrl-C to the target in target_terminal_inferior Fix inconsistent handling of EINTR in ser-*.c backends ada-lang.c: Introduce type_as_string and use it Use target_terminal_ours_for_output in cp-support.c Use target_terminal_ours_for_output in exceptions.c Use target_terminal_ours_for_output in infcmd.c Use target_terminal_ours_for_output in warning/internal_error Add missing cleanups to defaulted_query and prompt_for_continue Do target_terminal_ours in query & friends instead of in all callers Use target_terminal_ours_for_output in MI TUI: GC tui_target_has_run target remote: Don't rely on immediate_quit (introduce quit handlers) Eliminate immediate_quit Eliminate target_check_pending_interrupt gdb/Makefile.in | 6 +- gdb/ada-lang.c | 74 ++++++----- gdb/cp-support.c | 4 +- gdb/defs.h | 58 +++++++-- gdb/event-loop.c | 41 ++++-- gdb/event-loop.h | 26 +--- gdb/event-top.c | 165 ++++++++++++++++++++++--- gdb/exceptions.c | 17 ++- gdb/extension-priv.h | 5 +- gdb/extension.c | 34 +++-- gdb/gdb_select.h | 15 +++ gdb/gnu-nat.c | 12 +- gdb/guile/guile.c | 1 - gdb/guile/scm-ports.c | 4 +- gdb/i386-tdep.c | 49 ++------ gdb/infcmd.c | 10 +- gdb/linux-nat.c | 10 -- gdb/linux-record.c | 54 +++----- gdb/main.c | 1 - gdb/mi/mi-interp.c | 125 ++++++++++++++++--- gdb/mi/mi-main.c | 7 +- gdb/mingw-hdep.c | 52 +------- gdb/nto-procfs.c | 4 - gdb/posix-hdep.c | 13 -- gdb/python/python.c | 44 +++---- gdb/record-full.c | 22 ++-- gdb/remote-fileio.c | 34 +---- gdb/remote-sim.c | 5 +- gdb/remote.c | 329 +++++++++++++++++++++---------------------------- gdb/ser-base.c | 30 ++++- gdb/ser-event.c | 220 +++++++++++++++++++++++++++++++++ gdb/ser-event.h | 51 ++++++++ gdb/ser-go32.c | 4 + gdb/ser-unix.c | 108 ++-------------- gdb/serial.c | 66 ++++++---- gdb/serial.h | 8 +- gdb/target-delegates.c | 25 ++-- gdb/target.c | 17 ++- gdb/target.h | 19 +-- gdb/top.c | 67 +++++----- gdb/tui/tui-hooks.c | 24 ---- gdb/tui/tui-io.c | 2 +- gdb/tui/tui.c | 4 +- gdb/ui-file.c | 8 +- gdb/utils.c | 66 ++++++---- 45 files changed, 1115 insertions(+), 825 deletions(-) create mode 100644 gdb/ser-event.c create mode 100644 gdb/ser-event.h -- 2.5.0