On Thu, Jan 05, 2012 at 11:47:49PM +0100, Dodji Seketeli wrote: > --- /dev/null > +++ b/gcc/testsuite/g++.dg/debug/dwarf2/nested-3.C > @@ -0,0 +1,34 @@ > +// Origin: PR debug/45682 > +// { dg-options "-g -gdwarf-4 -dA -fdebug-types-section" } > + > +namespace thread { > + class Executor {}; > +} > + > +thread::Executor *te; > + > +int > +main () > +{ > + return 0; > +} > + > +// We want to express the fact that the DIE for the definition of > +// 'Executor' is a child of the DIE for the namespace 'thread'. E.g, > +// we must have this outout: > +// .uleb128 0x2 # (DIE (0x25) DW_TAG_namespace) > +// .long .LASF0 # DW_AT_name: "thread" > +// # DW_AT_declaration > +// .uleb128 0x3 # (DIE (0x2a) DW_TAG_class_type) > +// .long .LASF1 # DW_AT_name: "Executor" > +// # DW_AT_declaration > +// .uleb128 0x4 # (DIE (0x2f) DW_TAG_class_type) > +// .byte 0x1 # DW_AT_byte_size > +// .byte 0x1 # DW_AT_decl_file (../../prtests/test-PR45682-2.cc) > +// .byte 0x2 # DW_AT_decl_line > +// .long 0x2a # DW_AT_specification > +// .byte 0 # end of children of DIE 0x25 > +// > +// Hence the scary regexp: > +// > +// { dg-final { scan-assembler "\[^\n\r\]*\\(DIE \\(0x(\[0-9a-f\]+)\\) > DW_TAG_namespace\\)\[\n\r\]+\[^\n\r\]*DW_AT_name: > \"thread\"\[\n\r\]+\[^\n\r\]*DW_AT_declaration\[\n\r\]+\[^\n\r\]*\\(DIE > \\(0x(\[0-9a-f\]+)\\)\[^\n\r\]*DW_TAG_class_type\\)\[\n\r\]+\[^\n\r\]*DW_AT_name: > > \"Executor\"\[\n\r\]+\[^\n\r\]*DW_AT_declaration\[\n\r\]+\[^\n\r\]*\\(DIE\[^\n\r\]*DW_TAG_class_type\\)\[\n\r\]+(\[^\n\r\]*\[\n\r\]+)+\[^\n\r\]*0x\\2\[^\n\r\]*\[\n\r\]+\[^\n\r\]*end > of children of DIE 0x\\1" } }
Just a testcase comment, I bet this will surely fail on Darwin or other targets that aren't capable of merging string sections. So, you should add -fno-merge-debug-strings to dg-options and adjust the example and regexp for that, that way it will be the same on all targets. Jakub