diff options
author | Anton Gorenkov <xgsa@sourceware.org> | 2012-04-14 12:18:50 +0000 |
---|---|---|
committer | Anton Gorenkov <xgsa@sourceware.org> | 2012-04-14 12:18:50 +0000 |
commit | 8264ba82b71a186e10fddc298c5eb6e68742a94a (patch) | |
tree | 6a127bac3d88db9846b9b2db0a98a21fd31b7f0c /gdb/value.c | |
parent | 5f18041e78f879768645b113054261313517234a (diff) | |
download | gdb-8264ba82b71a186e10fddc298c5eb6e68742a94a.zip gdb-8264ba82b71a186e10fddc298c5eb6e68742a94a.tar.gz gdb-8264ba82b71a186e10fddc298c5eb6e68742a94a.tar.bz2 |
gdb/doc/ChangeLog:
2012-04-14 Anton Gorenkov <xgsa@yandex.ru>
PR mi/13393
* gdb.texinfo (Print Settings): Extend the description for "set print
object".
(GDB/MI Variable Objects): Extend the description for -var-create and
-var-list-children.
gdb/testsuite/ChangeLog:
2012-04-14 Anton Gorenkov <xgsa@yandex.ru>
PR mi/13393
* gdb.mi/mi-var-rtti.cc: New file.
* gdb.mi/mi-var-rtti.exp: New file.
* lib/mi-support.exp (mi_varobj_update_with_child_type_change): New
function.
(mi_varobj_update_with_type_change): updated to avoid code duplication.
gdb/ChangeLog:
2012-04-14 Anton Gorenkov <xgsa@yandex.ru>
PR mi/13393
* value.c (value_actual_type): New function.
* value.h (value_actual_type): New declaration.
* varobj.c (update_type_if_necessary): New function.
(varobj_create): Call value_actual_type instead of
value_type.
(install_dynamic_child): distinct changed and type changed MI variable
objects.
(update_dynamic_varobj_children): Updated for install_dynamic_child
change. All callers updated.
(varobj_update): Support for MI variable object type change if
the value changed and RTTI is used to determine the type.
(create_child_with_value): Call value_actual_type instead of
value_type.
(adjust_value_for_child_access): Extended with a new parameter which
specify whether the given value should be casted to enclosing type.
All callers updated.
Diffstat (limited to 'gdb/value.c')
-rw-r--r-- | gdb/value.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/gdb/value.c b/gdb/value.c index c23803a..eae3e2d 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -834,6 +834,47 @@ value_enclosing_type (struct value *value) return value->enclosing_type; } +/* Look at value.h for description. */ + +struct type * +value_actual_type (struct value *value, int resolve_simple_types, + int *real_type_found) +{ + struct value_print_options opts; + struct value *target; + struct type *result; + + get_user_print_options (&opts); + + if (real_type_found) + *real_type_found = 0; + result = value_type (value); + if (opts.objectprint) + { + if (TYPE_CODE (result) == TYPE_CODE_PTR + || TYPE_CODE (result) == TYPE_CODE_REF) + { + struct type *real_type; + + real_type = value_rtti_indirect_type (value, NULL, NULL, NULL); + if (real_type) + { + if (real_type_found) + *real_type_found = 1; + result = real_type; + } + } + else if (resolve_simple_types) + { + if (real_type_found) + *real_type_found = 1; + result = value_enclosing_type (value); + } + } + + return result; +} + static void require_not_optimized_out (const struct value *value) { |