From db2d40f7d0b8477ca5ad9e305b8137a085434c97 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 10 Jan 2020 20:05:47 +0000 Subject: 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 * 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. --- gdb/mi/mi-main.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'gdb/mi') diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index e677381..24daf3f 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; -- cgit v1.1