From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60862 invoked by alias); 21 Mar 2016 19:52:20 -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 60852 invoked by uid 89); 21 Mar 2016 19:52:19 -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,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: usplmg20.ericsson.net Received: from usplmg20.ericsson.net (HELO usplmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 21 Mar 2016 19:52:17 +0000 Received: from EUSAAHC004.ericsson.se (Unknown_Domain [147.117.188.84]) by usplmg20.ericsson.net (Symantec Mail Security) with SMTP id E5.92.30335.E7B40F65; Mon, 21 Mar 2016 20:29:03 +0100 (CET) Received: from [142.133.110.144] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.86) with Microsoft SMTP Server id 14.3.248.2; Mon, 21 Mar 2016 15:52:15 -0400 Subject: Re: [PATCH 00/30] Stop throwing exceptions from signal handlers To: Pedro Alves , References: <1458328714-4938-1-git-send-email-palves@redhat.com> From: Simon Marchi Message-ID: <56F050EE.8040703@ericsson.com> Date: Mon, 21 Mar 2016 19:52:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1458328714-4938-1-git-send-email-palves@redhat.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-03/txt/msg00432.txt.bz2 On 16-03-18 03:18 PM, Pedro Alves wrote: > 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 > I went over the series, and I understood some of the words used. What I understood looked very good. For the rest, I trust you are doing the right thing. :) Thanks a lot for doing this, since this is the major roadblock before we can't start using C++!