* 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).
This commit is contained in:
Jeff Law 1995-03-24 06:21:44 +00:00
parent 91e3c24670
commit 9bfed1ee34
2 changed files with 12 additions and 9 deletions

View File

@ -1,3 +1,9 @@
Thu Mar 23 23:20:00 1995 Jeff Law (law@snake.cs.utah.edu)
* 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).
Thu Mar 23 15:07:08 1995 Jim Kingdon (kingdon@lioth.cygnus.com) Thu Mar 23 15:07:08 1995 Jim Kingdon (kingdon@lioth.cygnus.com)
* breakpoint.c (bpstat_do_actions): For each element in the bpstat * breakpoint.c (bpstat_do_actions): For each element in the bpstat

View File

@ -385,30 +385,27 @@ som_solib_add (arg_string, from_tty, target)
status = target_read_memory (text_addr, buf, 4); status = target_read_memory (text_addr, buf, 4);
if (status != 0) 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. */ /* Add sections from the shared library to the core target. */
if (target->to_sections) if (target->to_sections)
{ {
old = target->to_sections_end - target->to_sections; old = target->to_sections_end - target->to_sections;
target->to_sections = (struct section_table *) target->to_sections = (struct section_table *)
xrealloc ((char *)target->to_sections, xrealloc ((char *)target->to_sections,
((sizeof (struct section_table)) ((sizeof (struct section_table)) * (old + new)));
* (old + bfd_count_sections (new_so->abfd))));
} }
else else
{ {
old = 0; old = 0;
target->to_sections = (struct section_table *) target->to_sections = (struct section_table *)
xmalloc ((sizeof (struct section_table)) xmalloc ((sizeof (struct section_table)) * new);
* bfd_count_sections (new_so->abfd));
} }
target->to_sections_end = (target->to_sections target->to_sections_end = (target->to_sections + old + new);
+ old + bfd_count_sections (new_so->abfd));
memcpy ((char *)(target->to_sections + old), memcpy ((char *)(target->to_sections + old),
new_so->sections, new_so->sections,
((sizeof (struct section_table)) ((sizeof (struct section_table)) * new));
* bfd_count_sections (new_so->abfd)));
} }
} }