This is the mail archive of the gdb-patches@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]

Re: [rfc/rfa] accept DW_TAG_namespace and friends, possibly on 5.3


On Tue, 22 Oct 2002 18:27:09 -0400, Elena Zannoni <ezannoni@redhat.com> said:
> David Carlton writes:

>> @@ -1376,37 +1384,54 @@ scan_partial_symbols (char *info_ptr, st
>> case DW_TAG_enumerator:
>> /* File scope enumerators are added to the partial symbol
>> table.  */

> Could you add a comment here about why/how we know that the level
> should be 2 here?

How about if I add a sentence like "They're children of the
enumeration type die, so they occur at a level one higher than we
normally look for." to the end of the comment?

>> if (pdi.tag == 0)
>> {
>> nesting_level--;
>> +	  /* If this is the end of a DW_TAG_namespace entry, then
>> +	     decrease the file_scope_level, too.  */
>> +	  if (nesting_level < file_scope_level)
>> +	    {
>> +	      file_scope_level--;
>> +	      gdb_assert (nesting_level == file_scope_level);
>> +	    }
>> }
>> }
>> 

> Can you explain a bit about the levels? I am getting confused.

How about the following change to the comment before the definition of
file_scope_level:

  /* We only want to read in symbols corresponding to variables or
     other similar objects that are global or static.  Normally, these
     are all children of the DW_TAG_compile_unit die, so are all at
     level 1.  But C++ namespaces give ries to DW_TAG_namespace dies
     whose children are global objects.  So we keep track of what
     level we currently think of as referring to file scope; this
     should always equal 1 plus the number of namespaces that we are
     currently nested within.  */
  
> About the new DW_TAGs etc. Are they handled by objdump and readelf?
> If not, you should add those to binutils and dwarf2.h as well.

readelf seems okay, and they're certainly all in dwarf2.h.  (In fact,
that's what I looked at to get the new names.)  I can't convince
objdump to give me any information at all about DWARF 2 info; am I
missing something?  I've never used the program before, so I could
well be.

David Carlton
carlton@math.stanford.edu


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