aboutsummaryrefslogtreecommitdiff
path: root/gdb/exec.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-08-22 15:01:50 +0000
committerTom Tromey <tromey@redhat.com>2012-08-22 15:01:50 +0000
commited9eebafbc78ba83d01230609016411c065b499f (patch)
treeed52a3d18d8812f9f5c7c91cf5be9c8cf5731867 /gdb/exec.c
parentb4893d482803eb1c4241ff751193fdcf0bf6650c (diff)
downloadgdb-ed9eebafbc78ba83d01230609016411c065b499f.zip
gdb-ed9eebafbc78ba83d01230609016411c065b499f.tar.gz
gdb-ed9eebafbc78ba83d01230609016411c065b499f.tar.bz2
* 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 e076609..de1b0b6 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)