* corelow.c (core_open): Don't update the to_sections and
to_sections_end fields in core_ops here. It's too late. * irix5-nat.c (solib_add): Update the to_sections and to_sections_end fields in core_ops here if needed. * osfsolib.c (solib_add): Likewise. * rs6000-nat.c (xcoff_reload_core): Likewise. * solib.c (solib_add): Likewise. * somsolib.c (solib_add): Likewise.
This commit is contained in:
parent
a8958dd48b
commit
148070cca4
|
@ -1,3 +1,14 @@
|
|||
Thu Oct 12 13:36:15 1995 Jeffrey A Law (law@cygnus.com)
|
||||
|
||||
* corelow.c (core_open): Don't update the to_sections and
|
||||
to_sections_end fields in core_ops here. It's too late.
|
||||
* irix5-nat.c (solib_add): Update the to_sections and
|
||||
to_sections_end fields in core_ops here if needed.
|
||||
* osfsolib.c (solib_add): Likewise.
|
||||
* rs6000-nat.c (xcoff_reload_core): Likewise.
|
||||
* solib.c (solib_add): Likewise.
|
||||
* somsolib.c (solib_add): Likewise.
|
||||
|
||||
Wed Oct 11 17:25:59 1995 Fred Fish <fnf@rtl.cygnus.com>
|
||||
|
||||
* Makefile.in (VERSION): Bump version to 4.15.1
|
||||
|
|
|
@ -210,13 +210,6 @@ core_open (filename, from_tty)
|
|||
#ifdef SOLIB_ADD
|
||||
catch_errors (solib_add_stub, &from_tty, (char *)0,
|
||||
RETURN_MASK_ALL);
|
||||
|
||||
/* solib_add_stub usually modifies current_target.to_sections, which
|
||||
has to be reflected in core_ops to enable proper freeing of
|
||||
the to_sections vector in core_close and correct section
|
||||
mapping in xfer_memory and core_files_info. */
|
||||
core_ops.to_sections = current_target.to_sections;
|
||||
core_ops.to_sections_end = current_target.to_sections_end;
|
||||
#endif
|
||||
|
||||
/* Now, set up the frame cache, and print the top of stack. */
|
||||
|
|
|
@ -621,6 +621,13 @@ solib_add (arg_string, from_tty, target)
|
|||
|
||||
if (count)
|
||||
{
|
||||
int update_coreops;
|
||||
|
||||
/* We must update the to_sections field in the core_ops structure
|
||||
here, otherwise we dereference a potential dangling pointer
|
||||
for each call to target_read/write_memory within this routine. */
|
||||
update_coreops = core_ops.to_sections == target->to_sections;
|
||||
|
||||
/* Reallocate the target's section table including the new size. */
|
||||
if (target -> to_sections)
|
||||
{
|
||||
|
@ -637,6 +644,14 @@ solib_add (arg_string, from_tty, target)
|
|||
}
|
||||
target -> to_sections_end = target -> to_sections + (count + old);
|
||||
|
||||
/* Update the to_sections field in the core_ops structure
|
||||
if needed. */
|
||||
if (update_coreops)
|
||||
{
|
||||
core_ops.to_sections = target->to_sections;
|
||||
core_ops.to_sections_end = target->to_sections_end;
|
||||
}
|
||||
|
||||
/* Add these section table entries to the target's table. */
|
||||
while ((so = find_solib (so)) != NULL)
|
||||
{
|
||||
|
|
|
@ -625,6 +625,13 @@ solib_add (arg_string, from_tty, target)
|
|||
|
||||
if (count)
|
||||
{
|
||||
int update_coreops;
|
||||
|
||||
/* We must update the to_sections field in the core_ops structure
|
||||
here, otherwise we dereference a potential dangling pointer
|
||||
for each call to target_read/write_memory within this routine. */
|
||||
update_coreops = core_ops.to_sections == target->to_sections;
|
||||
|
||||
/* Reallocate the target's section table including the new size. */
|
||||
if (target -> to_sections)
|
||||
{
|
||||
|
@ -641,6 +648,14 @@ solib_add (arg_string, from_tty, target)
|
|||
}
|
||||
target -> to_sections_end = target -> to_sections + (count + old);
|
||||
|
||||
/* Update the to_sections field in the core_ops structure
|
||||
if needed. */
|
||||
if (update_coreops)
|
||||
{
|
||||
core_ops.to_sections = target->to_sections;
|
||||
core_ops.to_sections_end = target->to_sections_end;
|
||||
}
|
||||
|
||||
/* Add these section table entries to the target's table. */
|
||||
while ((so = find_solib (so)) != NULL)
|
||||
{
|
||||
|
|
|
@ -738,6 +738,11 @@ xcoff_relocate_core (target)
|
|||
{
|
||||
int count;
|
||||
struct section_table *stp;
|
||||
int update_coreops;
|
||||
|
||||
/* We must update the to_sections field in the core_ops structure
|
||||
now to avoid dangling pointer dereferences. */
|
||||
update_coreops = core_ops.to_sections === target->to_sections;
|
||||
|
||||
count = target->to_sections_end - target->to_sections;
|
||||
count += 2;
|
||||
|
@ -745,6 +750,14 @@ xcoff_relocate_core (target)
|
|||
xrealloc (target->to_sections,
|
||||
sizeof (struct section_table) * count);
|
||||
target->to_sections_end = target->to_sections + count;
|
||||
|
||||
/* Update the to_sections field in the core_ops structure
|
||||
if needed. */
|
||||
if (update_coreops)
|
||||
{
|
||||
core_ops.to_sections = target->to_sections;
|
||||
core_ops.to_sections_end = target->to_sections_end;
|
||||
}
|
||||
stp = target->to_sections_end - 2;
|
||||
|
||||
/* "Why do we add bfd_section_vma?", I hear you cry.
|
||||
|
|
|
@ -405,6 +405,12 @@ som_solib_add (arg_string, from_tty, target)
|
|||
if (status != 0)
|
||||
{
|
||||
int old, new;
|
||||
int update_coreops;
|
||||
|
||||
/* We must update the to_sections field in the core_ops structure
|
||||
here, otherwise we dereference a potential dangling pointer
|
||||
for each call to target_read/write_memory within this routine. */
|
||||
update_coreops = core_ops.to_sections == target->to_sections;
|
||||
|
||||
new = new_so->sections_end - new_so->sections;
|
||||
/* Add sections from the shared library to the core target. */
|
||||
|
@ -422,6 +428,16 @@ som_solib_add (arg_string, from_tty, target)
|
|||
xmalloc ((sizeof (struct section_table)) * new);
|
||||
}
|
||||
target->to_sections_end = (target->to_sections + old + new);
|
||||
|
||||
/* Update the to_sections field in the core_ops structure
|
||||
if needed. */
|
||||
if (update_coreops)
|
||||
{
|
||||
core_ops.to_sections = target->to_sections;
|
||||
core_ops.to_sections_end = target->to_sections_end;
|
||||
}
|
||||
|
||||
/* Copy over the old data before it gets clobbered. */
|
||||
memcpy ((char *)(target->to_sections + old),
|
||||
new_so->sections,
|
||||
((sizeof (struct section_table)) * new));
|
||||
|
|
Loading…
Reference in New Issue