diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a6738bdc95d8..4887e5790ec8 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2018-11-22 Pedro Alves + + * infrun.c (follow_exec) : Add thread and + switch to it before calling into try_open_exec_file. + 2018-11-22 Pedro Alves * cli/cli-interp.c (cli_on_user_selected_context_changed): Use diff --git a/gdb/infrun.c b/gdb/infrun.c index 3e9acb45aa98..81f45becffc4 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1202,6 +1202,7 @@ follow_exec (ptid_t ptid, char *exec_file_target) set_current_inferior (inf); set_current_program_space (inf->pspace); + add_thread (ptid); } else { @@ -1231,11 +1232,6 @@ follow_exec (ptid_t ptid, char *exec_file_target) registers. */ target_find_description (); - /* The add_thread call ends up reading registers, so do it after updating the - target description. */ - if (follow_exec_mode_string == follow_exec_mode_new) - add_thread (ptid); - solib_create_inferior_hook (0); jit_inferior_created_hook ();