public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "jmatyas at codasip dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/26819] RISC-V: internal-error: int finish_step_over(execution_control_state*): Assertion
Date: Sun, 07 Feb 2021 21:20:24 +0000	[thread overview]
Message-ID: <bug-26819-4717-ZUVgnKmSzd@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-26819-4717@http.sourceware.org/bugzilla/>

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

--- Comment #25 from Jan Matyas <jmatyas at codasip dot com> ---
(In reply to Simon Marchi from comment #24)
> [...]  The steps missing are:
> 
> - Write a good commit message that explains why things fail currently and
> why the patch fixes them (including a ChangeLog entry)
> - Enhance the test (gdb.server/stop-reply-no-thread.exp I think) so it
> covers the two scenarios I mentioned ("--disable-packet=T
> --disable-packet=qfThreadInfo" and "--disable-packet=threads")
> - Send the patch to the mailing list for review.

Hi Simon,
I have rebased your patch from Jan-17 and enhanced the test case as suggested.
Please, check if that is all right.

As my knowledge of gdb code is low, I'd appreciate if you could write the
commit message as the author of the patch (and submit it to the mailing list).

Thank you, regards,
Jan



>From c99eb5f06a0c25129875ed5addcc2cf2e7a9ab39 Mon Sep 17 00:00:00 2001
From: Jan Matyas <jmatyas@codasip.com>
Date: Sun, 7 Feb 2021 22:04:50 +0100
Subject: [PATCH] Patch for gdb/26819

TODO: Proper commit message

- Rebased Simon Marchi's patch from Jan/17.
- Extended the gdb.server/stop-reply-no-thread.exp test case
  to cover the situation when the gdbserver does not report
  any threads.
---
 gdb/remote.c                                      | 9 ++++++---
 gdb/testsuite/gdb.server/stop-reply-no-thread.exp | 9 +++++++++
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/gdb/remote.c b/gdb/remote.c
index 31c6e17a1c..4cda15470e 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -741,7 +741,7 @@ class remote_target : public process_stratum_target
   int remote_resume_with_vcont (ptid_t ptid, int step,
                                gdb_signal siggnal);

-  void add_current_inferior_and_thread (const char *wait_status);
+  thread_info *add_current_inferior_and_thread (const char *wait_status);

   ptid_t wait_ns (ptid_t ptid, struct target_waitstatus *status,
                  target_wait_flags options);
@@ -4411,7 +4411,7 @@ remote_target::get_current_thread (const char
*wait_status)
    qC query, we infer the current thread from that stop reply, passed
    in in WAIT_STATUS, which may be NULL.  */

-void
+thread_info *
 remote_target::add_current_inferior_and_thread (const char *wait_status)
 {
   struct remote_state *rs = get_remote_state ();
@@ -4445,6 +4445,8 @@ remote_target::add_current_inferior_and_thread (const
char *wait_status)
      yet.  */
   thread_info *tp = add_thread_silent (this, curr_ptid);
   switch_to_thread_no_regs (tp);
+
+  return tp;
 }

 /* Print info about a thread that was found already stopped on
@@ -4800,7 +4802,8 @@ remote_target::start_remote (int from_tty, int
extended_p)
          /* Target has no concept of threads at all.  GDB treats
             non-threaded target as single-threaded; add a main
             thread.  */
-         add_current_inferior_and_thread (wait_status);
+         thread_info *tp = add_current_inferior_and_thread (wait_status);
+         get_remote_thread_info (tp)->set_resumed ();
        }
       else
        {
diff --git a/gdb/testsuite/gdb.server/stop-reply-no-thread.exp
b/gdb/testsuite/gdb.server/stop-reply-no-thread.exp
index 68bf42ac1a..e698eaff6e 100644
--- a/gdb/testsuite/gdb.server/stop-reply-no-thread.exp
+++ b/gdb/testsuite/gdb.server/stop-reply-no-thread.exp
@@ -112,3 +112,12 @@ foreach_with_prefix to_disable { "" Tthread T } {
        run_test $to_disable $t_nonstop
     }
 }
+
+# Regression for gdb/26819: Cover the case when GDBserver does not report
+# any threads. Non-stop Mode is off.
+#
+# Scenario 1: Disable 'T' and 'qfThreadInfo' packets
+# Scenario 2: Disable all threading packets
+foreach_with_prefix to_disable { "T,qfThreadInfo" "threads" } {
+    run_test $to_disable off
+}
-- 
2.20.1

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

  parent reply	other threads:[~2021-02-07 21:20 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-30 16:11 [Bug gdb/26819] New: " jmatyas at codasip dot com
2020-10-30 16:13 ` [Bug gdb/26819] " jmatyas at codasip dot com
2020-11-08  9:07 ` [Bug gdb/26819] RISC-V: " jmatyas at codasip dot com
2020-11-08 10:07 ` andrew.burgess at embecosm dot com
2020-11-08 11:10 ` jmatyas at codasip dot com
2020-11-08 11:13 ` jmatyas at codasip dot com
2020-11-09  9:51 ` andrew.burgess at embecosm dot com
2021-01-06  6:37 ` jmatyas at codasip dot com
2021-01-06  9:35 ` andrew.burgess at embecosm dot com
2021-01-08 11:03 ` jmatyas at codasip dot com
2021-01-08 16:09 ` simark at simark dot ca
2021-01-14  1:27 ` cvs-commit at gcc dot gnu.org
2021-01-14  1:29 ` simark at simark dot ca
2021-01-14  9:11 ` andrew.burgess at embecosm dot com
2021-01-14  9:41 ` jmatyas at codasip dot com
2021-01-16 11:00 ` jmatyas at codasip dot com
2021-01-16 11:03 ` jmatyas at codasip dot com
2021-01-16 11:04 ` jmatyas at codasip dot com
2021-01-17  3:36 ` simark at simark dot ca
2021-01-17 22:37 ` jmatyas at codasip dot com
2021-01-17 22:38 ` jmatyas at codasip dot com
2021-01-17 22:39 ` jmatyas at codasip dot com
2021-01-18  5:15 ` simark at simark dot ca
2021-01-18 11:01 ` jmatyas at codasip dot com
2021-01-18 15:23 ` sebastian.huber@embedded-brains.de
2021-01-27 12:35 ` jmatyas at codasip dot com
2021-01-27 16:00 ` simark at simark dot ca
2021-02-07 21:20 ` jmatyas at codasip dot com [this message]
2021-02-08  2:00 ` simon.marchi at polymtl dot ca
2021-02-08  2:02 ` simon.marchi at polymtl dot ca
2021-02-20 20:51 ` simark at simark dot ca
2021-02-24  9:17 ` jmatyas at codasip dot com
2021-02-25  7:41 ` jmatyas at codasip dot com
2021-02-25 20:50 ` simark at simark dot ca
2021-03-04 23:23 ` jmatyas at codasip dot com
2021-03-04 23:24 ` jmatyas at codasip dot com
2021-03-04 23:25 ` jmatyas at codasip dot com
2021-03-04 23:25 ` jmatyas at codasip dot com
2021-03-04 23:27 ` simark at simark dot ca
2021-03-04 23:46 ` jmatyas at codasip dot com
2021-03-04 23:49 ` jmatyas at codasip dot com
2021-06-03 20:41 ` andrew.burgess at embecosm dot com
2021-06-03 21:19 ` andrew.burgess at embecosm dot com
2021-06-03 21:38 ` andrew.burgess at embecosm dot com
2021-06-06 14:28 ` brobecker at gnat dot com
2021-06-07  5:28 ` jmatyas at codasip dot com
2021-06-07  8:30 ` andrew.burgess at embecosm dot com
2021-08-06  1:41 ` lennordocdoc0921 at gmail dot com
2022-04-09 15:07 ` [Bug tdep/26819] " tromey at sourceware dot org
2022-11-29 19:38 ` tromey at sourceware dot org

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-26819-4717-ZUVgnKmSzd@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).