aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-12-19 07:47:11 -0700
committerTom Tromey <tromey@redhat.com>2014-02-19 07:48:32 -0700
commit6b2c5a57e10ca3d9021ef6fe27ba779a06f06717 (patch)
treea451de1fae90ee2ee0ce9af1597952df2ab22a27 /gdb
parentcbffc065273e91d3596dc73bad695a815f67d5fa (diff)
downloadgdb-6b2c5a57e10ca3d9021ef6fe27ba779a06f06717.zip
gdb-6b2c5a57e10ca3d9021ef6fe27ba779a06f06717.tar.gz
gdb-6b2c5a57e10ca3d9021ef6fe27ba779a06f06717.tar.bz2
convert to_memory_map
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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/target-delegates.c16
-rw-r--r--gdb/target.c9
-rw-r--r--gdb/target.h3
4 files changed, 26 insertions, 9 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 363536d..c174974 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,6 +1,13 @@
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.
* target.c (target_thread_alive): Unconditionally delegate.
* target.h (struct target_ops) <to_thread_alive>: Use
TARGET_DEFAULT_RETURN.
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index 0da855a..209ecb7 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -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;
diff --git a/gdb/target.c b/gdb/target.c
index d59cea8..38012cc 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -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;
diff --git a/gdb/target.h b/gdb/target.h
index ecfd1a2..e6e78e1 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -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.