summaryrefslogtreecommitdiff
path: root/gdb/exec.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-08-22 15:01:47 +0000
committerTom Tromey <tromey@redhat.com>2012-08-22 15:01:47 +0000
commit5bf42c5b7a6b35676cd5836330e3ba0b9bf98c4f (patch)
tree46f4650f4fe2033d6e0a8565f3150cea83ecddc0 /gdb/exec.c
parent25d216af65c60f4f8f0e1c6447736bac9219ff04 (diff)
downloadgdb-5bf42c5b7a6b35676cd5836330e3ba0b9bf98c4f.tar.gz
* exec.c (exec_close, exec_file_attach): Update.
(add_to_section_table): Initialize 'key' field. (add_target_sections, remove_target_sections): Add 'key' argument. * exec.h (add_target_sections, remove_target_sections): Add 'key' argument. * solib.c (solib_map_sections, update_solib_list, clear_solib) (reload_shared_libraries_1): Update. * target.h (struct target_section) <key>: New field.
Diffstat (limited to 'gdb/exec.c')
-rw-r--r--gdb/exec.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/gdb/exec.c b/gdb/exec.c
index e0766093d17..de1b0b63b50 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -107,7 +107,7 @@ exec_close (void)
exec_bfd = NULL;
exec_bfd_mtime = 0;
- remove_target_sections (abfd);
+ remove_target_sections (&exec_bfd, abfd);
}
}
@@ -284,7 +284,7 @@ exec_file_attach (char *filename, int from_tty)
/* Add the executable's sections to the current address spaces'
list of sections. This possibly pushes the exec_ops
target. */
- add_target_sections (sections, sections_end);
+ add_target_sections (&exec_bfd, sections, sections_end);
xfree (sections);
/* Tell display code (if any) about the changed file name. */
@@ -378,6 +378,7 @@ add_to_section_table (bfd *abfd, struct bfd_section *asect,
if (!(aflag & SEC_ALLOC))
return;
+ (*table_pp)->key = NULL;
(*table_pp)->bfd = abfd;
(*table_pp)->the_bfd_section = asect;
(*table_pp)->addr = bfd_section_vma (abfd, asect);
@@ -438,7 +439,8 @@ build_section_table (struct bfd *some_bfd, struct target_section **start,
current set of target sections. */
void
-add_target_sections (struct target_section *sections,
+add_target_sections (void *key,
+ struct target_section *sections,
struct target_section *sections_end)
{
int count;
@@ -449,9 +451,13 @@ add_target_sections (struct target_section *sections,
if (count > 0)
{
int space = resize_section_table (table, count);
+ int i;
- memcpy (table->sections + space,
- sections, count * sizeof (sections[0]));
+ for (i = 0; i < count; ++i)
+ {
+ table->sections[space + i] = sections[i];
+ table->sections[space + i].key = key;
+ }
/* If these are the first file sections we can provide memory
from, push the file_stratum target. */
@@ -466,14 +472,14 @@ add_target_sections (struct target_section *sections,
/* Remove all target sections taken from ABFD. */
void
-remove_target_sections (bfd *abfd)
+remove_target_sections (void *key, bfd *abfd)
{
struct target_section *src, *dest;
struct target_section_table *table = current_target_sections;
dest = table->sections;
for (src = table->sections; src < table->sections_end; src++)
- if (src->bfd != abfd)
+ if (src->key != key || src->bfd != abfd)
{
/* Keep this section. */
if (dest < src)