aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-valprint.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@adacore.com>2015-04-01 15:46:54 -0700
committerJoel Brobecker <brobecker@adacore.com>2015-05-05 10:46:12 -0700
commit62c67f3c1a10e4082641bafb7e7fd80c93b526b4 (patch)
tree9dc732360059b79b7465430bcb267f7175324406 /gdb/ada-valprint.c
parentc3345124196f9d0439db35c16b5d24d1a305ccdd (diff)
downloadgdb-62c67f3c1a10e4082641bafb7e7fd80c93b526b4.zip
gdb-62c67f3c1a10e4082641bafb7e7fd80c93b526b4.tar.gz
gdb-62c67f3c1a10e4082641bafb7e7fd80c93b526b4.tar.bz2
[Ada] Resolve dynamic type before trying to print it.
This is another required step towards trying to print the value of an array of variant records. For instance: A1 : Array_Type := (1 => (I => 0, S => <>), 2 => (I => 1, S => "A"), 3 => (I => 2, S => "AB")); ... where Array_Type is an array of records whose size is variable: subtype Small_Type is Integer range 0 .. 10; type Record_Type (I : Small_Type := 0) is record S : String (1 .. I); end record; type Array_Type is array (Integer range <>) of Record_Type; What happens is that the ada-valprint modules gets passed an array whose element type is not resolved yet (since each element of the array needs to be resolved separately). the module then recurses, and eventually gets called with the first element of the array. But because the element hasn't been resolved yet, we end up having trouble printing its value soon after. This patch fixes the issue by calling resolve_dynamic_type before trying to print it. With this patch, GDB is finally able to print the complete value for variable "A1": (gdb) p a1 $1 = ((i => 0, s => ""), (i => 1, s => "A"), (i => 2, s => "AB")) gdb/ChangeLog: * ada-valprint.c (ada_val_print_1): Resolve TYPE before trying to print it.
Diffstat (limited to 'gdb/ada-valprint.c')
-rw-r--r--gdb/ada-valprint.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index 34539de..720854e 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -1095,6 +1095,8 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr,
offset_aligned = offset + ada_aligned_value_addr (type, valaddr) - valaddr;
type = printable_val_type (type, valaddr + offset_aligned);
+ type = resolve_dynamic_type (type, valaddr + offset_aligned,
+ address + offset_aligned);
switch (TYPE_CODE (type))
{