Skip to content

Conversation

@Michael137
Copy link
Member

Instead of this:

0x00018cff: DW_TAG_imported_declaration DW_AT_decl_line (12) DW_AT_import (0x0000000000018cfb) 

print:

0x00018cff: DW_TAG_imported_declaration DW_AT_decl_line (12) DW_AT_import (0x0000000000018cfb "platform") 

Where 0x0000000000018cfb in this example could be a DW_TAG_module with DW_AT_name ("platform")

Copy link
Collaborator

@adrian-prantl adrian-prantl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's very useful!

@github-actions
Copy link

github-actions bot commented Dec 11, 2025

🐧 Linux x64 Test Results

  • 187323 tests passed
  • 4953 tests skipped

✅ The build succeeded and all tests passed.

@github-actions
Copy link

github-actions bot commented Dec 11, 2025

🪟 Windows x64 Test Results

  • 128588 tests passed
  • 2806 tests skipped

✅ The build succeeded and all tests passed.

@llvmbot
Copy link
Member

llvmbot commented Dec 11, 2025

@llvm/pr-subscribers-debuginfo

Author: Michael Buch (Michael137)

Changes

Instead of this:

0x00018cff: DW_TAG_imported_declaration DW_AT_decl_line (12) DW_AT_import (0x0000000000018cfb) 

print:

0x00018cff: DW_TAG_imported_declaration DW_AT_decl_line (12) DW_AT_import (0x0000000000018cfb "platform") 

Where 0x0000000000018cfb in this example could be a DW_TAG_module with DW_AT_name ("platform")


Full diff: https://github.com/llvm/llvm-project/pull/171859.diff

2 Files Affected:

  • (modified) llvm/lib/DebugInfo/DWARF/DWARFDie.cpp (+1-1)
  • (added) llvm/test/tools/llvm-dwarfdump/AArch64/DW_AT_import.yaml (+73)
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp index deafee80f559f..a10becb252006 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp @@ -246,7 +246,7 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die, // having both the raw value and the pretty-printed value is // interesting. These attributes are handled below. if (Attr == DW_AT_specification || Attr == DW_AT_abstract_origin || - Attr == DW_AT_call_origin) { + Attr == DW_AT_call_origin || Attr == DW_AT_import) { if (const char *Name = Die.getAttributeValueAsReferencedDie(FormValue).getName( DINameKind::LinkageName)) diff --git a/llvm/test/tools/llvm-dwarfdump/AArch64/DW_AT_import.yaml b/llvm/test/tools/llvm-dwarfdump/AArch64/DW_AT_import.yaml new file mode 100644 index 0000000000000..fec25bdd9ba30 --- /dev/null +++ b/llvm/test/tools/llvm-dwarfdump/AArch64/DW_AT_import.yaml @@ -0,0 +1,73 @@ +# RUN: yaml2obj %s | llvm-dwarfdump -verify - | FileCheck %s --check-prefix=VERIFY +# VERIFY: No errors. +# +# RUN: yaml2obj %s | llvm-dwarfdump - | FileCheck %s +# CHECK: DW_AT_import ({{.*}} "Foo") +# CHECK: DW_AT_import ({{.*}} "") +# CHECK: DW_AT_import ({{.*}}) + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_AARCH64 +DWARF: + debug_abbrev: + - ID: 0 + Table: + - Code: 0x1 + Tag: DW_TAG_compile_unit + Children: DW_CHILDREN_yes + Attributes: + - Attribute: DW_AT_language + Form: DW_FORM_data2 + - Code: 0x2 + Tag: DW_TAG_imported_declaration + Children: DW_CHILDREN_no + Attributes: + - Attribute: DW_AT_import + Form: DW_FORM_ref4 + - Code: 0x3 + Tag: DW_TAG_module + Children: DW_CHILDREN_no + Attributes: + - Attribute: DW_AT_name + Form: DW_FORM_string + - Code: 0x4 + Tag: DW_TAG_module + Children: DW_CHILDREN_no + + debug_info: + - Version: 5 + UnitType: DW_UT_compile + AddrSize: 8 + Entries: + + - AbbrCode: 0x1 + Values: + - Value: 0x04 + + - AbbrCode: 0x2 + Values: + - Value: 0x1e + + - AbbrCode: 0x2 + Values: + - Value: 0x23 + + - AbbrCode: 0x2 + Values: + - Value: 0x19 + + - AbbrCode: 0x3 + Values: + - CStr: Foo + + - AbbrCode: 0x3 + Values: + - CStr: '' + + - AbbrCode: 0x4 + - AbbrCode: 0x0 +... 
@Michael137 Michael137 enabled auto-merge (squash) December 11, 2025 20:57
@Michael137 Michael137 disabled auto-merge December 11, 2025 20:57
@Michael137 Michael137 enabled auto-merge (squash) December 12, 2025 07:56
@Michael137 Michael137 merged commit 5bc7b9d into llvm:main Dec 12, 2025
9 of 10 checks passed
@Michael137 Michael137 deleted the dwarfdump/import-names branch December 12, 2025 08:38
Michael137 added a commit to swiftlang/llvm-project that referenced this pull request Dec 12, 2025
…d by DW_AT_import (llvm#171859) Instead of this: ``` 0x00018cff: DW_TAG_imported_declaration DW_AT_decl_line (12) DW_AT_import (0x0000000000018cfb) ``` print: ``` 0x00018cff: DW_TAG_imported_declaration DW_AT_decl_line (12) DW_AT_import (0x0000000000018cfb "platform") ``` Where `0x0000000000018cfb` in this example could be a `DW_TAG_module` with `DW_AT_name ("platform")` (cherry picked from commit 5bc7b9d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants