diff options
author | Joel Brobecker <brobecker@gnat.com> | 2008-01-05 15:44:53 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2008-01-05 15:44:53 +0000 |
commit | 0c281816be864cece712922c881b4ef66283031f (patch) | |
tree | 4adb65c824b0f40f4edacbace99640766cce726b /gdb | |
parent | 6ec2edbe702dc9bfe383fd473c6856a358d896c2 (diff) | |
download | gdb-0c281816be864cece712922c881b4ef66283031f.zip gdb-0c281816be864cece712922c881b4ef66283031f.tar.gz gdb-0c281816be864cece712922c881b4ef66283031f.tar.bz2 |
* ada-lang.c (ada_which_variant_applies): Correctly compute
the value of the discriminant when the variant record is packed.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/ada-lang.c | 13 |
2 files changed, 11 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index acdbc1e..435f2c1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2008-01-05 Joel Brobecker <brobecker@adacore.com> + + * ada-lang.c (ada_which_variant_applies): Correctly compute + the value of the discriminant when the variant record is packed. + 2008-01-04 Joel Brobecker <brobecker@adacore.com> * ada-lang.c (is_name_suffix): Handle middle-name numeric suffixes diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 6e3e6a3..a689b2e 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -6284,17 +6284,16 @@ ada_which_variant_applies (struct type *var_type, struct type *outer_type, { int others_clause; int i; - int disp; - struct type *discrim_type; char *discrim_name = ada_variant_discrim_name (var_type); + struct value *outer; + struct value *discrim; LONGEST discrim_val; - disp = 0; - discrim_type = - ada_lookup_struct_elt_type (outer_type, discrim_name, 1, 1, &disp); - if (discrim_type == NULL) + outer = value_from_contents_and_address (outer_type, outer_valaddr, 0); + discrim = ada_value_struct_elt (outer, discrim_name, 1); + if (discrim == NULL) return -1; - discrim_val = unpack_long (discrim_type, outer_valaddr + disp); + discrim_val = value_as_long (discrim); others_clause = -1; for (i = 0; i < TYPE_NFIELDS (var_type); i += 1) |