From d162d338475a9f57b99a2bfa5d62cc339eb47ed6 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Tue, 8 Jul 2008 10:31:16 +0000 Subject: [PATCH] * infrun.c (follow_exec): Reset shared libraries before adding the main exec file. --- gdb/ChangeLog | 5 +++++ gdb/infrun.c | 14 +++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 059d19acde..784ad45cd8 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2008-07-08 Pedro Alves + + * infrun.c (follow_exec): Reset shared libraries before adding the + main exec file. + 2008-07-07 Jan Kratochvil * breakpoint.c (bpstat_copy): Call RELEASE_VALUE on the new OLD_VAL. diff --git a/gdb/infrun.c b/gdb/infrun.c index 2c4ebc8fc4..dbb6110057 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -419,13 +419,17 @@ follow_exec (int pid, char *execd_pathname) /* That a.out is now the one to use. */ exec_file_attach (execd_pathname, 0); - /* And also is where symbols can be found. */ + /* Reset the shared library package. This ensures that we get a + shlib event when the child reaches "_start", at which point the + dld will have had a chance to initialize the child. */ + /* Also, loading a symbol file below may trigger symbol lookups, and + we don't want those to be satisfied by the libraries of the + previous incarnation of this process. */ + no_shared_libraries (NULL, 0); + + /* Load the main file's symbols. */ symbol_file_add_main (execd_pathname, 0); - /* Reset the shared library package. This ensures that we get - a shlib event when the child reaches "_start", at which point - the dld will have had a chance to initialize the child. */ - no_shared_libraries (NULL, 0); #ifdef SOLIB_CREATE_INFERIOR_HOOK SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid)); #else -- 2.11.0