dwarf2out patch for incomplete types

Eric Raskin ehr@listworks.com
Wed Jun 30 23:15:00 GMT 1999


FWIW, I've been finding the same problems as Robert.  Here's a test program that generates undefined dwarf1 symbols:

#include <list>

main()
{
  list<int> a;
}

I get 4 undefined symbols:

$ g++ -g temp.cc -o temp	(note: default is dwarf1 on my platform - DG/UX)
UX:as: ERROR: (EOF):undefined name: .L_T3643
UX:as: ERROR: (EOF):undefined name: .L_T3641
UX:as: ERROR: (EOF):undefined name: .L_T3639
UX:as: ERROR: (EOF):undefined name: .L_T3637

I then did a --save-temps -dA on it and examined the .debug section.  If the dwarf1 data is output in lexical order (which it appears to be), then the missing items are in template class list:

template <class _Tp, class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
class list : protected _List_base<_Tp, _Alloc> {
	.
	.
	.
  allocator_type get_allocator() const { return _Base::get_allocator(); }

public:
  typedef _List_iterator<_Tp,_Tp&,_Tp*>             iterator;
  typedef _List_iterator<_Tp,const _Tp&,const _Tp*> const_iterator;

#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
  typedef reverse_iterator<const_iterator> const_reverse_iterator;
  typedef reverse_iterator<iterator>       reverse_iterator;
#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
  typedef reverse_bidirectional_iterator<const_iterator,value_type,
                                         const_reference,difference_type>
  typedef reverse_bidirectional_iterator<iterator,value_type,reference,
                                         difference_type>
          reverse_iterator; 
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
	.
	.
	.
}

Here is the section of the assembler file that points me here:

.L_D636:
	.4byte	.L_D636_e-.L_D636
	.2byte	0x16	/ TAG_typedef
	.2byte	0x12	/ AT_sibling
	.4byte	.L_D637
	.2byte	0x38	/ AT_name
	.string	"allocator_type"				<-- The last good DIE
	.2byte	0x142	/ AT_member
	.4byte	.L_T3575					<-- DIE for list<int, allocator<int> >
	.2byte	0x72	/ AT_user_def_type
	.4byte	.L_T3573					<-- DIE for allocator<int>
.L_D636_e:
.L_D637:
	.4byte	.L_D637_e-.L_D637
	.2byte	0x16	/ TAG_typedef
	.2byte	0x12	/ AT_sibling
	.4byte	.L_D638
	.2byte	0x38	/ AT_name
	.string	"iterator"
	.2byte	0x142	/ AT_member
	.4byte	.L_T3575
	.2byte	0x72	/ AT_user_def_type
	.4byte	.L_T3637					<-- missing DIE
.L_D637_e:
.L_D638:
	.4byte	.L_D638_e-.L_D638
	.2byte	0x16	/ TAG_typedef
	.2byte	0x12	/ AT_sibling
	.4byte	.L_D639
	.2byte	0x38	/ AT_name
	.string	"const_iterator"
	.2byte	0x142	/ AT_member
	.4byte	.L_T3575
	.2byte	0x72	/ AT_user_def_type
	.4byte	.L_T3639					<-- missing DIE
.L_D638_e:
.L_D639:
	.4byte	.L_D639_e-.L_D639
	.2byte	0x16	/ TAG_typedef
	.2byte	0x12	/ AT_sibling
	.4byte	.L_D640
	.2byte	0x38	/ AT_name
	.string	"const_reverse_iterator"
	.2byte	0x142	/ AT_member
	.4byte	.L_T3575
	.2byte	0x72	/ AT_user_def_type
	.4byte	.L_T3641					<-- missing DIE
.L_D639_e:
.L_D640:
	.4byte	.L_D640_e-.L_D640
	.2byte	0x16	/ TAG_typedef
	.2byte	0x12	/ AT_sibling
	.4byte	.L_D641
	.2byte	0x38	/ AT_name
	.string	"reverse_iterator"
	.2byte	0x142	/ AT_member
	.4byte	.L_T3575
	.2byte	0x72	/ AT_user_def_type
	.4byte	.L_T3643					<-- missing DIE
.L_D640_e:
.L_P174:
.L_D641:
	.4byte	.L_D641_e-.L_D641
	.2byte	0x6	/ TAG_global_subroutine
	.2byte	0x12	/ AT_sibling
	.4byte	.L_D642
	.2byte	0x38	/ AT_name
	.string	"get_allocator"
	.2byte	0x208	/ AT_inline
	.string	""
	.2byte	0x142	/ AT_member
	.4byte	.L_T3575
	.2byte	0x72	/ AT_user_def_type
	.4byte	.L_T3573
.L_D641_e:
.L_D643:
	.4byte	0x4
.L_P175:
.L_D642:
	.4byte	.L_D642_e-.L_D642
	.2byte	0x6	/ TAG_global_subroutine
	.2byte	0x12	/ AT_sibling
	.4byte	.L_D644
	.2byte	0x38	/ AT_name
	.string	"_M_create_node"
	.2byte	0x208	/ AT_inline
	.string	""
	.2byte	0x142	/ AT_member
	.4byte	.L_T3575
	.2byte	0x83	/ AT_mod_u_d_type
	.2byte	.L_t642_e-.L_t642
.L_t642:
	.byte	0x1	/ MOD_pointer_to
	.4byte	.L_T3594
.L_t642_e:
.L_D642_e:

That's as far as I've gotten.  Maybe you or Jason can give me some pointers on how to debug this further?

	Eric Raskin

> -----Original Message-----
> From: owner-egcs-patches@egcs.cygnus.com
> [ mailto:owner-egcs-patches@egcs.cygnus.com]On Behalf Of Jeffrey A Law
> Sent: Friday, June 04, 1999 12:26 AM
> To: Jason Merrill
> Cc: egcs-patches@egcs.cygnus.com
> Subject: Re: dwarf2out patch for incomplete types 
> 
> 
> 
>   In message < 199906030931.CAA18793@yorick.cygnus.com >you write:
>   > If we never deal with a type directly, only through 
> pointers, we will never
>   > get another chance to write out the debugging info for 
> the class, because
>   > we have marked the pointer type TREE_ASM_WRITTEN.  So 
> remember what classes
>   > we hope to see more from.
>   > 
>   > Checked in on the mainline and on the branch.
>   > 
>   > Thu Jun  3 02:15:07 1999  Jason Merrill  <jason@yorick.cygnus.com>
>   > 
>   > 	* dwarf2out.c (add_incomplete_type): New fn.
>   > 	(gen_struct_or_union_type_die): Call it.
>   > 	(retry_incomplete_types): New fn.
>   > 	(dwarf2out_finish): Call it.
> Thanks.  Any chance the dwarf1 code has the same bug?  Robert 
> Lipe's tests
> are showing a lot of dwarf1 related problems with references 
> to undefined 
> labels and such.  I haven't had a chance to look at them yet though.
> 
> jeff
> 
> 



More information about the Gcc-patches mailing list