aboutsummaryrefslogtreecommitdiff
path: root/gdb/somsolib.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>1995-03-24 06:21:44 +0000
committerJeff Law <law@redhat.com>1995-03-24 06:21:44 +0000
commit9bfed1ee346333e46c282daa787a24ebf2b8ee43 (patch)
tree51eee52c2f4be11b7ae8981a87e779746433bac4 /gdb/somsolib.c
parent91e3c246700c0d8faaab23e6e116b156471e589f (diff)
downloadgdb-9bfed1ee346333e46c282daa787a24ebf2b8ee43.zip
gdb-9bfed1ee346333e46c282daa787a24ebf2b8ee43.tar.gz
gdb-9bfed1ee346333e46c282daa787a24ebf2b8ee43.tar.bz2
* somsolib.c (som_solib_add): Handle case where a shared library
referenced by a core file has sections without the SEC_ALLOC bit set (eg stabs sections).
Diffstat (limited to 'gdb/somsolib.c')
-rw-r--r--gdb/somsolib.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/gdb/somsolib.c b/gdb/somsolib.c
index 241283b..ede2c41 100644
--- a/gdb/somsolib.c
+++ b/gdb/somsolib.c
@@ -385,30 +385,27 @@ som_solib_add (arg_string, from_tty, target)
status = target_read_memory (text_addr, buf, 4);
if (status != 0)
{
- int old;
+ int old, new;
+ new = new_so->sections_end - new_so->sections;
/* Add sections from the shared library to the core target. */
if (target->to_sections)
{
old = target->to_sections_end - target->to_sections;
target->to_sections = (struct section_table *)
xrealloc ((char *)target->to_sections,
- ((sizeof (struct section_table))
- * (old + bfd_count_sections (new_so->abfd))));
+ ((sizeof (struct section_table)) * (old + new)));
}
else
{
old = 0;
target->to_sections = (struct section_table *)
- xmalloc ((sizeof (struct section_table))
- * bfd_count_sections (new_so->abfd));
+ xmalloc ((sizeof (struct section_table)) * new);
}
- target->to_sections_end = (target->to_sections
- + old + bfd_count_sections (new_so->abfd));
+ target->to_sections_end = (target->to_sections + old + new);
memcpy ((char *)(target->to_sections + old),
new_so->sections,
- ((sizeof (struct section_table))
- * bfd_count_sections (new_so->abfd)));
+ ((sizeof (struct section_table)) * new));
}
}