diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ebeb2ef3a5..1b989aec1d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2014-04-11 Sanimir Agovic + + * eval.c (evaluate_subexp_for_sizeof) : Create an indirect + value and retrieve the dynamic type size. + 2014-04-11 Sanimir Agovic * eval.c (evaluate_subexp_for_sizeof) : If the type diff --git a/gdb/eval.c b/gdb/eval.c index 26454f60a2..1f4c8697e0 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -3026,6 +3026,8 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos) && TYPE_CODE (type) != TYPE_CODE_ARRAY) error (_("Attempt to take contents of a non-pointer value.")); type = check_typedef (TYPE_TARGET_TYPE (type)); + if (is_dynamic_type (type)) + type = value_type (value_ind (val)); return value_from_longest (size_type, (LONGEST) TYPE_LENGTH (type)); case UNOP_MEMVAL: