Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DebugInfo] Declarations show up in debug-names when TUs are used #78367

Closed
felipepiovezan opened this issue Jan 17, 2024 · 3 comments
Closed
Labels
debuginfo duplicate Resolved as duplicate

Comments

@felipepiovezan
Copy link
Contributor

We are adding declarations of types to debug-names when type units are involved:
For example:

namespace MyNamespace {
struct MyStruct1 {
  char c1;
};
struct MyStruct2 {
  char c2;
};
}

MyNamespace::MyStruct1 gv1;
MyNamespace::MyStruct2 gv2;

Compiling with:

clang++ -target x86_64 -c two_tus.cpp -g2 -gpubnames -fdebug-types-section -o - | \
llvm-dwarfdump - --debug-names | \
grep MyStruct2 -A14

We see:

  Bucket 0 [
    Name 1 {
      Hash: 0xE186C022
      String: 0x00000037 "MyStruct2"
      Entry @ 0xc9 {
        Abbrev: 0x26c
        Tag: DW_TAG_structure_type
        DW_IDX_type_unit: 0x01
        DW_IDX_die_offset: 0x00000025
      }
      Entry @ 0xd0 {
        Abbrev: 0x268
        Tag: DW_TAG_structure_type
        DW_IDX_die_offset: 0x00000034
      }
    }
  ]

I can't explain why this second entry is added. Looking at the debug-info section, the offset 0x34 is an offset to the declaration inside the CU:

0x00000029:   DW_TAG_namespace
                DW_AT_name      ("MyNamespace")

0x0000002b:     DW_TAG_structure_type
                  DW_AT_declaration     (true)
                  DW_AT_signature       (0x8b108ad18e93cb95)

0x00000034:     DW_TAG_structure_type
                  DW_AT_declaration     (true)
                  DW_AT_signature       (0x690ca39e0eeaec8f)

0x0000003d:     NULL

But declarations are not supposed to show up in debug-names...

Originally posted by @felipepiovezan in #77457 (comment)

@felipepiovezan
Copy link
Contributor Author

cc @dwblaikie @clayborg @ayermolo for visibility

@llvmbot
Copy link
Collaborator

llvmbot commented Jan 17, 2024

@llvm/issue-subscribers-debuginfo

Author: Felipe de Azevedo Piovezan (felipepiovezan)

We are adding _declarations_ of types to debug-names when type units are involved: For example:
namespace MyNamespace {
struct MyStruct1 {
  char c1;
};
struct MyStruct2 {
  char c2;
};
}

MyNamespace::MyStruct1 gv1;
MyNamespace::MyStruct2 gv2;

Compiling with:

clang++ -target x86_64 -c two_tus.cpp -g2 -gpubnames -fdebug-types-section -o - | \
llvm-dwarfdump - --debug-names | \
grep MyStruct2 -A14

We see:

  Bucket 0 [
    Name 1 {
      Hash: 0xE186C022
      String: 0x00000037 "MyStruct2"
      Entry @ 0xc9 {
        Abbrev: 0x26c
        Tag: DW_TAG_structure_type
        DW_IDX_type_unit: 0x01
        DW_IDX_die_offset: 0x00000025
      }
      Entry @ 0xd0 {
        Abbrev: 0x268
        Tag: DW_TAG_structure_type
        DW_IDX_die_offset: 0x00000034
      }
    }
  ]

I can't explain why this second entry is added. Looking at the debug-info section, the offset 0x34 is an offset to the declaration inside the CU:

0x00000029:   DW_TAG_namespace
                DW_AT_name      ("MyNamespace")

0x0000002b:     DW_TAG_structure_type
                  DW_AT_declaration     (true)
                  DW_AT_signature       (0x8b108ad18e93cb95)

0x00000034:     DW_TAG_structure_type
                  DW_AT_declaration     (true)
                  DW_AT_signature       (0x690ca39e0eeaec8f)

0x0000003d:     NULL

But declarations are not supposed to show up in debug-names...

Originally posted by @felipepiovezan in #77457 (comment)

@dwblaikie
Copy link
Collaborator

Duplicate of #77696

@dwblaikie dwblaikie marked this as a duplicate of #77696 Jan 18, 2024
@EugeneZelenko EugeneZelenko added the duplicate Resolved as duplicate label Jan 18, 2024
@EugeneZelenko EugeneZelenko closed this as not planned Won't fix, can't repro, duplicate, stale Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debuginfo duplicate Resolved as duplicate
Projects
None yet
Development

No branches or pull requests

4 participants