This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Add support for imported declaration and correct search order
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: swagiaal at redhat dot com (Sami Wagiaalla)
- Cc: tromey at redhat dot com (Tom Tromey), gdb-patches at sourceware dot org
- Date: Tue, 23 Mar 2010 22:35:32 +0100 (CET)
- Subject: Re: [patch] Add support for imported declaration and correct search order
Sami Wagiaalla wrote:
> On 03/23/2010 04:31 PM, Ulrich Weigand wrote:
> > This test is now failing for me:
> >
> > print x
> > $5 = 55
> > (gdb) FAIL: gdb.cp/shadow.exp: Print imported namespace x
> >
> > (Same value as with GDB 7.1, except the test was KFAILed there ...)
> >
>
> I can try to reproduce it. Which compiler are you using ?
GCC 4.1 (the RHEL 5.4 system compiler).
> > Any suggestions where to look?
> >
>
> In lookup_symbol_aux_local the call to cp_lookup_symbol_imports is
> failing so the local variable in the outer block is being found. IIRC
> the import statement was not nested correctly with older compilers so
> that would be my first guess.
That might well be the case. Here's the debug info I'm seeing:
The section .debug_info contains:
Compilation Unit @ offset 0x0:
Length: 479
Version: 2
Abbrev Offset: 0
Pointer Size: 8
<0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
DW_AT_stmt_list : 0
DW_AT_producer : GNU C++ 4.1.2 20080704 (Red Hat 4.1.2-46)
DW_AT_language : 4 (C++)
DW_AT_name : /home/uweigand/fsf/gdb-head/gdb/testsuite/gdb.cp/shadow.cc
<1><76>: Abbrev Number: 2 (DW_TAG_class_type)
DW_AT_sibling : <bd>
DW_AT_name : B
DW_AT_byte_size : 4
DW_AT_decl_file : 1
DW_AT_decl_line : 10
<2><80>: Abbrev Number: 3 (DW_TAG_member)
DW_AT_name : x
DW_AT_decl_file : 1
DW_AT_decl_line : 12
DW_AT_type : <bd>
DW_AT_data_member_location: 2 byte block: 23 0 (DW_OP_plus_uconst: 0)
<2><8c>: Abbrev Number: 4 (DW_TAG_subprogram)
DW_AT_external : 1
DW_AT_name : func
DW_AT_decl_file : 1
DW_AT_decl_line : 15
DW_AT_MIPS_linkage_name: _ZN1B4funcEv
DW_AT_type : <bd>
DW_AT_declaration : 1
<3><a7>: Abbrev Number: 5 (DW_TAG_formal_parameter)
DW_AT_type : <c4>
DW_AT_artificial : 1
<3><ad>: Abbrev Number: 6 (DW_TAG_imported_module)
DW_AT_decl_file : 1
DW_AT_decl_line : 29
DW_AT_import : <ca>
<3><b4>: Abbrev Number: 7 (DW_TAG_imported_declaration)
DW_AT_decl_file : 1
DW_AT_decl_line : 33
DW_AT_import : <d3>
<1><bd>: Abbrev Number: 8 (DW_TAG_base_type)
DW_AT_name : int
DW_AT_byte_size : 4
DW_AT_encoding : 5 (signed)
<1><c4>: Abbrev Number: 9 (DW_TAG_pointer_type)
DW_AT_byte_size : 8
DW_AT_type : <76>
<1><ca>: Abbrev Number: 10 (DW_TAG_namespace)
DW_AT_sibling : <f2>
DW_AT_name : A
DW_AT_decl_file : 1
DW_AT_decl_line : 2
<2><d3>: Abbrev Number: 11 (DW_TAG_variable)
DW_AT_name : x
DW_AT_decl_file : 1
DW_AT_decl_line : 3
DW_AT_MIPS_linkage_name: (indirect string, offset: 0x0): _ZN1A1xE
DW_AT_type : <bd>
DW_AT_external : 1
DW_AT_declaration : 1
<2><e2>: Abbrev Number: 11 (DW_TAG_variable)
DW_AT_name : x
DW_AT_decl_file : 1
DW_AT_decl_line : 3
DW_AT_MIPS_linkage_name: (indirect string, offset: 0x0): _ZN1A1xE
DW_AT_type : <bd>
DW_AT_external : 1
DW_AT_declaration : 1
<1><f2>: Abbrev Number: 12 (DW_TAG_subprogram)
DW_AT_sibling : <15a>
DW_AT_specification: <8c>
DW_AT_low_pc : 0x10000620
DW_AT_high_pc : 0x100006f0
DW_AT_frame_base : 0 (location list)
<2><10f>: Abbrev Number: 13 (DW_TAG_formal_parameter)
DW_AT_name : this
DW_AT_type : <15a>
DW_AT_artificial : 1
DW_AT_location : 2 byte block: 91 30 (DW_OP_fbreg: 48)
<2><11d>: Abbrev Number: 14 (DW_TAG_lexical_block)
DW_AT_low_pc : 0x10000658
DW_AT_high_pc : 0x100006d8
<3><12e>: Abbrev Number: 15 (DW_TAG_variable)
DW_AT_name : x
DW_AT_decl_file : 1
DW_AT_decl_line : 21
DW_AT_type : <bd>
DW_AT_location : 2 byte block: 91 64 (DW_OP_fbreg: -28)
<3><13a>: Abbrev Number: 14 (DW_TAG_lexical_block)
DW_AT_low_pc : 0x1000067c
DW_AT_high_pc : 0x100006d8
<4><14b>: Abbrev Number: 15 (DW_TAG_variable)
DW_AT_name : x
DW_AT_decl_file : 1
DW_AT_decl_line : 25
DW_AT_type : <bd>
DW_AT_location : 2 byte block: 91 60 (DW_OP_fbreg: -32)
<1><15a>: Abbrev Number: 16 (DW_TAG_const_type)
DW_AT_type : <c4>
<1><15f>: Abbrev Number: 17 (DW_TAG_subprogram)
DW_AT_sibling : <194>
DW_AT_external : 1
DW_AT_name : main
DW_AT_decl_file : 1
DW_AT_decl_line : 43
DW_AT_type : <bd>
DW_AT_low_pc : 0x100005d4
DW_AT_high_pc : 0x10000620
DW_AT_frame_base : 0x4d (location list)
<2><184>: Abbrev Number: 15 (DW_TAG_variable)
DW_AT_name : theB
DW_AT_decl_file : 1
DW_AT_decl_line : 45
DW_AT_type : <76>
DW_AT_location : 2 byte block: 91 60 (DW_OP_fbreg: -32)
<1><194>: Abbrev Number: 10 (DW_TAG_namespace)
DW_AT_sibling : <1b5>
DW_AT_name : ::
DW_AT_decl_file : 2
DW_AT_decl_line : 0
<2><19e>: Abbrev Number: 18 (DW_TAG_variable)
DW_AT_name : x
DW_AT_decl_file : 1
DW_AT_decl_line : 6
DW_AT_type : <bd>
DW_AT_external : 1
DW_AT_declaration : 1
<2><1a9>: Abbrev Number: 18 (DW_TAG_variable)
DW_AT_name : y
DW_AT_decl_file : 1
DW_AT_decl_line : 7
DW_AT_type : <bd>
DW_AT_external : 1
DW_AT_declaration : 1
<1><1b5>: Abbrev Number: 19 (DW_TAG_variable)
DW_AT_specification: <19e>
DW_AT_location : 9 byte block: 3 0 0 0 0 10 1 b 4 (DW_OP_addr: 10010b04)
<1><1c4>: Abbrev Number: 19 (DW_TAG_variable)
DW_AT_specification: <1a9>
DW_AT_location : 9 byte block: 3 0 0 0 0 10 1 c 7c (DW_OP_addr: 10010c7c)
<1><1d3>: Abbrev Number: 19 (DW_TAG_variable)
DW_AT_specification: <e2>
DW_AT_location : 9 byte block: 3 0 0 0 0 10 1 b 0 (DW_OP_addr: 10010b00)
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com