From 2117c711ae07700adb57ea5b5ca61e4c32d7e3d2 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 13 Jan 2014 09:30:30 -0700 Subject: change delegation for to_read_description This switches to_read_description to the "new normal" delegation scheme. This one was a bit trickier than the other changes due to the way that target_read_description handled delegation. I examined all the target implementations of to_read_description and changed the ones returning NULL to instead delegate. 2014-02-19 Tom Tromey * arm-linux-nat.c (arm_linux_read_description): Delegate when needed. * corelow.c (core_read_description): Delegate when needed. * remote.c (remote_read_description): Delegate when needed. * target-delegates.c: Rebuild. * target.c (target_read_description): Rewrite. * target.h (struct target_ops) : Update comment. Use TARGET_DEFAULT_RETURN. --- gdb/target-delegates.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'gdb/target-delegates.c') diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index 0ffee5a..4585d25 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -801,6 +801,19 @@ tdefault_flash_done (struct target_ops *self) tcomplain (); } +static const struct target_desc * +delegate_read_description (struct target_ops *self) +{ + self = self->beneath; + return self->to_read_description (self); +} + +static const struct target_desc * +tdefault_read_description (struct target_ops *self) +{ + return 0; +} + static ptid_t delegate_get_ada_task_ptid (struct target_ops *self, long arg1, long arg2) { @@ -1700,6 +1713,8 @@ install_delegators (struct target_ops *ops) ops->to_flash_erase = delegate_flash_erase; if (ops->to_flash_done == NULL) ops->to_flash_done = delegate_flash_done; + if (ops->to_read_description == NULL) + ops->to_read_description = delegate_read_description; if (ops->to_get_ada_task_ptid == NULL) ops->to_get_ada_task_ptid = delegate_get_ada_task_ptid; if (ops->to_auxv_parse == NULL) @@ -1896,6 +1911,7 @@ install_dummy_methods (struct target_ops *ops) ops->to_memory_map = tdefault_memory_map; ops->to_flash_erase = tdefault_flash_erase; ops->to_flash_done = tdefault_flash_done; + ops->to_read_description = tdefault_read_description; ops->to_get_ada_task_ptid = default_get_ada_task_ptid; ops->to_auxv_parse = default_auxv_parse; ops->to_search_memory = default_search_memory; -- cgit v1.1