public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Dmitry Neverov <dmitry.neverov@jetbrains.com>
Cc: Tom Tromey <tom@tromey.com>,
	 Dmitry Neverov via Gdb <gdb@sourceware.org>
Subject: Re: Canceling a long running gdb/mi command
Date: Fri, 28 Jul 2023 14:50:30 -0600	[thread overview]
Message-ID: <87y1iz92w9.fsf@tromey.com> (raw)
In-Reply-To: <CAEY59_+K1Ej+QHOP03gE=FMrtxFqcw6Bhe1FXZTpzaQksqcDLw@mail.gmail.com> (Dmitry Neverov's message of "Fri, 28 Jul 2023 12:02:30 +0200")

Dmitry> I was wrong, it works, but one might need to send several
Dmitry> SIGINTs. In my case, the first exception thrown by quit() was
Dmitry> caught and ignored in cp-support.c replace_typedefs(), and the
Dmitry> gdb/mi command continued running. The second one was caught 
Dmitry> and handled in cp-support.c inspect_type() which made a slow
Dmitry> -var_list_children command to complete.

Catching and ignoring like that seems bad.  IMO only non-QUIT exceptions
should be caught in this way, at least in most places.

I see a lot of violations of this idea though -- grep says 282.  So that
is not good.  Though on reflection, not all of these are really
incorrect, because the 'try' block may not end up calling QUIT.

Fixing this seems like a bit of a pain.  Probably some of those catches
really should handle QUIT as well.  Also it seems like some kind of
region-based QUIT suppression has to be done, because there are parts of
gdb that can't really be QUIT from (e.g., the DWARF reader is basically
unprepared for this).

I wonder whether varobj can really handle interruption.
That code is pretty hard to work on... anyway it would be interesting to
see a stack trace from your scenario.

Dmitry> Is it by design and clients should send SIGINTs repeatedly?

No.

Dmitry> Do I understand correctly, that it is safe to send a SIGINT when
Dmitry> no gdb/mi command is running? Meaning it won't terminate
Dmitry> gdb. I've tried and it works, but maybe I was lucky.

Yes, I think this should be fine.  However, if the inferior is running,
I think it may cause an inferior stop.

Tom

      reply	other threads:[~2023-07-28 20:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-24  8:58 Dmitry Neverov
2023-07-26 16:11 ` Tom Tromey
2023-07-28 10:02   ` Dmitry Neverov
2023-07-28 20:50     ` Tom Tromey [this message]

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=87y1iz92w9.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=dmitry.neverov@jetbrains.com \
    --cc=gdb@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).