public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] Introduce switch_to_inferior_no_thread
Date: Sat, 11 Jan 2020 03:46:00 -0000	[thread overview]
Message-ID: <db2d40f7d0b8477ca5ad9e305b8137a085434c97@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT db2d40f7d0b8477ca5ad9e305b8137a085434c97 ***

commit db2d40f7d0b8477ca5ad9e305b8137a085434c97
Author:     Pedro Alves <palves@redhat.com>
AuthorDate: Fri Jan 10 20:05:47 2020 +0000
Commit:     Pedro Alves <palves@redhat.com>
CommitDate: Fri Jan 10 20:05:47 2020 +0000

    Introduce switch_to_inferior_no_thread
    
    Several places want to switch context to an inferior and its pspace,
    while at the same time switch to "no thread selected".  This commit
    adds a function that does that, and uses it in a few places.
    
    gdb/ChangeLog:
    2020-01-10  Pedro Alves <palves@redhat.com>
    
            * inferior.c (switch_to_inferior_no_thread): New function,
            factored out from ...
            (inferior_command): ... here.
            * inferior.h (switch_to_inferior_no_thread): Declare.
            * mi/mi-main.c (run_one_inferior): Use
            switch_to_inferior_no_thread.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 3b5f9aab48..50c56c95c6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2020-01-10  Pedro Alves <palves@redhat.com>
+
+	* inferior.c (switch_to_inferior_no_thread): New function,
+	factored out from ...
+	(inferior_command): ... here.
+	* inferior.h (switch_to_inferior_no_thread): Declare.
+	* mi/mi-main.c (run_one_inferior): Use
+	switch_to_inferior_no_thread.
+
 2020-01-10  Pedro Alves  <palves@redhat.com>
 
 	* infcmd.c (kill_command): Remove dead code.
diff --git a/gdb/inferior.c b/gdb/inferior.c
index 3969ace13a..0c5e2c74d4 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -575,6 +575,16 @@ kill_inferior_command (const char *args, int from_tty)
   bfd_cache_close_all ();
 }
 
+/* See inferior.h.  */
+
+void
+switch_to_inferior_no_thread (inferior *inf)
+{
+  set_current_inferior (inf);
+  switch_to_no_thread ();
+  set_current_program_space (inf->pspace);
+}
+
 static void
 inferior_command (const char *args, int from_tty)
 {
@@ -605,9 +615,7 @@ inferior_command (const char *args, int from_tty)
     }
   else
     {
-      set_current_inferior (inf);
-      switch_to_no_thread ();
-      set_current_program_space (inf->pspace);
+      switch_to_inferior_no_thread (inf);
 
       gdb::observers::user_selected_context_changed.notify
 	(USER_SELECTED_INFERIOR);
@@ -737,11 +745,8 @@ add_inferior_command (const char *args, int from_tty)
       if (exec != NULL)
 	{
 	  /* Switch over temporarily, while reading executable and
-	     symbols.q.  */
-	  set_current_program_space (inf->pspace);
-	  set_current_inferior (inf);
-	  switch_to_no_thread ();
-
+	     symbols.  */
+	  switch_to_inferior_no_thread (inf);
 	  exec_file_attach (exec.get (), from_tty);
 	  symbol_file_add_main (exec.get (), add_flags);
 	}
diff --git a/gdb/inferior.h b/gdb/inferior.h
index fe94a01784..a9baa52355 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -308,6 +308,10 @@ extern inferior *current_inferior ();
 
 extern void set_current_inferior (inferior *);
 
+/* Switch inferior (and program space) to INF, and switch to no thread
+   selected.  */
+extern void switch_to_inferior_no_thread (inferior *inf);
+
 /* GDB represents the state of each program execution with an object
    called an inferior.  An inferior typically corresponds to a process
    but is more general and applies also to targets that do not have a
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index e67738193b..24daf3f883 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -414,11 +414,7 @@ run_one_inferior (struct inferior *inf, void *arg)
       switch_to_thread (tp);
     }
   else
-    {
-      set_current_inferior (inf);
-      switch_to_no_thread ();
-      set_current_program_space (inf->pspace);
-    }
+    switch_to_inferior_no_thread (inf);
   mi_execute_cli_command (run_cmd, async_p,
 			  async_p ? "&" : NULL);
   return 0;


             reply	other threads:[~2020-01-11  3:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-11  3:46 gdb-buildbot [this message]
2020-01-11  3:46 ` Failures on Ubuntu-Aarch64-m64, branch master gdb-buildbot
2020-01-11  4:21 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot
2020-01-12 11:37 ` Failures on Fedora-i686, " gdb-buildbot
2020-01-12 12:08 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2020-01-12 12:56 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2020-01-12 13:07 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2020-01-12 13:27 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot
2020-01-12 14:25 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2020-01-12 14:48 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot

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=db2d40f7d0b8477ca5ad9e305b8137a085434c97@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@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).