Add `set print array-indexes' tests for C/C++ arrays
[binutils-gdb.git] / gdb / progspace-and-thread.c
index 3c92b5c8e045e33bd032a152684910eedf7afd65..948183d4cce7922d5ea2c118e69e7b848f3a44ba 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -25,8 +25,9 @@ void
 switch_to_program_space_and_thread (program_space *pspace)
 {
   inferior *inf = find_inferior_for_program_space (pspace);
+  gdb_assert (inf != nullptr);
 
-  if (inf != NULL && inf->pid != 0)
+  if (inf->pid != 0)
     {
       thread_info *tp = any_live_thread_of_inferior (inf);
 
@@ -39,6 +40,5 @@ switch_to_program_space_and_thread (program_space *pspace)
        }
     }
 
-  switch_to_no_thread ();
-  set_current_program_space (pspace);
+  switch_to_inferior_no_thread (inf);
 }