This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB 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]

gcc 3.4 regression in gdb.cp/namespace.exp


I just ran the testsuite with g++ (GCC) 3.5.0 20040119 (experimental)
(which is right after 3.4 branched), and I get a regression on
gdb.cp/namespace.exp, on both mainline and 6.1.

  ptype CClass::NestedClass
  There is no field named NestedClass
  (gdb) FAIL: gdb.cp/namespace.exp: ptype CClass::NestedClass

Just to double-check, I reverted my recent dwarf2read.c patch (I
tested in with that GCC a week ago, but who knows), and it still
fails.  Daniel, might it be an issue with a recent patch of yours?  (I
have a more specific guess below.)

Here's some more info: the classes in question are defined as follows:

  class CClass {
  public:
    int x;
    class NestedClass {
    public:
      int y;
    };
  };

The debug info that I'm getting looks like this:

	.uleb128 0x17	# (DIE (0x480) DW_TAG_structure_type)
	.long	0x505	# DW_AT_sibling
	.long	.LASF2	# DW_AT_name: "CClass"
	.byte	0x1	# DW_AT_declaration
	.uleb128 0x18	# (DIE (0x48a) DW_TAG_structure_type)
	.long	.LASF1	# DW_AT_name: "NestedClass"
	.byte	0x4	# DW_AT_byte_size
	.byte	0x1	# DW_AT_decl_file
	.byte	0x5e	# DW_AT_decl_line
	.uleb128 0x8	# (DIE (0x492) DW_TAG_member)
	.ascii "y\0"	# DW_AT_name
	.byte	0x1	# DW_AT_decl_file
	.byte	0x60	# DW_AT_decl_line
	.long	0x19e	# DW_AT_type
	.byte	0x2	# DW_AT_data_member_location
	.byte	0x23	# DW_OP_plus_uconst
	.uleb128 0x0

(Rest of CClass::NestedClass definition omitted.)  Then, later on, we
see:

	.uleb128 0x7	# (DIE (0x6ec) DW_TAG_structure_type)
	.long	0x75d	# DW_AT_sibling
	.long	0x480	# DW_AT_specification
	.byte	0x4	# DW_AT_byte_size
	.byte	0x1	# DW_AT_decl_file
	.byte	0x5b	# DW_AT_decl_line
	.uleb128 0x8	# (DIE (0x6f8) DW_TAG_member)
	.ascii "x\0"	# DW_AT_name
	.byte	0x1	# DW_AT_decl_file
	.byte	0x5d	# DW_AT_decl_line
	.long	0x19e	# DW_AT_type
	.byte	0x2	# DW_AT_data_member_location
	.byte	0x23	# DW_OP_plus_uconst
	.uleb128 0x0

(Rest of CClass definition omitted.)

So we have a die giving a declaration for CClass which in turn
contains a die giving a definition for CClass::NestedClass.  Which in
turn suggests that the loop in process_structure_scope should be run
even if the current DIE is a declaration.

I'll fiddle around with an appropriate patch either later today or
tommorow.

I really hate the way we test our DWARF 2 reader - there's no way to
generate the debug info by hand to give a particular scenario, so
instead we have to hope that we can find the magic version of GCC and
magic way of writing a test case to trigger the bug in question.
Sigh.

David Carlton
carlton@kealia.com


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