aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2014-02-21 10:33:42 -0700
committerTom Tromey <tromey@redhat.com>2014-06-04 09:24:27 -0600
commit8eaff7cd138d8517f8c2fbc8be9b8c6eaf649bd9 (patch)
tree93cb713503e1e533b60619692d6529ed82bfca18 /gdb/target.c
parent03388bb71c1a1d1c613bb963f3d9287cfd100138 (diff)
downloadgdb-8eaff7cd138d8517f8c2fbc8be9b8c6eaf649bd9.zip
gdb-8eaff7cd138d8517f8c2fbc8be9b8c6eaf649bd9.tar.gz
gdb-8eaff7cd138d8517f8c2fbc8be9b8c6eaf649bd9.tar.bz2
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.
Diffstat (limited to 'gdb/target.c')
-rw-r--r--gdb/target.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/gdb/target.c b/gdb/target.c
index cb154ab..f73ab3c 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -78,6 +78,9 @@ static int default_verify_memory (struct target_ops *self,
const gdb_byte *data,
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 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);
}
-/* Determine the current address space of thread PTID. */
-
-struct address_space *
-target_thread_address_space (ptid_t ptid)
+static struct address_space *
+default_thread_address_space (struct target_ops *self, ptid_t ptid)
{
- struct address_space *aspace;
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. */
inf = find_inferior_pid (ptid_get_pid (ptid));
@@ -2647,6 +2630,25 @@ target_thread_address_space (ptid_t ptid)
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 (&current_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. */