summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPaul Pluzhnikov <ppluzhnikov@google.com>2011-07-26 15:17:44 +0000
committerPaul Pluzhnikov <ppluzhnikov@google.com>2011-07-26 15:17:44 +0000
commit6447056c074a55e63a5cbe15e75d19fbbbdd3ef1 (patch)
tree56e15659d608e574da1dc089403c579746e22372 /gdb
parent7d3d1b4a38adb81e968c08f09b2076cc85d66072 (diff)
downloadgdb-6447056c074a55e63a5cbe15e75d19fbbbdd3ef1.tar.gz
2011-07-26 Paul Pluzhnikov <ppluzhnikov@google.com>
* progspace.h (struct program_space): Add solib_add_generation. * infcmd.c (post_create_inferior): Only call solib_add if not already done. * solib.c (solib_add): Increment solib_add_generation.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/infcmd.c36
-rw-r--r--gdb/progspace.h3
-rw-r--r--gdb/solib.c2
4 files changed, 34 insertions, 14 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 08361be7536..41dc0b2ea6a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2011-07-26 Paul Pluzhnikov <ppluzhnikov@google.com>
+
+ * progspace.h (struct program_space): Add solib_add_generation.
+ * infcmd.c (post_create_inferior): Only call solib_add if not
+ already done.
+ * solib.c (solib_add): Increment solib_add_generation.
+
2011-07-25 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix implicit pointer offsets.
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index aa3646b483c..0a38c64c7e8 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -421,6 +421,9 @@ post_create_inferior (struct target_ops *target, int from_tty)
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 *target, int from_tty)
#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,
diff --git a/gdb/progspace.h b/gdb/progspace.h
index 5d3ed950f75..76e8080a852 100644
--- a/gdb/progspace.h
+++ b/gdb/progspace.h
@@ -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;
diff --git a/gdb/solib.c b/gdb/solib.c
index 94f8f13422e..49c1cdbfd64 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -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);