public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH v5 0/6] [gdb/cli] Allow source highlighting to be interrupted
Date: Tue, 24 Oct 2023 11:49:27 +0200	[thread overview]
Message-ID: <20231024094933.12009-1-tdevries@suse.de> (raw)

I wrote this patch series to fix PR cli/30934.

The 1st patch adds a harness to allow selftests to call signal handlers.

The 2nd patch uses that infrastructure in the pre-existing python selftest.

The 3rd patch adds a source highlighting selftest.

The 4th patch allows source highlighting to be interrupted when
running a list command, either using SIGINT or SIGTERM, or a run
command using SIGTERM.

The 5th patch allows source highlighting to be interrupted when
running a run command, using SIGINT, fixing PR cli/30934.  It also
changes the behaviour in case of SIGINT into asking a question whether
highlighting needs to be interrupted or not.

The 6th patch is an RFC for simplifying gdb_highlight_event_listener::notify,
at the cost of more complicated selftest infrastructure.

Changes in v5:
- factored out a signal_handler_selftest harness, and put it in a separate
  patch
- applied it in the pre-existing python selftest
- simplified the initial selftest patch to not deal with SIGTERM/SIGINT
- dropped the patch "[gdb/cli] Allow source highlighting to be interrupted
  (continued)" that fiddles with the current quit_handler, after comment
  by Pedro
- updated the "[gdb/cli] Ask if source highlighting should be interrupted"
  as suggested by Pedro, added as co-author.
- made the unit test emulate the signal handler more completely, by ...
  calling the signal handler.
- made the signal_handler_selftest harness handle async_sigterm_token and
  sigint_token (now required because of the previous point).
- added the final RFC patch to try to address the problem that
  gdb_highlight_event_listener::notify is working around a limitation of the
  selftest.

Changes in v4:
- committed the first 3 patches of v3
- added handling of SIGTERM (after comment by Pedro)
- added self test
- broadened scope of quit_handler = default_quit_handler fix, and
  moved it into a patch of its own
- moved the question into a patch of its own

Changes in v3:
- dropped the "#if __cplusplus >= 202002L" in the first patch.
- added a reset of the highlighter's EventListener to prevent a dangling
  pointer as suggested by Lancelot, added as co-author.

Changes in v2:
- fixed a build problem with --disable-source-highlight, reported by the linaro
  CI.
- temporarily installs the default_quit_handler to be able to use QUIT
- added a question whether to interrupt highlighting or not
  (in the RFC, I had a warning, in v1 I dropped it)
- added "gdb_assert (target_terminal::is_ours ())"

Adding the question was inspired by the v3 patch "gdb/debuginfod: Ctrl-C ask
to cancel further downloads" (
https://sourceware.org/pipermail/gdb-patches/2023-March/197679.html ).

Submission history:
- RFC:
  https://sourceware.org/pipermail/gdb-patches/2023-October/203157.html
- v1:
  https://sourceware.org/pipermail/gdb-patches/2023-October/203179.html
- v2:
  https://sourceware.org/pipermail/gdb-patches/2023-October/203199.html
- v3:
  https://sourceware.org/pipermail/gdb-patches/2023-October/203270.html
- v4:
  https://sourceware.org/pipermail/gdb-patches/2023-October/203391.html

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

Tom de Vries (6):
  [gdb/cli] Add signal_handler_selftest
  [gdb/python] Make python selftest more robust
  [gdb/cli] Add gnu-source-highlight selftest
  [gdb/cli] Allow source highlighting to be interrupted
  [gdb/cli] Ask if source highlighting should be interrupted
  [gdb/cli] Simplify gdb_highlight_event_listener::notify

 gdb/event-top.c     |  95 ++++++++++++++++++++++++
 gdb/event-top.h     |  36 +++++++++
 gdb/python/python.c |   7 +-
 gdb/source-cache.c  | 177 +++++++++++++++++++++++++++++++++++++++++++-
 gdb/top.c           |   7 ++
 gdb/top.h           |   7 ++
 6 files changed, 326 insertions(+), 3 deletions(-)


base-commit: f87cf663af71e5d78c8d647fa48562102f3b0615
-- 
2.35.3


             reply	other threads:[~2023-10-24  9:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24  9:49 Tom de Vries [this message]
2023-10-24  9:49 ` [PATCH v5 1/6] [gdb/cli] Add signal_handler_selftest Tom de Vries
2023-11-22 16:26   ` Tom de Vries
2023-10-24  9:49 ` [PATCH v5 2/6] [gdb/python] Make python selftest more robust Tom de Vries
2023-10-24  9:49 ` [PATCH v5 3/6] [gdb/cli] Add gnu-source-highlight selftest Tom de Vries
2023-10-24 12:33   ` Tom de Vries
2023-10-24  9:49 ` [PATCH v5 4/6] [gdb/cli] Allow source highlighting to be interrupted Tom de Vries
2023-10-24  9:49 ` [PATCH v5 5/6] [gdb/cli] Ask if source highlighting should " Tom de Vries
2023-10-24  9:49 ` [PATCH v5 6/6] [gdb/cli] Simplify gdb_highlight_event_listener::notify Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231024094933.12009-1-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).