aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-10-24 20:24:06 +0000
committerAndrew Cagney <cagney@redhat.com>2003-10-24 20:24:06 +0000
commitb6591e8b14ec22b0fbd707b14af4a09bf310c5ae (patch)
tree2429e713002ef114f5e1327106cada67493db974 /gdb/target.c
parentae7dc4d82ba293db9a4e945db7c7213f88731f37 (diff)
downloadgdb-b6591e8b14ec22b0fbd707b14af4a09bf310c5ae.zip
gdb-b6591e8b14ec22b0fbd707b14af4a09bf310c5ae.tar.gz
gdb-b6591e8b14ec22b0fbd707b14af4a09bf310c5ae.tar.bz2
2003-10-24 Andrew Cagney <cagney@redhat.com>
* target.c: Include "gdbcore.h". (get_target_memory, get_target_memory_unsigned): New functions. * target.h (get_target_memory, get_target_memory_unsigned): Declare. * ppc-linux-tdep.c (ppc64_linux_convert_from_func_ptr_addr): Use get_target_memory_unsigned. * Makefile.in (target.o): Update dependencies.
Diffstat (limited to 'gdb/target.c')
-rw-r--r--gdb/target.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gdb/target.c b/gdb/target.c
index 6a520b1..e99d947 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -37,6 +37,7 @@
#include <signal.h>
#include "regcache.h"
#include "gdb_assert.h"
+#include "gdbcore.h"
static void target_info (char *, int);
@@ -1214,6 +1215,28 @@ target_write (struct target_ops *ops,
return len;
}
+/* Memory transfer methods. */
+
+void
+get_target_memory (struct target_ops *ops, CORE_ADDR addr, void *buf,
+ LONGEST len)
+{
+ if (target_read (ops, TARGET_OBJECT_MEMORY, NULL, buf, addr, len)
+ != len)
+ memory_error (EIO, addr);
+}
+
+ULONGEST
+get_target_memory_unsigned (struct target_ops *ops,
+ CORE_ADDR addr, int len)
+{
+ char buf[sizeof (ULONGEST)];
+
+ gdb_assert (len <= sizeof (buf));
+ get_target_memory (ops, addr, buf, len);
+ return extract_unsigned_integer (buf, len);
+}
+
static void
target_info (char *args, int from_tty)
{