* defs.h (extract_signed_integer, extract_unsigned_integer,
[deliverable/binutils-gdb.git] / gdb / auxv.c
index 3a51ec58ce916ac6b49bede473e66aca128da5da..7b4ecbe2bc8fdef4061fc8c18c52b8ffba1baaf9 100644 (file)
 #include <fcntl.h>
 
 
-/* This function is called like a to_xfer_partial hook,
-   but must be called with TARGET_OBJECT_AUXV.
-   It handles access via /proc/PID/auxv, which is the common method.
-   This function is appropriate for doing:
-          #define NATIVE_XFER_AUXV     procfs_xfer_auxv
-   for a native target that uses inftarg.c's child_xfer_partial hook.  */
+/* This function is called like a to_xfer_partial hook, but must be
+   called with TARGET_OBJECT_AUXV.  It handles access via
+   /proc/PID/auxv, which is a common method for native targets.  */
 
 LONGEST
 procfs_xfer_auxv (struct target_ops *ops,
-                 int /* enum target_object */ object,
+                 enum target_object object,
                  const char *annex,
                  gdb_byte *readbuf,
                  const gdb_byte *writebuf,
@@ -85,6 +82,7 @@ default_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
 {
   const int sizeof_auxv_field = gdbarch_ptr_bit (target_gdbarch)
                                / TARGET_CHAR_BIT;
+  const enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
   gdb_byte *ptr = *readptr;
 
   if (endptr == ptr)
@@ -93,9 +91,9 @@ default_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
   if (endptr - ptr < sizeof_auxv_field * 2)
     return -1;
 
-  *typep = extract_unsigned_integer (ptr, sizeof_auxv_field);
+  *typep = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
   ptr += sizeof_auxv_field;
-  *valp = extract_unsigned_integer (ptr, sizeof_auxv_field);
+  *valp = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
   ptr += sizeof_auxv_field;
 
   *readptr = ptr;
@@ -240,14 +238,14 @@ fprint_target_auxv (struct ui_file *file, struct target_ops *ops)
          fprintf_filtered (file, "%s\n", plongest (val));
          break;
        case hex:
-         fprintf_filtered (file, "0x%s\n", paddr_nz (val));
+         fprintf_filtered (file, "%s\n", paddress (target_gdbarch, val));
          break;
        case str:
          {
            struct value_print_options opts;
            get_user_print_options (&opts);
            if (opts.addressprint)
-             fprintf_filtered (file, "0x%s", paddr_nz (val));
+             fprintf_filtered (file, "%s", paddress (target_gdbarch, val));
            val_print_string (builtin_type (target_gdbarch)->builtin_char,
                              val, -1, file, &opts);
            fprintf_filtered (file, "\n");
This page took 0.026622 seconds and 4 git commands to generate.