Patchwork [53/55] Change print_field_values to use value-based API

login
register
mail settings
Submitter Tom Tromey
Date Dec. 8, 2019, 6:29 p.m.
Message ID <20191208182958.10181-54-tom@tromey.com>
Download mbox | patch
Permalink /patch/36635/
State New
Headers show

Comments

Tom Tromey - Dec. 8, 2019, 6:29 p.m.
This converts print_field_values to use the value-based API, by having
it call common_val_print rather than val_print.

gdb/ChangeLog
2019-12-08  Tom Tromey  <tom@tromey.com>

	* ada-valprint.c (print_field_values): Call common_val_print.

Change-Id: I915def5ff4c304bafdf519356482da8cbc459fa6
---
 gdb/ChangeLog      |  4 ++++
 gdb/ada-valprint.c | 14 +++++++-------
 2 files changed, 11 insertions(+), 7 deletions(-)

Patch

diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index c83782a0760..6f69b633bd8 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -683,10 +683,7 @@  print_field_values (struct type *type, const gdb_byte *valaddr,
 		     bit_size, TYPE_FIELD_TYPE (type, i));
 	      opts = *options;
 	      opts.deref_ref = 0;
-	      val_print (TYPE_FIELD_TYPE (type, i),
-			 value_embedded_offset (v), 0,
-			 stream, recurse + 1, v,
-			 &opts, language);
+	      common_val_print (v, stream, recurse + 1, &opts, language);
 	    }
 	}
       else
@@ -694,9 +691,12 @@  print_field_values (struct type *type, const gdb_byte *valaddr,
 	  struct value_print_options opts = *options;
 
 	  opts.deref_ref = 0;
-	  val_print (TYPE_FIELD_TYPE (type, i),
-		     (offset + TYPE_FIELD_BITPOS (type, i) / HOST_CHAR_BIT),
-		     0, stream, recurse + 1, val, &opts, language);
+
+	  LONGEST local_off = (offset + TYPE_FIELD_BITPOS (type, i)
+			       / HOST_CHAR_BIT);
+	  struct value *v = value_from_contents (TYPE_FIELD_TYPE (type, i),
+						 valaddr + local_off);
+	  common_val_print (v, stream, recurse + 1, &opts, language);
 	}
       annotate_field_end ();
     }