summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/binutils
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2008-09-16 19:59:51 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2008-09-16 19:59:51 +0000
commite4f59a8a37c28c3de3c481cf0a3cbf79c557b5b7 (patch)
tree1f30b75ba88e215ca6348c5399bbdceaf7053c6c /gnu/usr.bin/binutils
parenta2576e00952250b7829946bc40bcf23768502974 (diff)
Add support for reading ELF auxilliary vectors.
ok kurt@
Diffstat (limited to 'gnu/usr.bin/binutils')
-rw-r--r--gnu/usr.bin/binutils/gdb/auxv.c13
-rw-r--r--gnu/usr.bin/binutils/gdb/inf-ptrace.c17
2 files changed, 24 insertions, 6 deletions
diff --git a/gnu/usr.bin/binutils/gdb/auxv.c b/gnu/usr.bin/binutils/gdb/auxv.c
index a2516b68528..b8e5adb6eee 100644
--- a/gnu/usr.bin/binutils/gdb/auxv.c
+++ b/gnu/usr.bin/binutils/gdb/auxv.c
@@ -121,19 +121,20 @@ int
target_auxv_parse (struct target_ops *ops, char **readptr, char *endptr,
CORE_ADDR *typep, CORE_ADDR *valp)
{
- const int sizeof_auxv_field = TYPE_LENGTH (builtin_type_void_data_ptr);
+ const int sizeof_auxv_type = TYPE_LENGTH (builtin_type_int);
+ const int sizeof_auxv_val = TYPE_LENGTH (builtin_type_void_data_ptr);
char *ptr = *readptr;
if (endptr == ptr)
return 0;
- if (endptr - ptr < sizeof_auxv_field * 2)
+ if (endptr - ptr < (sizeof_auxv_type + sizeof_auxv_val))
return -1;
- *typep = extract_unsigned_integer (ptr, sizeof_auxv_field);
- ptr += sizeof_auxv_field;
- *valp = extract_unsigned_integer (ptr, sizeof_auxv_field);
- ptr += sizeof_auxv_field;
+ *typep = extract_unsigned_integer (ptr, sizeof_auxv_type);
+ ptr += sizeof_auxv_val; /* Alignment. */
+ *valp = extract_unsigned_integer (ptr, sizeof_auxv_val);
+ ptr += sizeof_auxv_val;
*readptr = ptr;
return 1;
diff --git a/gnu/usr.bin/binutils/gdb/inf-ptrace.c b/gnu/usr.bin/binutils/gdb/inf-ptrace.c
index f2f6d276dd2..f1fcc437f60 100644
--- a/gnu/usr.bin/binutils/gdb/inf-ptrace.c
+++ b/gnu/usr.bin/binutils/gdb/inf-ptrace.c
@@ -552,6 +552,23 @@ inf_ptrace_xfer_partial (struct target_ops *ops, enum target_object object,
return -1;
case TARGET_OBJECT_AUXV:
+#if defined (PT_IO) && defined (PIOD_READ_AUXV)
+ {
+ struct ptrace_io_desc piod;
+
+ if (writebuf)
+ return -1;
+ piod.piod_op = PIOD_READ_AUXV;
+ piod.piod_addr = readbuf;
+ piod.piod_offs = (void *) (long) offset;
+ piod.piod_len = len;
+
+ errno = 0;
+ if (ptrace (PT_IO, pid, (caddr_t)&piod, 0) == 0)
+ /* Return the actual number of bytes read or written. */
+ return piod.piod_len;
+ }
+#endif
return -1;
case TARGET_OBJECT_WCOOKIE: