Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 00/30] Stop throwing exceptions from signal handlers
@ 2016-03-18 19:19 Pedro Alves
  2016-03-18 19:18 ` [PATCH 01/30] Don't rely on immediate_quit in command_line_input Pedro Alves
                   ` (30 more replies)
  0 siblings, 31 replies; 41+ messages in thread
From: Pedro Alves @ 2016-03-18 19:19 UTC (permalink / raw)
  To: gdb-patches

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


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

end of thread, other threads:[~2016-04-12 16:15 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-18 19:19 [PATCH 00/30] Stop throwing exceptions from signal handlers Pedro Alves
2016-03-18 19:18 ` [PATCH 01/30] Don't rely on immediate_quit in command_line_input Pedro Alves
2016-03-18 19:18 ` [PATCH 18/30] Fix inconsistent handling of EINTR in ser-*.c backends Pedro Alves
2016-03-18 19:19 ` [PATCH 28/30] target remote: Don't rely on immediate_quit (introduce quit handlers) Pedro Alves
2016-03-18 19:19 ` [PATCH 20/30] Use target_terminal_ours_for_output in cp-support.c Pedro Alves
2016-03-18 19:19 ` [PATCH 03/30] TUI: check whether in secondary prompt instead of immediate_quit Pedro Alves
2016-03-18 19:19 ` [PATCH 26/30] Use target_terminal_ours_for_output in MI Pedro Alves
2016-03-18 19:19 ` [PATCH 30/30] Eliminate target_check_pending_interrupt Pedro Alves
2016-03-18 19:19 ` [PATCH 27/30] TUI: GC tui_target_has_run Pedro Alves
2016-03-18 19:19 ` [PATCH 19/30] ada-lang.c: Introduce type_as_string and use it Pedro Alves
2016-03-18 19:19 ` [PATCH 14/30] Don't call clear_quit_flag in captured_main Pedro Alves
2016-03-18 19:19 ` [PATCH 29/30] Eliminate immediate_quit Pedro Alves
2016-03-18 19:19 ` [PATCH 22/30] Use target_terminal_ours_for_output in infcmd.c Pedro Alves
2016-03-18 19:19 ` [PATCH 02/30] Inline command_loop in read_command_line Pedro Alves
2016-03-18 19:24 ` [PATCH 23/30] Use target_terminal_ours_for_output in warning/internal_error Pedro Alves
2016-03-18 19:24 ` [PATCH 25/30] Do target_terminal_ours in query & friends instead of in all callers Pedro Alves
2016-03-18 19:24 ` [PATCH 17/30] Pass Ctrl-C to the target in target_terminal_inferior Pedro Alves
2016-03-18 19:25 ` [PATCH 12/30] Don't call clear_quit_flag in command_handler Pedro Alves
2016-03-18 19:25 ` [PATCH 13/30] Don't call clear_quit_flag in prepare_to_throw_exception Pedro Alves
2016-03-18 19:25 ` [PATCH 04/30] Don't set immediate_quit in prompt_for_continue Pedro Alves
2016-03-18 19:25 ` [PATCH 08/30] Fix signal handler/event-loop races Pedro Alves
2016-03-18 19:26 ` [PATCH 07/30] Introduce a serial interface for select'able events Pedro Alves
2016-03-18 19:26 ` [PATCH 24/30] Add missing cleanups to defaulted_query and prompt_for_continue Pedro Alves
2016-03-18 19:26 ` [PATCH 10/30] Make Python use a struct serial event Pedro Alves
2016-03-18 19:27 ` [PATCH 15/30] Eliminate clear_quit_flag Pedro Alves
2016-03-18 19:27 ` [PATCH 21/30] Use target_terminal_ours_for_output in exceptions.c Pedro Alves
2016-03-18 19:27 ` [PATCH 06/30] Remove unused struct serial::name field Pedro Alves
2016-03-18 19:28 ` [PATCH 05/30] Stop remote-fileio.c from throwing from SIGINT handler Pedro Alves
2016-03-18 19:28 ` [PATCH 11/30] Don't call clear_quit_flag after check_quit_flag Pedro Alves
2016-03-18 19:37 ` [PATCH 16/30] Decouple target_interrupt from all-stop/non-stop modes Pedro Alves
2016-03-21 18:21   ` Simon Marchi
2016-03-21 18:24     ` Pedro Alves
2016-03-18 19:37 ` [PATCH 09/30] Introduce interruptible_select Pedro Alves
2016-03-21 17:59   ` Simon Marchi
2016-03-21 18:33     ` Pedro Alves
2016-03-21 19:48   ` Simon Marchi
2016-03-21 19:49     ` Pedro Alves
2016-03-21 19:52 ` [PATCH 00/30] Stop throwing exceptions from signal handlers Simon Marchi
2016-03-31 14:43   ` Pedro Alves
2016-03-31 18:44     ` Pedro Alves
2016-04-12 16:15     ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox