diff options
-rw-r--r-- | gnu/usr.bin/binutils/gdb/auxv.c | 13 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/gdb/inf-ptrace.c | 17 |
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: |