]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
convert to_memory_map
authorTom Tromey <tromey@redhat.com>
Thu, 19 Dec 2013 14:47:11 +0000 (07:47 -0700)
committerTom Tromey <tromey@redhat.com>
Wed, 19 Feb 2014 14:48:32 +0000 (07:48 -0700)
2014-02-19  Tom Tromey  <tromey@redhat.com>

* target-delegates.c: Rebuild.
* target.c (target_memory_map): Unconditionally delegate.
* target.h (struct target_ops) <to_memory_map>: Use
TARGET_DEFAULT_RETURN.

gdb/ChangeLog
gdb/target-delegates.c
gdb/target.c
gdb/target.h

index 363536da61a4639f04e4c7af1ccdffe92bcb8ae4..c174974593dd6231f11c7bbcb295558632fe336d 100644 (file)
@@ -1,3 +1,10 @@
+2014-02-19  Tom Tromey  <tromey@redhat.com>
+
+       * target-delegates.c: Rebuild.
+       * target.c (target_memory_map): Unconditionally delegate.
+       * target.h (struct target_ops) <to_memory_map>: Use
+       TARGET_DEFAULT_RETURN.
+
 2014-02-19  Tom Tromey  <tromey@redhat.com>
 
        * target-delegates.c: Rebuild.
index 0da855aabab33c5089c07f9c6ec96e2d6b446bfb..209ecb72c3f277c9303c2b28ac6e1d8aa898c6f2 100644 (file)
@@ -736,6 +736,19 @@ tdefault_xfer_partial (struct target_ops *self, enum target_object  arg1, const
   return TARGET_XFER_E_IO;
 }
 
+static VEC(mem_region_s) *
+delegate_memory_map (struct target_ops *self)
+{
+  self = self->beneath;
+  return self->to_memory_map (self);
+}
+
+static VEC(mem_region_s) *
+tdefault_memory_map (struct target_ops *self)
+{
+  return 0;
+}
+
 static void
 delegate_flash_erase (struct target_ops *self, ULONGEST arg1, LONGEST arg2)
 {
@@ -1573,6 +1586,8 @@ install_delegators (struct target_ops *ops)
     ops->to_goto_bookmark = delegate_goto_bookmark;
   if (ops->to_xfer_partial == NULL)
     ops->to_xfer_partial = delegate_xfer_partial;
+  if (ops->to_memory_map == NULL)
+    ops->to_memory_map = delegate_memory_map;
   if (ops->to_flash_erase == NULL)
     ops->to_flash_erase = delegate_flash_erase;
   if (ops->to_flash_done == NULL)
@@ -1754,6 +1769,7 @@ install_dummy_methods (struct target_ops *ops)
   ops->to_get_bookmark = tdefault_get_bookmark;
   ops->to_goto_bookmark = tdefault_goto_bookmark;
   ops->to_xfer_partial = tdefault_xfer_partial;
+  ops->to_memory_map = tdefault_memory_map;
   ops->to_flash_erase = tdefault_flash_erase;
   ops->to_flash_done = tdefault_flash_done;
   ops->to_get_ada_task_ptid = default_get_ada_task_ptid;
index d59cea8c2347376a1a42cf5906571eb2f346841e..38012ccf4a7e2f8920ece585de90ae5a77d2212e 100644 (file)
@@ -1719,14 +1719,7 @@ target_memory_map (void)
   if (targetdebug)
     fprintf_unfiltered (gdb_stdlog, "target_memory_map ()\n");
 
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
-    if (t->to_memory_map != NULL)
-      break;
-
-  if (t == NULL)
-    return NULL;
-
-  result = t->to_memory_map (t);
+  result = current_target.to_memory_map (&current_target);
   if (result == NULL)
     return NULL;
 
index ecfd1a2d338800f4a8d10e37c17c4b047e5dbad6..e6e78e17d8a7ddf8be64bbec893b10be0bbf3fdb 100644 (file)
@@ -669,7 +669,8 @@ struct target_ops
        This method should not cache data; if the memory map could
        change unexpectedly, it should be invalidated, and higher
        layers will re-fetch it.  */
-    VEC(mem_region_s) *(*to_memory_map) (struct target_ops *);
+    VEC(mem_region_s) *(*to_memory_map) (struct target_ops *)
+      TARGET_DEFAULT_RETURN (0);
 
     /* Erases the region of flash memory starting at ADDRESS, of
        length LENGTH.