ld/testsuite/
[deliverable/binutils-gdb.git] / gdb / cp-valprint.c
index 181b4ffb5b841206155cdb60dea2778370b28fdf..49d71a4480a3170da0890add3b44e448310a60a2 100644 (file)
@@ -36,6 +36,7 @@
 #include "valprint.h"
 #include "cp-support.h"
 #include "language.h"
+#include "python/python.h"
 
 /* Controls printing of vtbl's */
 static void
@@ -418,12 +419,27 @@ cp_print_value (struct type *type, struct type *real_type,
       if (skip >= 1)
        fprintf_filtered (stream, "<invalid address>");
       else
-       cp_print_value_fields (baseclass, thistype, base_valaddr,
-                              thisoffset + boffset, address + boffset,
-                              stream, recurse, options,
-                              ((struct type **)
-                               obstack_base (&dont_print_vb_obstack)),
-                              0);
+       {
+         int result = 0;
+
+         /* Attempt to run the Python pretty-printers on the
+            baseclass if possible.  */
+         if (!options->raw)
+           result = apply_val_pretty_printer (baseclass, base_valaddr,
+                                              thisoffset + boffset,
+                                              address + boffset,
+                                              stream, recurse,
+                                              options,
+                                              current_language);
+                 
+         if (!result)
+           cp_print_value_fields (baseclass, thistype, base_valaddr,
+                                  thisoffset + boffset, address + boffset,
+                                  stream, recurse, options,
+                                  ((struct type **)
+                                   obstack_base (&dont_print_vb_obstack)),
+                                  0);
+       }
       fputs_filtered (", ", stream);
 
     flush_it:
@@ -548,13 +564,17 @@ void
 cp_print_class_member (const gdb_byte *valaddr, struct type *type,
                       struct ui_file *stream, char *prefix)
 {
+  enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
+
   /* VAL is a byte offset into the structure type DOMAIN.
      Find the name of the field for that offset and
      print it.  */
   struct type *domain = TYPE_DOMAIN_TYPE (type);
-  LONGEST val = extract_signed_integer (valaddr, TYPE_LENGTH (type));
+  LONGEST val;
   unsigned int fieldno;
 
+  val = extract_signed_integer (valaddr, TYPE_LENGTH (type), byte_order);
+
   /* Pointers to data members are usually byte offsets into an object.
      Because a data member can have offset zero, and a NULL pointer to
      member must be distinct from any valid non-NULL pointer to
This page took 0.024032 seconds and 4 git commands to generate.