Consider the following code:
type Element is abstract tagged null record;
type GADataType is interface;
type Data_Type is new Element and GADataType with record
I : Integer := 42;
end record;
Result1 : Data_Type;
GGG1 : GADataType'Class := GADataType'Class (Result1);
When trying to create a varobj for variable ggg1, GDB currently
returns an object which has no child:
-var-create ggg1 * ggg1
^done,name="ggg1",numchild="0",[...]
This is incorrect, it should return an object which has one child
(field "i"). This is because tagged-type objects are dynamic, and
we need to apply a small transformation in order to get their actual
type. This is already done on the GDB/CLI side in ada-valprint,
and it needs to be done on the ada-varobj side as well.
gdb/ChangeLog:
* ada-varobj.c (ada_varobj_adjust_for_child_access): Convert
tagged type objects to their actual type.
gdb/testsuite/ChangeLog:
* gdb.ada/mi_interface: New testcase.
As a result of previous patch, extern functions in ada-varobj.c can be
made static, and ada-varobj.h can be removed too.
gdb:
2013-10-17 Yao Qi <yao@codesourcery.com>
* Makefile.in (HFILES_NO_SRCDIR): Remove ada-varobj.h.
* ada-varobj.c: Remove the include of ada-varobj.h.
(ada_varobj_get_number_of_children): Declare.
(ada_varobj_get_name_of_child): Make it static.
(ada_varobj_get_path_expr_of_child): Likewise.
(ada_varobj_get_value_of_child): Likewise.
(ada_varobj_get_type_of_child): Likewise.
(ada_varobj_get_value_of_array_variable): Likewise.
* ada-varobj.h: Remove.
Two modifications:
1. The addition of 2013 to the copyright year range for every file;
2. The use of a single year range, instead of potentially multiple
year ranges, as approved by the FSF.
This patch adds varobj support for Ada variables. Most of the code
is implemented in a separate Ada-specific file called ada-varobj.c.
The only bits in varobj.c are the functions used as the hooks in
the language-specific varobj's vector.
gdb/ChangeLog:
* ada-varobj.h, ada-varobj.c: New files.
* Makefile.in (SFILES): Add ada-varobj.c.
(HFILES_NO_SRCDIR): Add ada-varobj.h.
(COMMON_OBS): Add ada-varobj.o.