From 94baabdb95e49b23d08a54c9c2d90b657bd0bc33 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Thu, 1 Jun 2006 20:03:30 +0000 Subject: * 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. --- ChangeLog.csl | 11 +++++++++++ gdb/Makefile.in | 2 +- gdb/exec.c | 13 ++++++++++--- gdb/objfiles.c | 6 ++++++ gdb/remote.c | 6 ++++++ 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,3 +1,14 @@ +2006-06-01 Daniel Jacobowitz + + * 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 * gdb/remote.c (remote_download_command): Use FILEIO_O_TRUNC. 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); -- cgit v1.2.1