[Ada] Make sure we pass the correct struct value to val_print & co.

Pedro Alves pedro@codesourcery.com
Mon Jan 24 20:36:00 GMT 2011


Another patch touching Ada bits.

This makes sure that we pass in the the correct struct value to
val_print & co, because val_print functions need to consult
the value for meta-data about the value contents, such the
value_bits_valid calls, and with later changes, a function
that checks whether contents at a given offset are "available".

This fixes a few cases in the Ada val_print routines I had
caught by inspection.

No regressions on gdb.ada/, FWIW.  Okay to apply?

-- 
Pedro Alves

2011-01-24  Pedro Alves  <pedro@codesourcery.com>

	* ada-valprint.c (val_print_packed_array_elements): Pass the
	correct struct value to val_print.
	(ada_val_print_1): Ditto.

---
 gdb/ada-valprint.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Index: src/gdb/ada-valprint.c
===================================================================
--- src.orig/gdb/ada-valprint.c	2011-01-24 18:44:19.000000000 +0000
+++ src/gdb/ada-valprint.c	2011-01-24 20:13:07.677639998 +0000
@@ -211,7 +211,7 @@ val_print_packed_array_elements (struct
 	  opts.deref_ref = 0;
 	  val_print (elttype, value_contents_for_printing (v0),
 		     value_embedded_offset (v0), 0, stream,
-		     recurse + 1, val, &opts, current_language);
+		     recurse + 1, v0, &opts, current_language);
 	  annotate_elt_rep (i - i0);
 	  fprintf_filtered (stream, _(" <repeats %u times>"), i - i0);
 	  annotate_elt_rep_end ();
@@ -242,7 +242,7 @@ val_print_packed_array_elements (struct
 		}
 	      val_print (elttype, value_contents_for_printing (v0),
 			 value_embedded_offset (v0), 0, stream,
-			 recurse + 1, val, &opts, current_language);
+			 recurse + 1, v0, &opts, current_language);
 	      annotate_elt ();
 	    }
 	}
@@ -708,7 +708,7 @@ ada_val_print_1 (struct type *type, cons
 				value_contents_for_printing (val),
 				value_embedded_offset (val),
 				value_address (val), stream, recurse,
-				NULL, options);
+				val, options);
       value_free_to_mark (mark);
       return retn;
     }
@@ -770,7 +770,7 @@ ada_val_print_1 (struct type *type, cons
 	      return ada_val_print_1 (target_type,
 				      value_contents_for_printing (v),
 				      value_embedded_offset (v), 0,
- 				      stream, recurse + 1, NULL, options);
+ 				      stream, recurse + 1, v, options);
 	    }
 	  else
 	    return ada_val_print_1 (TYPE_TARGET_TYPE (type),
@@ -915,7 +915,7 @@ ada_val_print_1 (struct type *type, cons
                          value_contents_for_printing (deref_val),
                          value_embedded_offset (deref_val),
                          value_address (deref_val), stream, recurse + 1,
-			 original_value, options, current_language);
+			 deref_val, options, current_language);
             }
           else
             fputs_filtered ("(null)", stream);



More information about the Gdb-patches mailing list