2013-07-22 Doug Evans <dje@google.com>
gdb/ * exec.h (remove_target_sections): Delete arg abfd. * exec.c (remove_target_sections): Delete arg abfd. (exec_close): Update call to remove_target_sections. * solib.c (update_solib_list): Ditto. (reload_shared_libraries_1): Ditto. (clear_solib): Ditto, and unconditionally call remove_target_sections.
This commit is contained in:
parent
632a40b341
commit
046ac79fc7
5 changed files with 31 additions and 19 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2013-07-22 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
|
* exec.h (remove_target_sections): Delete arg abfd.
|
||||||
|
* exec.c (remove_target_sections): Delete arg abfd.
|
||||||
|
(exec_close): Update call to remove_target_sections.
|
||||||
|
* solib.c (update_solib_list): Ditto.
|
||||||
|
(reload_shared_libraries_1): Ditto.
|
||||||
|
(clear_solib): Ditto, and unconditionally call remove_target_sections.
|
||||||
|
|
||||||
2013-07-22 Tom Tromey <tromey@redhat.com>
|
2013-07-22 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
* solib-som.c (som_open_symbol_file_object): Call do_cleanups.
|
* solib-som.c (som_open_symbol_file_object): Call do_cleanups.
|
||||||
|
|
17
gdb/exec.c
17
gdb/exec.c
|
@ -101,7 +101,7 @@ exec_close (void)
|
||||||
exec_bfd = NULL;
|
exec_bfd = NULL;
|
||||||
exec_bfd_mtime = 0;
|
exec_bfd_mtime = 0;
|
||||||
|
|
||||||
remove_target_sections (&exec_bfd, abfd);
|
remove_target_sections (&exec_bfd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +339,7 @@ add_to_section_table (bfd *abfd, struct bfd_section *asect,
|
||||||
if (!(aflag & SEC_ALLOC))
|
if (!(aflag & SEC_ALLOC))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
(*table_pp)->key = NULL;
|
(*table_pp)->owner = NULL;
|
||||||
(*table_pp)->the_bfd_section = asect;
|
(*table_pp)->the_bfd_section = asect;
|
||||||
(*table_pp)->addr = bfd_section_vma (abfd, asect);
|
(*table_pp)->addr = bfd_section_vma (abfd, asect);
|
||||||
(*table_pp)->endaddr = (*table_pp)->addr + bfd_section_size (abfd, asect);
|
(*table_pp)->endaddr = (*table_pp)->addr + bfd_section_size (abfd, asect);
|
||||||
|
@ -397,7 +397,7 @@ build_section_table (struct bfd *some_bfd, struct target_section **start,
|
||||||
current set of target sections. */
|
current set of target sections. */
|
||||||
|
|
||||||
void
|
void
|
||||||
add_target_sections (void *key,
|
add_target_sections (void *owner,
|
||||||
struct target_section *sections,
|
struct target_section *sections,
|
||||||
struct target_section *sections_end)
|
struct target_section *sections_end)
|
||||||
{
|
{
|
||||||
|
@ -414,7 +414,7 @@ add_target_sections (void *key,
|
||||||
for (i = 0; i < count; ++i)
|
for (i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
table->sections[space + i] = sections[i];
|
table->sections[space + i] = sections[i];
|
||||||
table->sections[space + i].key = key;
|
table->sections[space + i].owner = owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If these are the first file sections we can provide memory
|
/* If these are the first file sections we can provide memory
|
||||||
|
@ -427,17 +427,20 @@ add_target_sections (void *key,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove all target sections taken from ABFD. */
|
/* Remove all target sections owned by OWNER.
|
||||||
|
OWNER must be the same value passed to add_target_sections. */
|
||||||
|
|
||||||
void
|
void
|
||||||
remove_target_sections (void *key, bfd *abfd)
|
remove_target_sections (void *owner)
|
||||||
{
|
{
|
||||||
struct target_section *src, *dest;
|
struct target_section *src, *dest;
|
||||||
struct target_section_table *table = current_target_sections;
|
struct target_section_table *table = current_target_sections;
|
||||||
|
|
||||||
|
gdb_assert (owner != NULL);
|
||||||
|
|
||||||
dest = table->sections;
|
dest = table->sections;
|
||||||
for (src = table->sections; src < table->sections_end; src++)
|
for (src = table->sections; src < table->sections_end; src++)
|
||||||
if (src->key != key || src->the_bfd_section->owner != abfd)
|
if (src->owner != owner)
|
||||||
{
|
{
|
||||||
/* Keep this section. */
|
/* Keep this section. */
|
||||||
if (dest < src)
|
if (dest < src)
|
||||||
|
|
|
@ -81,14 +81,14 @@ extern int section_table_xfer_memory_partial (gdb_byte *, const gdb_byte *,
|
||||||
/* Set the loaded address of a section. */
|
/* Set the loaded address of a section. */
|
||||||
extern void exec_set_section_address (const char *, int, CORE_ADDR);
|
extern void exec_set_section_address (const char *, int, CORE_ADDR);
|
||||||
|
|
||||||
/* Remove all target sections taken from ABFD. */
|
/* Remove all target sections owned by OWNER. */
|
||||||
|
|
||||||
extern void remove_target_sections (void *key, bfd *abfd);
|
extern void remove_target_sections (void *owner);
|
||||||
|
|
||||||
/* Add the sections array defined by [SECTIONS..SECTIONS_END[ to the
|
/* Add the sections array defined by [SECTIONS..SECTIONS_END[ to the
|
||||||
current set of target sections. */
|
current set of target sections. */
|
||||||
|
|
||||||
extern void add_target_sections (void *key,
|
extern void add_target_sections (void *owner,
|
||||||
struct target_section *sections,
|
struct target_section *sections,
|
||||||
struct target_section *sections_end);
|
struct target_section *sections_end);
|
||||||
|
|
||||||
|
|
|
@ -770,7 +770,7 @@ update_solib_list (int from_tty, struct target_ops *target)
|
||||||
|
|
||||||
/* Some targets' section tables might be referring to
|
/* Some targets' section tables might be referring to
|
||||||
sections from so->abfd; remove them. */
|
sections from so->abfd; remove them. */
|
||||||
remove_target_sections (gdb, gdb->abfd);
|
remove_target_sections (gdb);
|
||||||
|
|
||||||
free_so (gdb);
|
free_so (gdb);
|
||||||
gdb = *gdb_link;
|
gdb = *gdb_link;
|
||||||
|
@ -1151,8 +1151,7 @@ clear_solib (void)
|
||||||
|
|
||||||
so_list_head = so->next;
|
so_list_head = so->next;
|
||||||
observer_notify_solib_unloaded (so);
|
observer_notify_solib_unloaded (so);
|
||||||
if (so->abfd)
|
remove_target_sections (so);
|
||||||
remove_target_sections (so, so->abfd);
|
|
||||||
free_so (so);
|
free_so (so);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1276,7 +1275,7 @@ reload_shared_libraries_1 (int from_tty)
|
||||||
if (so->objfile && ! (so->objfile->flags & OBJF_USERLOADED)
|
if (so->objfile && ! (so->objfile->flags & OBJF_USERLOADED)
|
||||||
&& !solib_used (so))
|
&& !solib_used (so))
|
||||||
free_objfile (so->objfile);
|
free_objfile (so->objfile);
|
||||||
remove_target_sections (so, so->abfd);
|
remove_target_sections (so);
|
||||||
clear_so (so);
|
clear_so (so);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
11
gdb/target.h
11
gdb/target.h
|
@ -1902,11 +1902,12 @@ struct target_section
|
||||||
|
|
||||||
struct bfd_section *the_bfd_section;
|
struct bfd_section *the_bfd_section;
|
||||||
|
|
||||||
/* A given BFD may appear multiple times in the target section
|
/* The "owner" of the section.
|
||||||
list, so each BFD is associated with a given key. The key is
|
It can be any unique value. It is set by add_target_sections
|
||||||
just some convenient pointer that can be used to differentiate
|
and used by remove_target_sections.
|
||||||
the BFDs. These are managed only by convention. */
|
For example, for executables it is a pointer to exec_bfd and
|
||||||
void *key;
|
for shlibs it is the so_list pointer. */
|
||||||
|
void *owner;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Holds an array of target sections. Defined by [SECTIONS..SECTIONS_END[. */
|
/* Holds an array of target sections. Defined by [SECTIONS..SECTIONS_END[. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue