aboutsummaryrefslogtreecommitdiff
path: root/gdb/rs6000-nat.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>1995-10-12 23:26:06 +0000
committerJeff Law <law@redhat.com>1995-10-12 23:26:06 +0000
commit148070cca4cf7e1b1b7f81835e9ec9991f1895ef (patch)
treefc5e0c036682acf0eb6bc18a0978c752fe8e5a82 /gdb/rs6000-nat.c
parenta8958dd48be372e5b3004c61729071c36f8717a0 (diff)
downloadgdb-148070cca4cf7e1b1b7f81835e9ec9991f1895ef.zip
gdb-148070cca4cf7e1b1b7f81835e9ec9991f1895ef.tar.gz
gdb-148070cca4cf7e1b1b7f81835e9ec9991f1895ef.tar.bz2
* 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.
Diffstat (limited to 'gdb/rs6000-nat.c')
-rw-r--r--gdb/rs6000-nat.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index 996cba9..e6e90ee 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -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.