[Lldb-commits] [PATCH] D53597: Don't type-erase the SymbolContextItem enum

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 25 11:33:22 PDT 2018


jingham added a comment.

Ah, right...  Too many patches (a good problem!)

The standard as I read it says that the name entry points into the general string table, but doesn't specify which entry it points to.  However, the current DWARF debug_info doesn't ever emit a string for the fully qualified name, so you would have to construct it specially to have an exact name to refer to.  I also couldn't see anything that said specifically whether the DW_AT_name for a type has to be the full name or a base name, it just says:

If a name has been given to the structure, union, or class in the source program, then the corresponding structure type, union type, or class type entry has a DW_AT_name attribute whose value is a null-terminated string containing the type name.

But it would bloat the name tables to use the full name, and since you can reconstruct it from the context it's not needed...  So I've only seen base names in the name entry for types in the debug_info.

Anyway, current clang for -gdwarf-5 produces:

  Bucket 1 [
    Name 2 {
      Hash: 0xB887389
      String: 0x000000c3 "Foo"
      Entry @ 0x92 {
        Abbrev: 0x39
        Tag: DW_TAG_namespace
        DW_IDX_die_offset: 0x0000004c
      }
    }
  ]
  Bucket 2 [
    Name 3 {
      Hash: 0xB8860BA
      String: 0x000000c7 "Bar"
      Entry @ 0x9b {
        Abbrev: 0x13
        Tag: DW_TAG_structure_type
        DW_IDX_die_offset: 0x0000004e
      }
    }
    Name 4 {
      Hash: 0x7C9A7F6A
      String: 0x000000b5 "main"
      Entry @ 0xa4 {
        Abbrev: 0x2E
        Tag: DW_TAG_subprogram
        DW_IDX_die_offset: 0x00000026
      }
    }

For:

namespace Foo
{

  struct Bar
  {
    int First;
  };

}

int
main() 
{

  Foo::Bar mine = {10};
  return mine.First;

}

Jim


https://reviews.llvm.org/D53597





More information about the lldb-commits mailing list