mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 01:24:30 +00:00
Debug info: Add dwarf backend support for DIModule.
rdar://problem/20965932 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241034 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -239,6 +239,11 @@ enum Attribute : uint16_t {
|
|||||||
DW_AT_GNU_pubnames = 0x2134,
|
DW_AT_GNU_pubnames = 0x2134,
|
||||||
DW_AT_GNU_pubtypes = 0x2135,
|
DW_AT_GNU_pubtypes = 0x2135,
|
||||||
|
|
||||||
|
// LLVM project extensions.
|
||||||
|
DW_AT_LLVM_include_path = 0x3e00,
|
||||||
|
DW_AT_LLVM_config_macros = 0x3e01,
|
||||||
|
DW_AT_LLVM_isysroot = 0x3e02,
|
||||||
|
|
||||||
// Apple extensions.
|
// Apple extensions.
|
||||||
DW_AT_APPLE_optimized = 0x3fe1,
|
DW_AT_APPLE_optimized = 0x3fe1,
|
||||||
DW_AT_APPLE_flags = 0x3fe2,
|
DW_AT_APPLE_flags = 0x3fe2,
|
||||||
|
@ -638,6 +638,8 @@ DIE *DwarfCompileUnit::constructImportedEntityDIE(
|
|||||||
auto *Entity = resolve(Module->getEntity());
|
auto *Entity = resolve(Module->getEntity());
|
||||||
if (auto *NS = dyn_cast<DINamespace>(Entity))
|
if (auto *NS = dyn_cast<DINamespace>(Entity))
|
||||||
EntityDie = getOrCreateNameSpace(NS);
|
EntityDie = getOrCreateNameSpace(NS);
|
||||||
|
else if (auto *M = dyn_cast<DIModule>(Entity))
|
||||||
|
EntityDie = getOrCreateModule(M);
|
||||||
else if (auto *SP = dyn_cast<DISubprogram>(Entity))
|
else if (auto *SP = dyn_cast<DISubprogram>(Entity))
|
||||||
EntityDie = getOrCreateSubprogramDIE(SP);
|
EntityDie = getOrCreateSubprogramDIE(SP);
|
||||||
else if (auto *T = dyn_cast<DIType>(Entity))
|
else if (auto *T = dyn_cast<DIType>(Entity))
|
||||||
|
@ -1069,6 +1069,30 @@ DIE *DwarfUnit::getOrCreateNameSpace(const DINamespace *NS) {
|
|||||||
return &NDie;
|
return &NDie;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DIE *DwarfUnit::getOrCreateModule(const DIModule *M) {
|
||||||
|
// Construct the context before querying for the existence of the DIE in case
|
||||||
|
// such construction creates the DIE.
|
||||||
|
DIE *ContextDIE = getOrCreateContextDIE(M->getScope());
|
||||||
|
|
||||||
|
if (DIE *MDie = getDIE(M))
|
||||||
|
return MDie;
|
||||||
|
DIE &MDie = createAndAddDIE(dwarf::DW_TAG_module, *ContextDIE, M);
|
||||||
|
|
||||||
|
if (!M->getName().empty()) {
|
||||||
|
addString(MDie, dwarf::DW_AT_name, M->getName());
|
||||||
|
addGlobalName(M->getName(), MDie, M->getScope());
|
||||||
|
}
|
||||||
|
if (!M->getConfigurationMacros().empty())
|
||||||
|
addString(MDie, dwarf::DW_AT_LLVM_config_macros,
|
||||||
|
M->getConfigurationMacros());
|
||||||
|
if (!M->getIncludePath().empty())
|
||||||
|
addString(MDie, dwarf::DW_AT_LLVM_include_path, M->getIncludePath());
|
||||||
|
if (!M->getISysRoot().empty())
|
||||||
|
addString(MDie, dwarf::DW_AT_LLVM_isysroot, M->getISysRoot());
|
||||||
|
|
||||||
|
return &MDie;
|
||||||
|
}
|
||||||
|
|
||||||
DIE *DwarfUnit::getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal) {
|
DIE *DwarfUnit::getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal) {
|
||||||
// Construct the context before querying for the existence of the DIE in case
|
// Construct the context before querying for the existence of the DIE in case
|
||||||
// such construction creates the DIE (as is the case for member function
|
// such construction creates the DIE (as is the case for member function
|
||||||
|
@ -291,6 +291,7 @@ public:
|
|||||||
dwarf::Attribute Attribute = dwarf::DW_AT_type);
|
dwarf::Attribute Attribute = dwarf::DW_AT_type);
|
||||||
|
|
||||||
DIE *getOrCreateNameSpace(const DINamespace *NS);
|
DIE *getOrCreateNameSpace(const DINamespace *NS);
|
||||||
|
DIE *getOrCreateModule(const DIModule *M);
|
||||||
DIE *getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal = false);
|
DIE *getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal = false);
|
||||||
|
|
||||||
void applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie,
|
void applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie,
|
||||||
|
@ -190,6 +190,9 @@ const char *llvm::dwarf::AttributeString(unsigned Attribute) {
|
|||||||
case DW_AT_APPLE_property_attribute: return "DW_AT_APPLE_property_attribute";
|
case DW_AT_APPLE_property_attribute: return "DW_AT_APPLE_property_attribute";
|
||||||
case DW_AT_APPLE_property: return "DW_AT_APPLE_property";
|
case DW_AT_APPLE_property: return "DW_AT_APPLE_property";
|
||||||
case DW_AT_APPLE_objc_complete_type: return "DW_AT_APPLE_objc_complete_type";
|
case DW_AT_APPLE_objc_complete_type: return "DW_AT_APPLE_objc_complete_type";
|
||||||
|
case DW_AT_LLVM_include_path: return "DW_AT_LLVM_include_path";
|
||||||
|
case DW_AT_LLVM_config_macros: return "DW_AT_LLVM_config_macros";
|
||||||
|
case DW_AT_LLVM_isysroot: return "DW_AT_LLVM_isysroot";
|
||||||
|
|
||||||
// DWARF5 Fission Extension Attribute
|
// DWARF5 Fission Extension Attribute
|
||||||
case DW_AT_GNU_dwo_name: return "DW_AT_GNU_dwo_name";
|
case DW_AT_GNU_dwo_name: return "DW_AT_GNU_dwo_name";
|
||||||
|
25
test/DebugInfo/X86/DIModule.ll
Normal file
25
test/DebugInfo/X86/DIModule.ll
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
; ModuleID = '/Volumes/Data/apple-internal/llvm/tools/clang/test/Modules/debug-info-moduleimport.m'
|
||||||
|
; RUN: llc %s -o %t -filetype=obj
|
||||||
|
; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
|
||||||
|
; CHECK: DW_TAG_module
|
||||||
|
; CHECK-NEXT: DW_AT_name {{.*}}"DebugModule"
|
||||||
|
; CHECK-NEXT: DW_AT_LLVM_config_macros {{.*}}"-DMODULES=0"
|
||||||
|
; CHECK-NEXT: DW_AT_LLVM_include_path {{.*}}"/llvm/tools/clang/test/Modules/Inputs"
|
||||||
|
; CHECK-NEXT: DW_AT_LLVM_isysroot {{.*}}"/"
|
||||||
|
|
||||||
|
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
||||||
|
target triple = "x86_64-apple-macosx"
|
||||||
|
|
||||||
|
!llvm.dbg.cu = !{!0}
|
||||||
|
!llvm.module.flags = !{!6, !7}
|
||||||
|
!llvm.ident = !{!8}
|
||||||
|
|
||||||
|
!0 = distinct !DICompileUnit(language: DW_LANG_ObjC, file: !1, producer: "LLVM version 3.7.0", isOptimized: false, runtimeVersion: 2, emissionKind: 1, enums: !2, retainedTypes: !2, subprograms: !2, globals: !2, imports: !3)
|
||||||
|
!1 = !DIFile(filename: "/llvm/tools/clang/test/Modules/<stdin>", directory: "/")
|
||||||
|
!2 = !{}
|
||||||
|
!3 = !{!4}
|
||||||
|
!4 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !0, entity: !5, line: 5)
|
||||||
|
!5 = !DIModule(scope: null, name: "DebugModule", configMacros: "-DMODULES=0", includePath: "/llvm/tools/clang/test/Modules/Inputs", isysroot: "/")
|
||||||
|
!6 = !{i32 2, !"Dwarf Version", i32 4}
|
||||||
|
!7 = !{i32 2, !"Debug Info Version", i32 3}
|
||||||
|
!8 = !{!"LLVM version 3.7.0"}
|
Reference in New Issue
Block a user