public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "Manfred.Steiner at gmx dot at" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/29278] gdb crashes on interrupt (non-stop mode, target extended-remote)
Date: Fri, 24 Jun 2022 04:21:32 +0000	[thread overview]
Message-ID: <bug-29278-4717-gW5ZaDj57I@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-29278-4717@http.sourceware.org/bugzilla/>

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

--- Comment #3 from Manfred Steiner <Manfred.Steiner at gmx dot at> ---
There are some more similar problems:

1) start gdb (for target avr)
2) (gdb) set non-stop 1
3) (gdb) file ...
4) (gdb) target extended-remote ...

The stub returns no thread running (in my point of view OK for extended-remote
mode); means "$qfThreadInfo#bb" -> "$l#6c" in gdb protocol.

5) (gdb) load

gdb crashes
  ...
  .../binutils-gdb/gdb/thread.c:85
  ...
  .../binutils-gdb/gdb/symfile.c:1836 
  ...

because command load (symfile.c:1836) is not checking if inferior has threads.
In this case inferior has no threads, so current_thread is nullptr, and
function inferior_thread (thread.c:85) fails on gdb_assert (current_thread_ !=
nullptr);

Simple fix possible with additional check in load command:

add on binutils-gdb/gdb/symfile.c:1836: 
if (current_inferior()->ptid_thread_map.size() == 0) {
  error (_("Error: current inferior has no threads, cannot load"));
  return;
}

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

      parent reply	other threads:[~2022-06-24  4:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-29278-4717@http.sourceware.org/bugzilla/>
2022-06-23  6:53 ` amodra at gmail dot com
2022-06-23 10:46 ` pedro at palves dot net
2022-06-23 10:51 ` pedro at palves dot net
2022-06-24  4:21 ` Manfred.Steiner at gmx dot at [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=bug-29278-4717-gW5ZaDj57I@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).