mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-30 17:31:13 +08:00
convert to_thread_address_space to use TARGET_DEFAULT_FUNC
This converts to_thread_address_space to use TARGET_DEFAULT_FUNC. This method was one of a handful not using the normal target delegation approach. The only rationale here is consistency in the target vector. Built and regtested on x86-64 Fedora 20. 2014-06-04 Tom Tromey <tromey@redhat.com> * target-delegates.c: Rebuild. * target.c (default_thread_address_space): New function. (target_thread_address_space): Simplify. * target.h (struct target_ops) <to_thread_address_space>: Add TARGET_DEFAULT_FUNC.
This commit is contained in:
@ -1,3 +1,11 @@
|
|||||||
|
2014-06-04 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
* target-delegates.c: Rebuild.
|
||||||
|
* target.c (default_thread_address_space): New function.
|
||||||
|
(target_thread_address_space): Simplify.
|
||||||
|
* target.h (struct target_ops) <to_thread_address_space>: Add
|
||||||
|
TARGET_DEFAULT_FUNC.
|
||||||
|
|
||||||
2014-06-04 Doug Evans <xdje42@gmail.com>
|
2014-06-04 Doug Evans <xdje42@gmail.com>
|
||||||
|
|
||||||
* guile/scm-type.c (type_smob): Remove duplicate typedef.
|
* guile/scm-type.c (type_smob): Remove duplicate typedef.
|
||||||
|
@ -945,6 +945,13 @@ delegate_thread_architecture (struct target_ops *self, ptid_t arg1)
|
|||||||
return self->to_thread_architecture (self, arg1);
|
return self->to_thread_architecture (self, arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct address_space *
|
||||||
|
delegate_thread_address_space (struct target_ops *self, ptid_t arg1)
|
||||||
|
{
|
||||||
|
self = self->beneath;
|
||||||
|
return self->to_thread_address_space (self, arg1);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
delegate_trace_init (struct target_ops *self)
|
delegate_trace_init (struct target_ops *self)
|
||||||
{
|
{
|
||||||
@ -1782,6 +1789,8 @@ install_delegators (struct target_ops *ops)
|
|||||||
ops->to_can_run_breakpoint_commands = delegate_can_run_breakpoint_commands;
|
ops->to_can_run_breakpoint_commands = delegate_can_run_breakpoint_commands;
|
||||||
if (ops->to_thread_architecture == NULL)
|
if (ops->to_thread_architecture == NULL)
|
||||||
ops->to_thread_architecture = delegate_thread_architecture;
|
ops->to_thread_architecture = delegate_thread_architecture;
|
||||||
|
if (ops->to_thread_address_space == NULL)
|
||||||
|
ops->to_thread_address_space = delegate_thread_address_space;
|
||||||
if (ops->to_trace_init == NULL)
|
if (ops->to_trace_init == NULL)
|
||||||
ops->to_trace_init = delegate_trace_init;
|
ops->to_trace_init = delegate_trace_init;
|
||||||
if (ops->to_download_tracepoint == NULL)
|
if (ops->to_download_tracepoint == NULL)
|
||||||
@ -1974,6 +1983,7 @@ install_dummy_methods (struct target_ops *ops)
|
|||||||
ops->to_supports_evaluation_of_breakpoint_conditions = tdefault_supports_evaluation_of_breakpoint_conditions;
|
ops->to_supports_evaluation_of_breakpoint_conditions = tdefault_supports_evaluation_of_breakpoint_conditions;
|
||||||
ops->to_can_run_breakpoint_commands = tdefault_can_run_breakpoint_commands;
|
ops->to_can_run_breakpoint_commands = tdefault_can_run_breakpoint_commands;
|
||||||
ops->to_thread_architecture = default_thread_architecture;
|
ops->to_thread_architecture = default_thread_architecture;
|
||||||
|
ops->to_thread_address_space = default_thread_address_space;
|
||||||
ops->to_trace_init = tdefault_trace_init;
|
ops->to_trace_init = tdefault_trace_init;
|
||||||
ops->to_download_tracepoint = tdefault_download_tracepoint;
|
ops->to_download_tracepoint = tdefault_download_tracepoint;
|
||||||
ops->to_can_download_tracepoint = tdefault_can_download_tracepoint;
|
ops->to_can_download_tracepoint = tdefault_can_download_tracepoint;
|
||||||
|
46
gdb/target.c
46
gdb/target.c
@ -78,6 +78,9 @@ static int default_verify_memory (struct target_ops *self,
|
|||||||
const gdb_byte *data,
|
const gdb_byte *data,
|
||||||
CORE_ADDR memaddr, ULONGEST size);
|
CORE_ADDR memaddr, ULONGEST size);
|
||||||
|
|
||||||
|
static struct address_space *default_thread_address_space
|
||||||
|
(struct target_ops *self, ptid_t ptid);
|
||||||
|
|
||||||
static void tcomplain (void) ATTRIBUTE_NORETURN;
|
static void tcomplain (void) ATTRIBUTE_NORETURN;
|
||||||
|
|
||||||
static int return_zero (struct target_ops *);
|
static int return_zero (struct target_ops *);
|
||||||
@ -2610,30 +2613,10 @@ target_get_osdata (const char *type)
|
|||||||
return target_read_stralloc (t, TARGET_OBJECT_OSDATA, type);
|
return target_read_stralloc (t, TARGET_OBJECT_OSDATA, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Determine the current address space of thread PTID. */
|
static struct address_space *
|
||||||
|
default_thread_address_space (struct target_ops *self, ptid_t ptid)
|
||||||
struct address_space *
|
|
||||||
target_thread_address_space (ptid_t ptid)
|
|
||||||
{
|
{
|
||||||
struct address_space *aspace;
|
|
||||||
struct inferior *inf;
|
struct inferior *inf;
|
||||||
struct target_ops *t;
|
|
||||||
|
|
||||||
for (t = current_target.beneath; t != NULL; t = t->beneath)
|
|
||||||
{
|
|
||||||
if (t->to_thread_address_space != NULL)
|
|
||||||
{
|
|
||||||
aspace = t->to_thread_address_space (t, ptid);
|
|
||||||
gdb_assert (aspace);
|
|
||||||
|
|
||||||
if (targetdebug)
|
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
|
||||||
"target_thread_address_space (%s) = %d\n",
|
|
||||||
target_pid_to_str (ptid),
|
|
||||||
address_space_num (aspace));
|
|
||||||
return aspace;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fall-back to the "main" address space of the inferior. */
|
/* Fall-back to the "main" address space of the inferior. */
|
||||||
inf = find_inferior_pid (ptid_get_pid (ptid));
|
inf = find_inferior_pid (ptid_get_pid (ptid));
|
||||||
@ -2647,6 +2630,25 @@ target_thread_address_space (ptid_t ptid)
|
|||||||
return inf->aspace;
|
return inf->aspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Determine the current address space of thread PTID. */
|
||||||
|
|
||||||
|
struct address_space *
|
||||||
|
target_thread_address_space (ptid_t ptid)
|
||||||
|
{
|
||||||
|
struct address_space *aspace;
|
||||||
|
|
||||||
|
aspace = current_target.to_thread_address_space (¤t_target, ptid);
|
||||||
|
gdb_assert (aspace != NULL);
|
||||||
|
|
||||||
|
if (targetdebug)
|
||||||
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
|
"target_thread_address_space (%s) = %d\n",
|
||||||
|
target_pid_to_str (ptid),
|
||||||
|
address_space_num (aspace));
|
||||||
|
|
||||||
|
return aspace;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Target file operations. */
|
/* Target file operations. */
|
||||||
|
|
||||||
|
@ -772,7 +772,8 @@ struct target_ops
|
|||||||
The default implementation always returns the inferior's
|
The default implementation always returns the inferior's
|
||||||
address space. */
|
address space. */
|
||||||
struct address_space *(*to_thread_address_space) (struct target_ops *,
|
struct address_space *(*to_thread_address_space) (struct target_ops *,
|
||||||
ptid_t);
|
ptid_t)
|
||||||
|
TARGET_DEFAULT_FUNC (default_thread_address_space);
|
||||||
|
|
||||||
/* Target file operations. */
|
/* Target file operations. */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user