summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jacobowitz <dan@debian.org>2006-06-01 20:03:30 +0000
committerDaniel Jacobowitz <dan@debian.org>2006-06-01 20:03:30 +0000
commit94baabdb95e49b23d08a54c9c2d90b657bd0bc33 (patch)
treee9e442fd9305934d7b01523045616ba5c8fb1a92
parent59bb0ebdb7b4d9edf2819a86ee23cf42003b8fcb (diff)
downloadgdb-94baabdb95e49b23d08a54c9c2d90b657bd0bc33.tar.gz
* gdb/exec.c (exec_set_section_address): Always update the
section's address. * gdb/objfiles.c (objfile_relocate): Also relocate the target sections table. * gdb/Makefile.in (objfiles.o): Update. * gdb/remote.c (remote_xfer_partial): Fail if the target is not running.
-rw-r--r--ChangeLog.csl11
-rw-r--r--gdb/Makefile.in2
-rw-r--r--gdb/exec.c13
-rw-r--r--gdb/objfiles.c6
-rw-r--r--gdb/remote.c6
5 files changed, 34 insertions, 4 deletions
diff --git a/ChangeLog.csl b/ChangeLog.csl
index 0958cc2c1a7..a34a21de6a7 100644
--- a/ChangeLog.csl
+++ b/ChangeLog.csl
@@ -1,5 +1,16 @@
2006-06-01 Daniel Jacobowitz <dan@codesourcery.com>
+ * gdb/exec.c (exec_set_section_address): Always update the
+ section's address.
+ * gdb/objfiles.c (objfile_relocate): Also relocate the
+ target sections table.
+ * gdb/Makefile.in (objfiles.o): Update.
+
+ * gdb/remote.c (remote_xfer_partial): Fail if the target is not
+ running.
+
+2006-06-01 Daniel Jacobowitz <dan@codesourcery.com>
+
* gdb/remote.c (remote_download_command): Use FILEIO_O_TRUNC.
2006-06-01 Daniel Jacobowitz <dan@codesourcery.com>
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index c7099396482..c3f8b4a9eaa 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2417,7 +2417,7 @@ objc-lang.o: objc-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
$(objfiles_h) $(gdb_string_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) \
$(frame_h) $(gdb_regex_h) $(regcache_h) $(block_h) $(infcall_h) \
$(valprint_h) $(gdb_assert_h)
-objfiles.o: objfiles.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \
+objfiles.o: objfiles.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) $(exec_h) \
$(objfiles_h) $(gdb_stabs_h) $(target_h) $(bcache_h) $(mdebugread_h) \
$(gdb_assert_h) $(gdb_stat_h) $(gdb_obstack_h) $(gdb_string_h) \
$(hashtab_h) $(breakpoint_h) $(block_h) $(dictionary_h)
diff --git a/gdb/exec.c b/gdb/exec.c
index a919442632c..ebd534c36c4 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -674,12 +674,19 @@ exec_set_section_address (const char *filename, int index, CORE_ADDR address)
for (p = exec_ops.to_sections; p < exec_ops.to_sections_end; p++)
{
+ /* FIXME drow/2006-06-01: This used to say "&& p->addr == 0".
+ But that messes up multiple qOffsets responses relocating an
+ executable; the previous relocated value doesn't matter.
+ Removing it makes qOffsets attempt to override "set section".
+ There should be a user-specified flag - or else we should
+ just use the objfile's sections, or something like that.
+
+ This deserves more thought before a merge to mainline. */
if (strcmp (filename, p->bfd->filename) == 0
- && index == p->the_bfd_section->index
- && p->addr == 0)
+ && index == p->the_bfd_section->index)
{
+ p->endaddr += address - p->addr;
p->addr = address;
- p->endaddr += address;
}
}
}
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 3419c6dfa2d..bee81a695b6 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -27,6 +27,7 @@
#include "defs.h"
#include "bfd.h" /* Binary File Description */
+#include "exec.h"
#include "symtab.h"
#include "symfile.h"
#include "objfiles.h"
@@ -652,6 +653,11 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
s->addr += ANOFFSET (delta, idx);
s->endaddr += ANOFFSET (delta, idx);
+
+ /* FIXME: The exec file uses a completely different table from
+ any objfile, unfortunately. A nice improvement would
+ be to unify those. */
+ exec_set_section_address (bfd_get_filename (abfd), idx, s->addr);
}
}
diff --git a/gdb/remote.c b/gdb/remote.c
index a1341d7197d..70fb27ee96e 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -5652,6 +5652,12 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object,
int xfered;
errno = 0;
+ /* If the remote target is connected but not running, we should
+ pass this request down to a lower stratum (e.g. the executable
+ file). */
+ if (!target_has_execution)
+ return 0;
+
if (writebuf != NULL)
{
void *buffer = xmalloc (len);