diff options
author | Tom Tromey <tromey@redhat.com> | 2013-12-18 14:55:06 -0700 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2014-02-19 07:48:18 -0700 |
commit | 9e538d0d0bebe3230940a820c6ec1016f0795899 (patch) | |
tree | 89f3c763b28e06e36849a4d18915c87c17ef4f01 /gdb | |
parent | f6fb29258bb410c212c7bcbc48fb1f715bfd3839 (diff) | |
download | gdb-9e538d0d0bebe3230940a820c6ec1016f0795899.zip gdb-9e538d0d0bebe3230940a820c6ec1016f0795899.tar.gz gdb-9e538d0d0bebe3230940a820c6ec1016f0795899.tar.bz2 |
convert to_core_of_thread
2014-02-19 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (target_core_of_thread): Unconditionally delegate.
* target.h (struct target_ops) <to_core_of_thread>: Use
TARGET_DEFAULT_RETURN.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/target-delegates.c | 16 | ||||
-rw-r--r-- | gdb/target.c | 22 | ||||
-rw-r--r-- | gdb/target.h | 3 |
4 files changed, 31 insertions, 17 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 56e62e0..7c489a9 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_core_of_thread): Unconditionally delegate. + * target.h (struct target_ops) <to_core_of_thread>: Use + TARGET_DEFAULT_RETURN. + +2014-02-19 Tom Tromey <tromey@redhat.com> + + * target-delegates.c: Rebuild. * target.c (target_flash_done): Unconditionally delegate. * target.h (struct target_ops) <to_flash_done>: Use TARGET_DEFAULT_NORETURN. diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index 94117b8..2c7ab7f 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -1132,6 +1132,19 @@ tdefault_set_trace_notes (struct target_ops *self, const char *arg1, const char } static int +delegate_core_of_thread (struct target_ops *self, ptid_t arg1) +{ + self = self->beneath; + return self->to_core_of_thread (self, arg1); +} + +static int +tdefault_core_of_thread (struct target_ops *self, ptid_t arg1) +{ + return -1; +} + +static int delegate_get_tib_address (struct target_ops *self, ptid_t arg1, CORE_ADDR *arg2) { self = self->beneath; @@ -1442,6 +1455,8 @@ install_delegators (struct target_ops *ops) ops->to_set_trace_buffer_size = delegate_set_trace_buffer_size; if (ops->to_set_trace_notes == NULL) ops->to_set_trace_notes = delegate_set_trace_notes; + if (ops->to_core_of_thread == NULL) + ops->to_core_of_thread = delegate_core_of_thread; if (ops->to_get_tib_address == NULL) ops->to_get_tib_address = delegate_get_tib_address; if (ops->to_set_permissions == NULL) @@ -1561,6 +1576,7 @@ install_dummy_methods (struct target_ops *ops) ops->to_set_circular_trace_buffer = tdefault_set_circular_trace_buffer; ops->to_set_trace_buffer_size = tdefault_set_trace_buffer_size; ops->to_set_trace_notes = tdefault_set_trace_notes; + ops->to_core_of_thread = tdefault_core_of_thread; ops->to_get_tib_address = tdefault_get_tib_address; ops->to_set_permissions = tdefault_set_permissions; ops->to_static_tracepoint_marker_at = tdefault_static_tracepoint_marker_at; diff --git a/gdb/target.c b/gdb/target.c index d96f706..5f86c4e 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -3711,23 +3711,13 @@ target_store_registers (struct regcache *regcache, int regno) int target_core_of_thread (ptid_t ptid) { - struct target_ops *t; - - for (t = current_target.beneath; t != NULL; t = t->beneath) - { - if (t->to_core_of_thread != NULL) - { - int retval = t->to_core_of_thread (t, ptid); - - if (targetdebug) - fprintf_unfiltered (gdb_stdlog, - "target_core_of_thread (%d) = %d\n", - ptid_get_pid (ptid), retval); - return retval; - } - } + int retval = current_target.to_core_of_thread (¤t_target, ptid); - return -1; + if (targetdebug) + fprintf_unfiltered (gdb_stdlog, + "target_core_of_thread (%d) = %d\n", + ptid_get_pid (ptid), retval); + return retval; } int diff --git a/gdb/target.h b/gdb/target.h index cb0bed2..0a6c467 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -933,7 +933,8 @@ struct target_ops If the core cannot be determined -- either for the specified thread, or right now, or in this debug session, or for this target -- return -1. */ - int (*to_core_of_thread) (struct target_ops *, ptid_t ptid); + int (*to_core_of_thread) (struct target_ops *, ptid_t ptid) + TARGET_DEFAULT_RETURN (-1); /* Verify that the memory in the [MEMADDR, MEMADDR+SIZE) range matches the contents of [DATA,DATA+SIZE). Returns 1 if there's |