diff options
author | Jason Molenda <jsm@bugshack.cygnus.com> | 1999-09-28 21:55:21 +0000 |
---|---|---|
committer | Jason Molenda <jsm@bugshack.cygnus.com> | 1999-09-28 21:55:21 +0000 |
commit | c804ebc6d614890872b82978a0fef56dd8f77537 (patch) | |
tree | 0f7a7c0fd623babd70e332a27e9608eeb97eea00 /gdb/pa64solib.c | |
parent | 78bdd6a4c9dc0f87410d89504862768c3556db31 (diff) | |
download | gdb-c804ebc6d614890872b82978a0fef56dd8f77537.tar.gz |
import gdb-1999-09-28 snapshot
Diffstat (limited to 'gdb/pa64solib.c')
-rw-r--r-- | gdb/pa64solib.c | 45 |
1 files changed, 4 insertions, 41 deletions
diff --git a/gdb/pa64solib.c b/gdb/pa64solib.c index b0b4645d29f..414e5b82743 100644 --- a/gdb/pa64solib.c +++ b/gdb/pa64solib.c @@ -357,49 +357,12 @@ pa64_solib_load_symbols (so, name, from_tty, text_addr, target) status = target_read_memory (text_addr, buf, 4); if (status != 0) { - int old, new; - int update_coreops; - int update_execops; - - /* 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; - - /* Ditto exec_ops (this was a bug). */ - update_execops = exec_ops.to_sections == target->to_sections; - + int new, old; + new = so->sections_end - 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 + new))); - } - else - { - old = 0; - target->to_sections = (struct section_table *) - 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, ditto exec_ops. */ - if (update_coreops) - { - core_ops.to_sections = target->to_sections; - core_ops.to_sections_end = target->to_sections_end; - } - - if (update_execops) - { - exec_ops.to_sections = target->to_sections; - exec_ops.to_sections_end = target->to_sections_end; - } + old = target_resize_to_sections (target, new); + /* Copy over the old data before it gets clobbered. */ memcpy ((char *) (target->to_sections + old), so->sections, |