]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* gdb/exec.c (exec_set_section_address): Always update the
authorDaniel Jacobowitz <drow@false.org>
Thu, 1 Jun 2006 20:03:30 +0000 (20:03 +0000)
committerDaniel Jacobowitz <drow@false.org>
Thu, 1 Jun 2006 20:03:30 +0000 (20:03 +0000)
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
gdb/Makefile.in
gdb/exec.c
gdb/objfiles.c
gdb/remote.c

index 0958cc2c1a7a98a8a85490c4ea16a79aa9a2a34f..a34a21de6a7218f1a0a74d1c780739a9648a6531 100644 (file)
@@ -1,3 +1,14 @@
+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.
index c70993964824e7689b27ead28460f3825a1599a3..c3f8b4a9eaaf096fe3b243a41d0e722e7bd3afe5 100644 (file)
@@ -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)
index a919442632c1a11bc45c129912ac691fb2f4af86..ebd534c36c407e7649dd7b26821b54b9bea40904 100644 (file)
@@ -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;
        }
     }
 }
index 3419c6dfa2dacff24c25456a0c84a6ac6a68405d..bee81a695b6306a9e890b5653b8ab88a5bfae437 100644 (file)
@@ -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);
       }
   }
 
index a1341d7197dde17440f34ca92103cfb96ef9dadb..70fb27ee96e04cedaa329d3e16ba18ba3a130ac3 100644 (file)
@@ -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);