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]

Re: [patch] Fix problems with -fdebug-types-section and local types


> Index: gcc/testsuite/g++.dg/debug/dwarf2/dwarf4-nested.C
> ===================================================================
> --- gcc/testsuite/g++.dg/debug/dwarf2/dwarf4-nested.C   (revision 0)
> +++ gcc/testsuite/g++.dg/debug/dwarf2/dwarf4-nested.C   (revision 0)
> @@ -0,0 +1,55 @@
> +// { dg-do compile }
> +// { dg-options "--std=c++11 -dA -gdwarf-4 -fdebug-types-section -fno-merge-debug-strings" }
> +
> +// Check that -fdebug-types-sections does not copy a full referenced type
> +// into a type unit.
> +
> +// Checks that at least one type unit is generated.
> +//
> +// { dg-final { scan-assembler "DIE \\(.*\\) DW_TAG_type_unit" } }
> +//
> +// Check that func is declared exactly twice in the debug info:
> +// once in the type unit for struct D, and once in the compile unit.
> +//
> +// { dg-final { scan-assembler-times "\\.ascii \"func\\\\0\"\[^\n\]*DW_AT_name" 2 } }
> +//
> +// Check to make sure that no type unit contains a DIE with DW_AT_low_pc
> +// or DW_AT_ranges.  These patterns assume that the compile unit is always
> +// emitted after all type units.
> +//
> +// { dg-final { scan-assembler-not "\\.quad.*DW_AT_low_pc.*DIE \\(.*\\) DW_TAG_compile_unit" } }
> +// { dg-final { scan-assembler-not "\\.quad.*DW_AT_ranges.*DIE \\(.*\\) DW_TAG_compile_unit" } }

I found a minor problem with the regexps above -- I was using ".*" in
a few places where I should have been using "\[^\n\]*". Fixed as
follows:

+// { dg-final { scan-assembler "DIE \\(\[^\n\]*\\) DW_TAG_type_unit" } }

+// { dg-final { scan-assembler-times "\\.ascii
\"func\\\\0\"\[^\n\]*DW_AT_name" 2 } }

+// { dg-final { scan-assembler-not "\\.quad\[^\n\]*DW_AT_low_pc.*DIE
\\(\[^\n\]*\\) DW_TAG_compile_unit" } }
+// { dg-final { scan-assembler-not "\\.quad\[^\n\]*DW_AT_ranges.*DIE
\\(\[^\n\]*\\) DW_TAG_compile_unit" } }

(Sorry, these will probably get split into two lines by gmail, but
they're each a single line in the actual patch.)

-cary


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]