[PATCH] Enhance array types debug info. for Ada

Pierre-Marie de Rodat derodat@adacore.com
Wed Sep 3 08:36:00 GMT 2014


Hi!

I'm currently working on improving the debug information output for GNAT 
(the Ada frontend in GCC), which currently uses non-standard DWARF to 
describe complex types. Lately, I focused on debug information for 
arrays and the attached inter-dependent patches are an attempt to do so:

   - they enhance the existing "array_descr_info" language hook;
   - they adjust the Fortran front-end accordingly (it's the only 
array_descr_info user currently);
   - they make the Ada front-end use this hook.

Here are more details about what motivated each patch:


  1. This first patch enhances the array_descr_info language hook so 
that front-end can pass more information about array types to the DWARF 
backend:

     - Array ordering (column/row major) so that the information that 
Fortran arrays are column major ordered comes from the Fortran front-end 
and so that later GNAT can decide itself for each array type (they can 
be both column and row major ordered).

     - Bounds type: Ada arrays can be indexed by integers but also 
characters, enumerated types, etc. However it seems that the middle-end 
makes the assumption that every array index is sizetype so this 
information is needed here for accurate debug info.

     It also makes the language hook generate "GNAT descriptive type" 
attributes for array types, just as the regular array types handling in 
dwarf2out.c does.

     Finally, it makes the DWARF back-end initialize the 
"array_descr_info" structure so that new fields can be added to it later 
without affecting existing front-ends that use this hook.


  2. Currently, this language hook is enabled only when (dwarf_version 
 >= 3 || !dwarf_strict). The hook generates information that is mostly 
valid for strict DWARFv2, though. The second patch enables this language 
hook every time and instead prevents the emission for some attributes 
when needed.


  3. This one enables the array_descr_info hook in GNAT.


  4. This one enhances debug helpers in dwarf2out.c to ease location 
descriptions (DWARF expressions) bugs investigation.


  5. The array_descr_info hook has its own circuitry in dwarf2out.c to 
generate location description: add_descr_info_field. It is a duplicate 
of loc_list_from_tree and less powerful except that it handles 
"self-referencial attributes". This final patch is an attempt to merge 
these two circuitries so that this hook can generate more complex DWARF 
expressions. It also adjusts the Fortran front-end accordingly.


These patches were tested on x86_64-pc-linux-gnu. They trigger no 
regression in the GCC DejaGNU testsuite nor in the GDB one (they fix 
some failures however).

Ok for trunk?

Thank you very much for reading until this point and thank you in 
advance for your review! ;-)

-- 
Pierre-Marie de Rodat

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Complete-information-generated-through-the-array-des.patch
Type: text/x-patch
Size: 6261 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140903/7310fcf3/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Enable-the-array-descr-language-hook-for-all-DWARF-v.patch
Type: text/x-patch
Size: 2895 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140903/7310fcf3/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Make-the-Ada-front-end-use-the-array-descr-language-.patch
Type: text/x-patch
Size: 3352 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140903/7310fcf3/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Add-a-few-debug-utilities-for-DWARF-expressions.patch
Type: text/x-patch
Size: 9830 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140903/7310fcf3/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-dwarf2out.c-do-not-short-circuit-add_bound_info-in-a.patch
Type: text/x-patch
Size: 19808 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140903/7310fcf3/attachment-0004.bin>


More information about the Gcc-patches mailing list