Wrong value printed by info locals for dynamic object.
[deliverable/binutils-gdb.git] / gdb / valprint.c
index 3f21ae4617a3a45d930eed651be4d66ec59b8a36..d6ecc04741fdf934fe6d5d405b395861ecc3223b 100644 (file)
@@ -35,6 +35,7 @@
 #include "exceptions.h"
 #include "dfp.h"
 #include "python/python.h"
+#include "ada-lang.h"
 
 #include <errno.h>
 
@@ -361,6 +362,13 @@ common_val_print (struct value *val, struct ui_file *stream, int recurse,
   if (!value_check_printable (val, stream))
     return 0;
 
+  if (language->la_language == language_ada)
+    /* The value might have a dynamic type, which would cause trouble
+       below when trying to extract the value contents (since the value
+       size is determined from the type size which is unknown).  So
+       get a fixed representation of our value.  */
+    val = ada_to_fixed_value (val);
+
   return val_print (value_type (val), value_contents_all (val),
                    value_embedded_offset (val), value_address (val),
                    stream, recurse, options, language);
This page took 0.023653 seconds and 4 git commands to generate.