2008-11-12 Tristan Gingold <gingold@adacore.com>
[binutils-gdb.git] / gdb / auxv.c
index 0baec1a7bf77a67d4e2b4354ceee534679fd9e83..121a7497311349da492c559fc4994d088d0968c8 100644 (file)
@@ -82,7 +82,8 @@ int
 default_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
                   gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
 {
-  const int sizeof_auxv_field = TYPE_LENGTH (builtin_type_void_data_ptr);
+  const int sizeof_auxv_field = gdbarch_ptr_bit (target_gdbarch)
+                               / TARGET_CHAR_BIT;
   gdb_byte *ptr = *readptr;
 
   if (endptr == ptr)
@@ -171,7 +172,6 @@ fprint_target_auxv (struct ui_file *file, struct target_ops *ops)
 
   while (target_auxv_parse (ops, &ptr, data + len, &type, &val) > 0)
     {
-      extern int addressprint;
       const char *name = "???";
       const char *description = "";
       enum { dec, hex, str } flavor = hex;
@@ -239,10 +239,14 @@ fprint_target_auxv (struct ui_file *file, struct target_ops *ops)
          fprintf_filtered (file, "0x%s\n", paddr_nz (val));
          break;
        case str:
-         if (addressprint)
-           fprintf_filtered (file, "0x%s", paddr_nz (val));
-         val_print_string (val, -1, 1, file);
-         fprintf_filtered (file, "\n");
+         {
+           struct value_print_options opts;
+           get_user_print_options (&opts);
+           if (opts.addressprint)
+             fprintf_filtered (file, "0x%s", paddr_nz (val));
+           val_print_string (val, -1, 1, file, &opts);
+           fprintf_filtered (file, "\n");
+         }
          break;
        }
       ++ents;