]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/p-valprint.c
* defs.h (extract_signed_integer, extract_unsigned_integer,
[thirdparty/binutils-gdb.git] / gdb / p-valprint.c
index 30d0650f1db330d443d7c1eb7cb91737cb3979e8..50c993f840409db7605321d6de13b16795750ff6 100644 (file)
@@ -56,6 +56,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
                  struct ui_file *stream, int recurse,
                  const struct value_print_options *options)
 {
+  struct gdbarch *gdbarch = get_type_arch (type);
+  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   unsigned int i = 0;  /* Number of characters printed */
   unsigned len;
   struct type *elttype;
@@ -94,7 +96,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
                  /* Look for a NULL char. */
                  for (temp_len = 0;
                       extract_unsigned_integer (valaddr + embedded_offset +
-                                                temp_len * eltlen, eltlen)
+                                                temp_len * eltlen, eltlen,
+                                                byte_order)
                       && temp_len < len && temp_len < options->print_max;
                       temp_len++);
                  len = temp_len;
@@ -142,8 +145,9 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
          /* Print vtable entry - we only get here if we ARE using
             -fvtable_thunks.  (Otherwise, look under TYPE_CODE_STRUCT.) */
          /* Extract the address, assume that it is unsigned.  */
-         print_address_demangle (extract_unsigned_integer (valaddr + embedded_offset, TYPE_LENGTH (type)),
-                                 stream, demangle);
+         addr = extract_unsigned_integer (valaddr + embedded_offset,
+                                          TYPE_LENGTH (type), byte_order);
+         print_address_demangle (gdbarch, addr, stream, demangle);
          break;
        }
       elttype = check_typedef (TYPE_TARGET_TYPE (type));
@@ -155,14 +159,14 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
          if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
            {
              /* Try to print what function it points to.  */
-             print_address_demangle (addr, stream, demangle);
+             print_address_demangle (gdbarch, addr, stream, demangle);
              /* Return value is irrelevant except for string pointers.  */
              return (0);
            }
 
          if (options->addressprint && options->format != 's')
            {
-             fputs_filtered (paddress (addr), stream);
+             fputs_filtered (paddress (gdbarch, addr), stream);
            }
 
          /* For a pointer to char or unsigned char, also print the string
@@ -191,7 +195,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
               void *buffer;
               buffer = xmalloc (length_size);
               read_memory (addr + length_pos, buffer, length_size);
-             string_length = extract_unsigned_integer (buffer, length_size);
+             string_length = extract_unsigned_integer (buffer, length_size,
+                                                       byte_order);
               xfree (buffer);
               i = val_print_string (char_type ,addr + string_pos, string_length, stream, options);
            }
@@ -254,7 +259,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
          CORE_ADDR addr
            = extract_typed_address (valaddr + embedded_offset, type);
          fprintf_filtered (stream, "@");
-         fputs_filtered (paddress (addr), stream);
+          fputs_filtered (paddress (gdbarch, addr), stream);
          if (options->deref_ref)
            fputs_filtered (": ", stream);
        }
@@ -290,8 +295,9 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
             -fvtable_thunks.  (Otherwise, look under TYPE_CODE_PTR.) */
          /* Extract the address, assume that it is unsigned.  */
          print_address_demangle
-           (extract_unsigned_integer (valaddr + embedded_offset + TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8,
-                                      TYPE_LENGTH (TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET))),
+           (gdbarch,
+            extract_unsigned_integer (valaddr + embedded_offset + TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8,
+                                      TYPE_LENGTH (TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET)), byte_order),
             stream, demangle);
        }
       else
@@ -299,7 +305,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
           if (is_pascal_string_type (type, &length_pos, &length_size,
                                      &string_pos, &char_type, NULL))
            {
-             len = extract_unsigned_integer (valaddr + embedded_offset + length_pos, length_size);
+             len = extract_unsigned_integer (valaddr + embedded_offset + length_pos, length_size, byte_order);
              LA_PRINT_STRING (stream, char_type, valaddr + embedded_offset + string_pos, len, 0, options);
            }
          else
@@ -356,7 +362,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
       type_print (type, "", stream, -1);
       fprintf_filtered (stream, "} ");
       /* Try to print what function it points to, and its address.  */
-      print_address_demangle (address, stream, demangle);
+      print_address_demangle (gdbarch, address, stream, demangle);
       break;
 
     case TYPE_CODE_BOOL: