public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/26761] thread.c:95: internal-error: thread_info* inferior_thread(): Assertion `current_thread_ != nullptr' failed
Date: Mon, 27 Feb 2023 23:21:49 +0000	[thread overview]
Message-ID: <bug-26761-4717-vAlYytlRgf@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-26761-4717@http.sourceware.org/bugzilla/>

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

--- Comment #20 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Kevin Buettner <kevinb@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=363429d593eb1eb17f3f2cf6c247f60fadf660d9

commit 363429d593eb1eb17f3f2cf6c247f60fadf660d9
Author: Kevin Buettner <kevinb@redhat.com>
Date:   Mon Feb 27 16:11:37 2023 -0700

    QUIT processing w/ explicit throw for gdb_exception_forced_quit

    This commit contains changes which have an explicit throw for
    gdb_exception_forced_quit, or, in a couple of cases for gdb_exception,
    but with a throw following a check to see if 'reason' is
    RETURN_FORCED_QUIT.

    Most of these are straightforward - it made sense to continue to allow
    an existing catch of gdb_exception to also catch gdb_exception_quit;
    in these cases, a catch/throw for gdb_exception_forced_quit was added.

    There are two cases, however, which deserve a more detailed
    explanation.

    1) remote_fileio_request in gdb/remote-fileio.c:

    The try block calls do_remote_fileio_request which can (in turn)
    call one of the functions in remote_fio_func_map[].  Taking the
    first one, remote_fileio_func_open(), we have the following call
    path to maybe_quit():

      remote_fileio_func_open(remote_target*, char*)
        -> target_read_memory(unsigned long, unsigned char*, long)
        -> target_read(target_ops*, target_object, char const*, unsigned char*,
unsigned long, long)
        -> maybe_quit()

    Since there is a path to maybe_quit(), we must ensure that the
    catch block is not permitted to swallow a QUIT representing a
    SIGTERM.

    However, for this case, we must take care not to change the way that
    Ctrl-C / SIGINT is handled; we want to send a suitable EINTR reply to
    the remote target should that happen.  That being the case, I added a
    catch/throw for gdb_exception_forced_quit.  I also did a bit of
    rewriting here, adding a catch for gdb_exception_quit in favor of
    checking the 'reason' code in the catch block for gdb_exception.

    2) mi_execute_command in gdb/mi/mi-main.c:

    The try block calls captured_mi_execute_command(); there exists
    a call path to maybe_quit():

      captured_mi_execute_command(ui_out*, mi_parse*)
        -> mi_cmd_execute(mi_parse*)
        -> get_current_frame()
        -> get_prev_frame_always_1(frame_info*)
        -> frame_register_unwind_location(frame_info*, int, int*, lval_type*,
unsigned long*, int*)
        -> frame_register_unwind(frame_info*, int, int*, int*, lval_type*,
unsigned long*, int*, unsigned char*)
        -> value_entirely_available(value*)
        -> value_fetch_lazy(value*)
        -> value_fetch_lazy_memory(value*)
        -> read_value_memory(value*, long, int, unsigned long, unsigned char*,
unsigned long)
        -> maybe_quit()

    That being the case, we can't allow the exception handler (catch block)
    to swallow a gdb_exception_quit for SIGTERM.  However, it does seem
    reasonable to output the exception via the mi interface so that some
    suitable message regarding SIGTERM might be printed; therefore, I
    check the exception's 'reason' field for RETURN_FORCED_QUIT and
    do a throw for this case.

    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=26761
    Tested-by: Tom de Vries <tdevries@suse.de>
    Approved-By: Pedro Alves <pedro@palves.net>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2023-02-27 23:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-20 16:07 [Bug gdb/26761] New: " vries at gcc dot gnu.org
2020-10-20 16:07 ` [Bug gdb/26761] " vries at gcc dot gnu.org
2020-11-25 21:05 ` marcdufresne at laposte dot net
2020-12-13 13:12 ` ddresser at bmc dot com
2020-12-14 19:04 ` simark at simark dot ca
2020-12-14 19:06 ` simark at simark dot ca
2021-02-17 22:34 ` Minima2014 at iCloud dot com
2021-09-16  1:17 ` parke.nexus at gmail dot com
2021-09-19  2:10 ` simark at simark dot ca
2021-09-19  3:43 ` parke.nexus at gmail dot com
2022-09-29 10:02 ` vries at gcc dot gnu.org
2022-09-29 12:07 ` vries at gcc dot gnu.org
2022-09-29 14:24 ` simark at simark dot ca
2022-09-29 14:42 ` vries at gcc dot gnu.org
2022-09-29 14:43 ` vries at gcc dot gnu.org
2022-09-29 15:22 ` vries at gcc dot gnu.org
2022-12-15 14:56 ` tromey at sourceware dot org
2023-02-27 23:21 ` cvs-commit at gcc dot gnu.org
2023-02-27 23:21 ` cvs-commit at gcc dot gnu.org
2023-02-27 23:21 ` cvs-commit at gcc dot gnu.org
2023-02-27 23:21 ` cvs-commit at gcc dot gnu.org
2023-02-27 23:21 ` cvs-commit at gcc dot gnu.org
2023-02-27 23:21 ` cvs-commit at gcc dot gnu.org [this message]
2023-02-27 23:21 ` cvs-commit at gcc dot gnu.org
2023-02-27 23:21 ` cvs-commit at gcc dot gnu.org
2023-03-09 22:44 ` kevinb at redhat dot com

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=bug-26761-4717-vAlYytlRgf@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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).