This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello, add_subscript_info and gen_array_type_die currently work together to collapse nested array types into a single array type DIE with multiple subscripts in most circumstances (except for MIPS_DEBUGGING_INFO). The bulk of this is: << add_subscript_info (dw_die_ref type_die, tree type) { ... /* The GNU compilers represent multidimensional array types as sequences of one dimensional array types whose element types are themselves array types. Here we squish that down, so that each multidimensional array type gets only one array_type DIE in the Dwarf debugging info. The draft Dwarf specification say that we are allowed to do this kind of compression in C (because there is no difference between an array or arrays and a multidimensional array in C) but for other source languages (e.g. Ada) we probably shouldn't do this. */ [...] >> It turns out that the comment is right in saying "we probably shouldn't do this for Ada". Ada is very flexible in allowing compositions of arrays and records of variable size, and this transformation is indeed problematic in this respect. The visible effect is variations of debugger misbehavior trying to print "My_Game" from the testcase below: with Games; use Games; procedure Foo is My_Game : Game; begin null; end; package Games is Name_Size : Natural := 4; Pragma Volatile (Name_Size); type Name_Table is array (1 .. 10) of String (1 .. Name_Size); type Game is record Players : Name_Table := (others => (others => ' ')); end record; end; With GCC mainline and GDB 6.8 on x86_64-suse-linux, for instance, we get << $1 = (players => ()) >> instead of the expected << $1 = (players => (" ", " ", " ", " ", " ", " ", " ", " ", " ", " ")) >> The attached patch is a suggestion to address this by disabling the transformation for Ada, reorganizing the add_subscript_info/ gen_array_type_die synchronization along the way. Bootstrapped and regression tested on x86_64-suse-linux plus mips-sgi-irix6.5 as the MIPS_DEBUGGING_INFO control is performed in a slightly different manner. I also checked that the GDB testsuite yields identical results before and after the patch on both targets. Thanks in advance, Olivier 2008-05-22 Olivier Hainque <hainque@adacore.com> * dwarf2out.c (add_subscript_info): New explicit COLLAPSE_P argument, saying whether nested array are to be collapsed into a single array type DIE with multiple subscripts. (gen_array_type_die): Factorize comments about the MIPS_DEBUG_INFO issues, centralize the nested array types collapsing control and disable the transformation for Ada.
Attachment:
dw2-arrays.dif
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |