summaryrefslogtreecommitdiff
path: root/gdb/exec.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <dan@debian.org>2005-06-13 16:15:40 +0000
committerDaniel Jacobowitz <dan@debian.org>2005-06-13 16:15:40 +0000
commit2c7d0587d9b790f2c61ad23918385965df9fd964 (patch)
tree5121d2b0cbcd8f2da6f0535586f6e08c03c88d73 /gdb/exec.c
parentb240d68d1c18adfc6cbf04a432a5e89bcad3e927 (diff)
downloadgdb-2c7d0587d9b790f2c61ad23918385965df9fd964.tar.gz
gdb/
* Makefile.in (symfile.o): Add $(exec_h). * exec.h (exec_set_section_address): Add prototype. * exec.c (exec_set_section_address): New function. * symfile.c: Include "exec.h". (struct place_section_arg, place_section): New. (default_symfile_offsets): Call place_section for each section of a relocatable file. gdb/testsuite/ * gdb.base/relocate.c: Add a copyright notice. (dummy): Remove. * gdb.base/relocate.exp: Test printing the values of variables from a relocatable file.
Diffstat (limited to 'gdb/exec.c')
-rw-r--r--gdb/exec.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gdb/exec.c b/gdb/exec.c
index 938b106adef..60e3b36ae3c 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -670,6 +670,27 @@ set_section_command (char *args, int from_tty)
error (_("Section %s not found"), secprint);
}
+/* If we can find a section in FILENAME with BFD index INDEX, and the
+ user has not assigned an address to it yet (via "set section"), adjust it
+ to ADDRESS. */
+
+void
+exec_set_section_address (const char *filename, int index, CORE_ADDR address)
+{
+ struct section_table *p;
+
+ for (p = exec_ops.to_sections; p < exec_ops.to_sections_end; p++)
+ {
+ if (strcmp (filename, p->bfd->filename) == 0
+ && index == p->the_bfd_section->index
+ && p->addr == 0)
+ {
+ p->addr = address;
+ p->endaddr += address;
+ }
+ }
+}
+
/* If mourn is being called in all the right places, this could be say
`gdb internal error' (since generic_mourn calls
breakpoint_init_inferior). */