aboutsummaryrefslogtreecommitdiff
path: root/gdb/solib.c
diff options
context:
space:
mode:
authorNicholas Duffek <nsd@redhat.com>2001-05-26 00:55:11 +0000
committerNicholas Duffek <nsd@redhat.com>2001-05-26 00:55:11 +0000
commitb41be06e3b079256b5bbdfbdb98eb0a6eec6a6a7 (patch)
treeb6223adb5d258b27f50fafe1c86b5f323574abb0 /gdb/solib.c
parenta1cd19081de1772276b58b6edd9fa0f0abafb0c4 (diff)
downloadgdb-b41be06e3b079256b5bbdfbdb98eb0a6eec6a6a7.zip
gdb-b41be06e3b079256b5bbdfbdb98eb0a6eec6a6a7.tar.gz
gdb-b41be06e3b079256b5bbdfbdb98eb0a6eec6a6a7.tar.bz2
* solib.c (update_solib_list): Move target_resize_to_sections()
into solib_map_sections() loop. (info_sharedlibrary_command): Try bfd_arch_bits_per_address() if bfd_get_arch_size() fails.
Diffstat (limited to 'gdb/solib.c')
-rw-r--r--gdb/solib.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/gdb/solib.c b/gdb/solib.c
index 370f814..8a5a904 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -461,30 +461,20 @@ update_solib_list (int from_tty, struct target_ops *target)
catch_errors (solib_map_sections, i,
"Error while mapping shared library sections:\n",
RETURN_MASK_ALL);
- }
-
- /* If requested, add the shared objects' sections to the the
- TARGET's section table. */
- if (target)
- {
- int new_sections;
- /* Figure out how many sections we'll need to add in total. */
- new_sections = 0;
- for (i = inferior; i; i = i->next)
- new_sections += (i->sections_end - i->sections);
-
- if (new_sections > 0)
+ /* If requested, add the shared object's sections to the TARGET's
+ section table. Do this immediately after mapping the object so
+ that later nodes in the list can query this object, as is needed
+ in solib-osf.c. */
+ if (target)
{
- int space = target_resize_to_sections (target, new_sections);
-
- for (i = inferior; i; i = i->next)
+ int count = (i->sections_end - i->sections);
+ if (count > 0)
{
- int count = (i->sections_end - i->sections);
+ int space = target_resize_to_sections (target, count);
memcpy (target->to_sections + space,
i->sections,
count * sizeof (i->sections[0]));
- space += count;
}
}
}
@@ -605,7 +595,10 @@ info_sharedlibrary_command (char *ignore, int from_tty)
}
arch_size = bfd_get_arch_size (exec_bfd);
- /* Default to 32-bit in case of failure (non-elf). */
+ if (arch_size == -1)
+ arch_size = bfd_arch_bits_per_address(exec_bfd);
+
+ /* Default to 32-bit in case of failure. */
if (arch_size == 32 || arch_size == -1)
{
addr_width = 8 + 4;