aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-12-18 14:47:06 -0700
committerTom Tromey <tromey@redhat.com>2014-02-19 07:48:16 -0700
commit7e35c012fb79ca35105f0d1b299014adef61be88 (patch)
tree77d3c39f06d58637328e98837cd9746fe42337eb /gdb
parent770234d33bd301dd1893457a90e4b02cfec5c87a (diff)
downloadgdb-7e35c012fb79ca35105f0d1b299014adef61be88.zip
gdb-7e35c012fb79ca35105f0d1b299014adef61be88.tar.gz
gdb-7e35c012fb79ca35105f0d1b299014adef61be88.tar.bz2
convert to_get_section_table
2014-02-19 Tom Tromey <tromey@redhat.com> * target-delegates.c: Rebuild. * target.c (target_get_section_table): Unconditionally delegate. * target.h (struct target_ops) <to_get_section_table>: 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.c8
-rw-r--r--gdb/target.h3
4 files changed, 26 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2512cbc..c9b2017 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_get_section_table): Unconditionally delegate.
+ * target.h (struct target_ops) <to_get_section_table>: Use
+ TARGET_DEFAULT_RETURN.
+
+2014-02-19 Tom Tromey <tromey@redhat.com>
+
+ * target-delegates.c: Rebuild.
* target.c (target_pid_to_str): Unconditionally delegate.
(init_dummy_target): Don't initialize to_pid_to_str.
(default_pid_to_str): Rename from dummy_pid_to_str.
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index fe827fa..03e0030 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -630,6 +630,19 @@ tdefault_log_command (struct target_ops *self, const char *arg1)
{
}
+static struct target_section_table *
+delegate_get_section_table (struct target_ops *self)
+{
+ self = self->beneath;
+ return self->to_get_section_table (self);
+}
+
+static struct target_section_table *
+tdefault_get_section_table (struct target_ops *self)
+{
+ return 0;
+}
+
static int
delegate_can_async_p (struct target_ops *self)
{
@@ -1319,6 +1332,8 @@ install_delegators (struct target_ops *ops)
ops->to_pid_to_exec_file = delegate_pid_to_exec_file;
if (ops->to_log_command == NULL)
ops->to_log_command = delegate_log_command;
+ if (ops->to_get_section_table == NULL)
+ ops->to_get_section_table = delegate_get_section_table;
if (ops->to_can_async_p == NULL)
ops->to_can_async_p = delegate_can_async_p;
if (ops->to_is_async_p == NULL)
@@ -1474,6 +1489,7 @@ install_dummy_methods (struct target_ops *ops)
ops->to_rcmd = default_rcmd;
ops->to_pid_to_exec_file = tdefault_pid_to_exec_file;
ops->to_log_command = tdefault_log_command;
+ ops->to_get_section_table = tdefault_get_section_table;
ops->to_can_async_p = find_default_can_async_p;
ops->to_is_async_p = find_default_is_async_p;
ops->to_async = tdefault_async;
diff --git a/gdb/target.c b/gdb/target.c
index 53a8e2b..a639861 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -1088,16 +1088,10 @@ done:
struct target_section_table *
target_get_section_table (struct target_ops *target)
{
- struct target_ops *t;
-
if (targetdebug)
fprintf_unfiltered (gdb_stdlog, "target_get_section_table ()\n");
- for (t = target; t != NULL; t = t->beneath)
- if (t->to_get_section_table != NULL)
- return (*t->to_get_section_table) (t);
-
- return NULL;
+ return (*target->to_get_section_table) (target);
}
/* Find a section containing ADDR. */
diff --git a/gdb/target.h b/gdb/target.h
index 29d210a..38046eb 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -576,7 +576,8 @@ struct target_ops
TARGET_DEFAULT_RETURN (0);
void (*to_log_command) (struct target_ops *, const char *)
TARGET_DEFAULT_IGNORE ();
- struct target_section_table *(*to_get_section_table) (struct target_ops *);
+ struct target_section_table *(*to_get_section_table) (struct target_ops *)
+ TARGET_DEFAULT_RETURN (0);
enum strata to_stratum;
int (*to_has_all_memory) (struct target_ops *);
int (*to_has_memory) (struct target_ops *);