Index: progspace.h =================================================================== RCS file: /cvs/src/src/gdb/progspace.h,v retrieving revision 1.7 diff -u -p -r1.7 progspace.h --- progspace.h 10 Jan 2011 20:38:50 -0000 1.7 +++ progspace.h 22 Jul 2011 17:03:07 -0000 @@ -185,6 +185,9 @@ struct program_space solib.c. */ struct so_list *so_list; + /* Number of calls to solib_add. */ + unsigned solib_add_generation; + /* Per pspace data-pointers required by other GDB modules. */ void **data; unsigned num_data; Index: infcmd.c =================================================================== RCS file: /cvs/src/src/gdb/infcmd.c,v retrieving revision 1.287 diff -u -p -r1.287 infcmd.c --- infcmd.c 30 May 2011 18:04:32 -0000 1.287 +++ infcmd.c 22 Jul 2011 17:03:07 -0000 @@ -421,6 +421,9 @@ post_create_inferior (struct target_ops if (exec_bfd) { + const unsigned solib_add_generation + = current_program_space->solib_add_generation; + /* Create the hooks to handle shared library load and unload events. */ #ifdef SOLIB_CREATE_INFERIOR_HOOK @@ -428,24 +431,29 @@ post_create_inferior (struct target_ops #else solib_create_inferior_hook (from_tty); #endif - } - - /* If the solist is global across processes, there's no need to - refetch it here. */ - if (exec_bfd && !gdbarch_has_global_solist (target_gdbarch)) - { - /* Sometimes the platform-specific hook loads initial shared - libraries, and sometimes it doesn't. If it doesn't FROM_TTY will be - incorrectly 0 but such solib targets should be fixed anyway. If we - made all the inferior hook methods consistent, this call could be - removed. Call it only after the solib target has been initialized by - solib_create_inferior_hook. */ + if (current_program_space->solib_add_generation == solib_add_generation) + { + /* The platform-specific hook should load initial shared libraries, + but didn't. FROM_TTY will be incorrectly 0 but such solib + targets should be fixed anyway. Call it only after the solib + target has been initialized by solib_create_inferior_hook. */ + + if (info_verbose) + warning (_("platform-specific solib_create_inferior_hook did " + "not load initial shared libraries.")); + + /* If the solist is global across processes, there's no need to + refetch it here. */ + if (!gdbarch_has_global_solist (target_gdbarch)) + { #ifdef SOLIB_ADD - SOLIB_ADD (NULL, 0, target, auto_solib_add); + SOLIB_ADD (NULL, 0, target, auto_solib_add); #else - solib_add (NULL, 0, target, auto_solib_add); + solib_add (NULL, 0, target, auto_solib_add); #endif + } + } } /* If the user sets watchpoints before execution having started, Index: solib.c =================================================================== RCS file: /cvs/src/src/gdb/solib.c,v retrieving revision 1.149 diff -u -p -r1.149 solib.c --- solib.c 30 Jun 2011 19:29:54 -0000 1.149 +++ solib.c 22 Jul 2011 17:03:07 -0000 @@ -914,6 +914,8 @@ solib_add (char *pattern, int from_tty, { struct so_list *gdb; + current_program_space->solib_add_generation++; + if (pattern) { char *re_err = re_comp (pattern);