aboutsummaryrefslogtreecommitdiff
path: root/gdb/solib.c
diff options
context:
space:
mode:
authorJim Blandy <jimb@codesourcery.com>2000-04-03 17:45:17 +0000
committerJim Blandy <jimb@codesourcery.com>2000-04-03 17:45:17 +0000
commite8930304b255ae2aa6854e0bbdabed89cf746978 (patch)
treedb190a26e6943813f432382ea3eda0b42d26fb50 /gdb/solib.c
parenta9273d78affd6821fc98b88d634febf66273c621 (diff)
downloadgdb-e8930304b255ae2aa6854e0bbdabed89cf746978.zip
gdb-e8930304b255ae2aa6854e0bbdabed89cf746978.tar.gz
gdb-e8930304b255ae2aa6854e0bbdabed89cf746978.tar.bz2
* solib.c (solib_add): Move all the code for loading symbol tables
below the code to sort out additions and removals. That way, we always catch all loaded shared libraries whose symbols we haven't grabbed yet. * solib.c (solib_add): Don't try to free a shared object's objfile if it doesn't have one. Duh. * solib.c (solib_add): If a pattern was given, but it doesn't match any currently loaded shared libraries, print a message; don't just be silent.
Diffstat (limited to 'gdb/solib.c')
-rw-r--r--gdb/solib.c84
1 files changed, 51 insertions, 33 deletions
diff --git a/gdb/solib.c b/gdb/solib.c
index c9eaa59..c44a65d 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -1315,7 +1315,7 @@ solib_add (char *pattern, int from_tty, struct target_ops *target)
*gdb_link = gdb->next;
/* Unless the user loaded it explicitly, free SO's objfile. */
- if (! (gdb->objfile->flags & OBJF_USERLOADED))
+ if (gdb->objfile && ! (gdb->objfile->flags & OBJF_USERLOADED))
free_objfile (gdb->objfile);
/* Some targets' section tables might be referring to
@@ -1329,8 +1329,7 @@ solib_add (char *pattern, int from_tty, struct target_ops *target)
/* Now the inferior's list contains only shared objects that don't
appear in GDB's list --- those that are newly loaded. Add them
- to GDB's shared object list, and read in their symbols, if
- appropriate. */
+ to GDB's shared object list. */
if (inferior)
{
struct so_list *i;
@@ -1338,8 +1337,7 @@ solib_add (char *pattern, int from_tty, struct target_ops *target)
/* Add the new shared objects to GDB's list. */
*gdb_link = inferior;
- /* Fill in the rest of each of the `struct so_list' nodes, and
- read symbols for those files whose names match PATTERN. */
+ /* Fill in the rest of each of the `struct so_list' nodes. */
for (i = inferior; i; i = i->next)
{
i->from_tty = from_tty;
@@ -1348,29 +1346,6 @@ solib_add (char *pattern, int from_tty, struct target_ops *target)
catch_errors (solib_map_sections, i,
"Error while mapping shared library sections:\n",
RETURN_MASK_ALL);
-
- if (! pattern || re_exec (i->so_name))
- {
- if (i->symbols_loaded)
- {
- if (from_tty)
- printf_unfiltered ("Symbols already loaded for %s\n",
- i->so_name);
- }
- else
- {
- if (catch_errors
- (symbol_add_stub, i,
- "Error while reading shared library symbols:\n",
- RETURN_MASK_ALL))
- {
- if (from_tty)
- printf_unfiltered ("Loaded symbols for %s\n",
- i->so_name);
- i->symbols_loaded = 1;
- }
- }
- }
}
/* If requested, add the shared objects' sections to the the
@@ -1398,13 +1373,56 @@ solib_add (char *pattern, int from_tty, struct target_ops *target)
}
}
}
+ }
- /* Getting new symbols may change our opinion about what is
- frameless. */
- reinit_frame_cache ();
+ /* Finally, read the symbols as requested. Walk the list of
+ currently loaded shared libraries, and read symbols for any that
+ match the pattern --- or any whose symbols aren't already loaded,
+ if no pattern was given. */
+ {
+ int any_matches = 0;
+ int loaded_any_symbols = 0;
- special_symbol_handling ();
- }
+ for (gdb = so_list_head; gdb; gdb = gdb->next)
+ if (! pattern || re_exec (gdb->so_name))
+ {
+ any_matches = 1;
+
+ if (gdb->symbols_loaded)
+ {
+ if (from_tty)
+ printf_unfiltered ("Symbols already loaded for %s\n",
+ gdb->so_name);
+ }
+ else
+ {
+ if (catch_errors
+ (symbol_add_stub, gdb,
+ "Error while reading shared library symbols:\n",
+ RETURN_MASK_ALL))
+ {
+ if (from_tty)
+ printf_unfiltered ("Loaded symbols for %s\n",
+ gdb->so_name);
+ gdb->symbols_loaded = 1;
+ loaded_any_symbols = 1;
+ }
+ }
+ }
+
+ if (from_tty && pattern && ! any_matches)
+ printf_unfiltered
+ ("No loaded shared libraries match the pattern `%s'.\n", pattern);
+
+ if (loaded_any_symbols)
+ {
+ /* Getting new symbols may change our opinion about what is
+ frameless. */
+ reinit_frame_cache ();
+
+ special_symbol_handling ();
+ }
+ }
}