This is the mail archive of the archer@sourceware.org mailing list for the Archer 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]

Interpretation of DW_AT_external


the following program:

namespace A{
  int a;
}

int main(){
  A::a;
  return 0;
}

compiled with gcc 4.3.0-8 produces the following debug info for int a:

[...]
 <2><5d>: Abbrev Number: 5 (DW_TAG_variable)
    <5e>   DW_AT_name        : a
    <60>   DW_AT_decl_file   : 1
    <61>   DW_AT_decl_line   : 5
    <62>   DW_AT_MIPS_linkage_name: (indirect string, offset: 0x2e):
_ZN1A1aE
    <66>   DW_AT_type        : <0x4d>
    <6a>   DW_AT_external    : 1
    <6b>   DW_AT_declaration : 1
[...]

The following snippet of gdb code interprets DW_AT_external as 'a' must be global which is not correct in this situation. 'a' should not be found in the global scope. But more importantly, which is what I am working on right now, a should be found the the scope of the namespace A.

from dwarf2read.c:

      attr2 = dwarf2_attr (die, DW_AT_external, cu);
      if (attr2 && (DW_UNSND (attr2) != 0))
	add_symbol_to_list (sym, &global_symbols);
      else
	add_symbol_to_list (sym, cu->list_in_scope);
      break;


I assume gcc is saying that A::a is visible globally and not a. Is this a bad tag or a misinterpretation by gdb ?


Sami


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