mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 12:23:31 +08:00
Deal with the inferior unloading shared objects.
* solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
This commit is contained in:
@ -1,3 +1,44 @@
|
|||||||
|
2000-03-15 Jim Blandy <jimb@redhat.com>
|
||||||
|
|
||||||
|
Deal with the inferior unloading shared objects.
|
||||||
|
* solib.c (current_sos): New function, replacing find_solib.
|
||||||
|
(find_solib): Deleted.
|
||||||
|
(free_so): New function.
|
||||||
|
(clear_solib): Call free_so, instead of writing it out.
|
||||||
|
(solib_add): Rewritten: compare the inferior's current list of
|
||||||
|
shared objects with GDB's list, and do the required loads and
|
||||||
|
unloads.
|
||||||
|
(info_sharedlibrary_command, solib_address): Don't use find_solib
|
||||||
|
to walk the list of shared libraries: call solib_add, and then
|
||||||
|
walk the list at so_list_head normally.
|
||||||
|
* objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't
|
||||||
|
detach the core target. These tasks are taken care of elsewhere.
|
||||||
|
* target.c (remove_target_sections): New function.
|
||||||
|
* target.h (remove_target_sections): New declaration.
|
||||||
|
|
||||||
|
* solib.c (symbol_add_stub): Check whether we've already created
|
||||||
|
an objfile for this shared object first, before doing all that
|
||||||
|
work to compute section addresses, etc.
|
||||||
|
|
||||||
|
* objfiles.c (unlink_objfile): Report an internal error if objfile
|
||||||
|
doesn't occur in the object_files list.
|
||||||
|
|
||||||
|
* solib.c (special_symbol_handling): Delete argument; it's not
|
||||||
|
used.
|
||||||
|
|
||||||
|
Changes from Peter Schauer <pes@regent.e-technik.tu-muenchen.de>:
|
||||||
|
|
||||||
|
* solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses
|
||||||
|
from solib structures. Use it throughout solib.c, get rid of all
|
||||||
|
CORE_ADDR casts.
|
||||||
|
(struct so_list): Change type of lmaddr to CORE_ADDR.
|
||||||
|
(first_link_map_member): Change return value type to CORE_ADDR,
|
||||||
|
update callers.
|
||||||
|
(solib_add_common_symbols): Change parameter type to CORE_ADDR,
|
||||||
|
update callers.
|
||||||
|
(open_symbol_file_object, find_solib): Change type of lm variable
|
||||||
|
to CORE_ADDR.
|
||||||
|
|
||||||
2000-03-15 Eli Zaretskii <eliz@is.elta.co.il>
|
2000-03-15 Eli Zaretskii <eliz@is.elta.co.il>
|
||||||
|
|
||||||
* ser-go32.c (dos_noop, dos_raw, dos_noflush_set_tty_state)
|
* ser-go32.c (dos_noop, dos_raw, dos_noflush_set_tty_state)
|
||||||
|
@ -370,9 +370,11 @@ unlink_objfile (objfile)
|
|||||||
{
|
{
|
||||||
*objpp = (*objpp)->next;
|
*objpp = (*objpp)->next;
|
||||||
objfile->next = NULL;
|
objfile->next = NULL;
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal_error ("objfiles.c (unlink_objfile): objfile already unlinked");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -436,17 +438,6 @@ free_objfile (objfile)
|
|||||||
is unknown, but we play it safe for now and keep each action until
|
is unknown, but we play it safe for now and keep each action until
|
||||||
it is shown to be no longer needed. */
|
it is shown to be no longer needed. */
|
||||||
|
|
||||||
#if defined (CLEAR_SOLIB)
|
|
||||||
CLEAR_SOLIB ();
|
|
||||||
/* CLEAR_SOLIB closes the bfd's for any shared libraries. But
|
|
||||||
the to_sections for a core file might refer to those bfd's. So
|
|
||||||
detach any core file. */
|
|
||||||
{
|
|
||||||
struct target_ops *t = find_core_target ();
|
|
||||||
if (t != NULL)
|
|
||||||
(t->to_detach) (NULL, 0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/* I *think* all our callers call clear_symtab_users. If so, no need
|
/* I *think* all our callers call clear_symtab_users. If so, no need
|
||||||
to call this here. */
|
to call this here. */
|
||||||
clear_pc_function_cache ();
|
clear_pc_function_cache ();
|
||||||
|
743
gdb/solib.c
743
gdb/solib.c
File diff suppressed because it is too large
Load Diff
33
gdb/target.c
33
gdb/target.c
@ -1325,6 +1325,39 @@ target_resize_to_sections (struct target_ops *target, int num_added)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Remove all target sections taken from ABFD.
|
||||||
|
|
||||||
|
Scan the current target stack for targets whose section tables
|
||||||
|
refer to sections from BFD, and remove those sections. We use this
|
||||||
|
when we notice that the inferior has unloaded a shared object, for
|
||||||
|
example. */
|
||||||
|
void
|
||||||
|
remove_target_sections (bfd *abfd)
|
||||||
|
{
|
||||||
|
struct target_ops **t;
|
||||||
|
|
||||||
|
for (t = target_structs; t < target_structs + target_struct_size; t++)
|
||||||
|
{
|
||||||
|
struct section_table *src, *dest;
|
||||||
|
|
||||||
|
dest = (*t)->to_sections;
|
||||||
|
for (src = (*t)->to_sections; src < (*t)->to_sections_end; src++)
|
||||||
|
if (src->bfd != abfd)
|
||||||
|
{
|
||||||
|
/* Keep this section. */
|
||||||
|
if (dest < src) *dest = *src;
|
||||||
|
dest++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If we've dropped any sections, resize the section table. */
|
||||||
|
if (dest < src)
|
||||||
|
target_resize_to_sections (*t, dest - src);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Find a single runnable target in the stack and return it. If for
|
/* Find a single runnable target in the stack and return it. If for
|
||||||
some reason there is more than one, return NULL. */
|
some reason there is more than one, return NULL. */
|
||||||
|
|
||||||
|
@ -1377,6 +1377,9 @@ find_target_beneath PARAMS ((struct target_ops *));
|
|||||||
|
|
||||||
extern int
|
extern int
|
||||||
target_resize_to_sections PARAMS ((struct target_ops *target, int num_added));
|
target_resize_to_sections PARAMS ((struct target_ops *target, int num_added));
|
||||||
|
|
||||||
|
extern void remove_target_sections (bfd *abfd);
|
||||||
|
|
||||||
|
|
||||||
/* Stuff that should be shared among the various remote targets. */
|
/* Stuff that should be shared among the various remote targets. */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user