From 9137a6f46143a8040946749c16e7f5484c253b2e Mon Sep 17 00:00:00 2001 From: Peter Schauer Date: Sat, 24 Sep 1994 09:00:50 +0000 Subject: [PATCH] * corelow.c (add_solib_stub): Remove copying of to_sections, pass current_target to SOLIB_ADD. The Sep 10 change failed if SOLIB_ADD errored out, or if SOLIB_ADD was trying to access target memory. * corelow.c (core_open): After reading the shared libraries, copy the modified to_sections vector from current_target to core_ops, so that core_close can free it later. * config/rs6000/nm-rs6000.h, rs6000-nat.c (xcoff_relocate_core): Pass down target parameter from SOLIB_ADD and use it instead of directly accessing core_ops. --- gdb/ChangeLog | 13 +++++++++++++ gdb/corelow.c | 12 ++++++------ gdb/rs6000-nat.c | 13 +++++++------ 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3724eff..0e58d99 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +Sat Sep 24 01:47:25 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * corelow.c (add_solib_stub): Remove copying of to_sections, + pass current_target to SOLIB_ADD. The Sep 10 change failed + if SOLIB_ADD errored out, or if SOLIB_ADD was trying to access + target memory. + * corelow.c (core_open): After reading the shared libraries, + copy the modified to_sections vector from current_target to + core_ops, so that core_close can free it later. + * config/rs6000/nm-rs6000.h, rs6000-nat.c (xcoff_relocate_core): + Pass down target parameter from SOLIB_ADD and use it instead of + directly accessing core_ops. + Fri Sep 23 14:58:49 1994 J.T. Conklin (jtc@rtl.cygnus.com) * solib.c: *BSD systems need to be included before diff --git a/gdb/corelow.c b/gdb/corelow.c index a84c996..6567ead 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -79,12 +79,7 @@ static int solib_add_stub (from_ttyp) char *from_ttyp; { - SOLIB_ADD (NULL, *(int *)from_ttyp, &core_ops); - - /* SOLIB_ADD usually modifies core_ops.to_sections, which has to - be reflected in current_target. */ - current_target.to_sections = core_ops.to_sections; - current_target.to_sections_end = core_ops.to_sections_end; + SOLIB_ADD (NULL, *(int *)from_ttyp, ¤t_target); return 0; } #endif /* SOLIB_ADD */ @@ -204,6 +199,11 @@ 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 + of the to_sections vector in core_close. */ + core_ops.to_sections = current_target.to_sections; #endif /* Now, set up the frame cache, and print the top of stack */ diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c index a5615fe..8b92b6f 100644 --- a/gdb/rs6000-nat.c +++ b/gdb/rs6000-nat.c @@ -638,7 +638,8 @@ xcoff_relocate_symtab (pid) from the core file. */ void -xcoff_relocate_core () +xcoff_relocate_core (target) + struct target_ops *target; { /* Offset of member MEMBER in a struct of type TYPE. */ #ifndef offsetof @@ -731,13 +732,13 @@ xcoff_relocate_core () int count; struct section_table *stp; - count = core_ops.to_sections_end - core_ops.to_sections; + count = target->to_sections_end - target->to_sections; count += 2; - core_ops.to_sections = (struct section_table *) - xrealloc (core_ops.to_sections, + target->to_sections = (struct section_table *) + xrealloc (target->to_sections, sizeof (struct section_table) * count); - core_ops.to_sections_end = core_ops.to_sections + count; - stp = core_ops.to_sections_end - 2; + target->to_sections_end = target->to_sections + count; + stp = target->to_sections_end - 2; /* "Why do we add bfd_section_vma?", I hear you cry. Well, the start of the section in the file is actually -- 2.7.4