diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2fe8ab103f7..7e3a7eaebe9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2017-09-05 Simon Marchi + + * infrun.c (follow_exec): Call add_thread after + target_find_description. + 2017-09-05 Simon Marchi * infrun.c (handle_inferior_event_1): When exec'ing, read diff --git a/gdb/infrun.c b/gdb/infrun.c index 1c6b186e4d5..1e301d3a441 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1211,7 +1211,6 @@ follow_exec (ptid_t ptid, char *exec_file_target) set_current_inferior (inf); set_current_program_space (inf->pspace); - add_thread (ptid); } else { @@ -1243,6 +1242,11 @@ 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 ();