mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-18 09:27:27 +00:00
Debug Info: instead of calling addToContextOwner which constructs the context
after the DIE creation, we construct the context first. This touches creation of namespaces and global variables. The purpose is to handle all DIE creations similarly: constructs the context first, then creates the DIE and immediately adds the DIE to its parent. We use createAndAddDIE to wrap around "new DIE(". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193589 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b4e591a4a6
commit
6b713800ff
@ -1327,11 +1327,19 @@ CompileUnit::constructTemplateValueParameterDIE(DIE &Buffer,
|
||||
|
||||
/// getOrCreateNameSpace - Create a DIE for DINameSpace.
|
||||
DIE *CompileUnit::getOrCreateNameSpace(DINameSpace NS) {
|
||||
// Construct the context before querying for the existence of the DIE in case
|
||||
// such construction creates the DIE.
|
||||
DIE *ContextDIE = getOrCreateContextDIE(NS.getContext());
|
||||
if (!ContextDIE)
|
||||
// If the context is null, DIE should belong to the CU we call construct
|
||||
// function on.
|
||||
ContextDIE = CUDie.get();
|
||||
|
||||
DIE *NDie = getDIE(NS);
|
||||
if (NDie)
|
||||
return NDie;
|
||||
NDie = new DIE(dwarf::DW_TAG_namespace);
|
||||
insertDIE(NS, NDie);
|
||||
NDie = createAndAddDIE(dwarf::DW_TAG_namespace, *ContextDIE, NS);
|
||||
|
||||
if (!NS.getName().empty()) {
|
||||
addString(NDie, dwarf::DW_AT_name, NS.getName());
|
||||
addAccelNamespace(NS.getName(), NDie);
|
||||
@ -1339,7 +1347,6 @@ DIE *CompileUnit::getOrCreateNameSpace(DINameSpace NS) {
|
||||
} else
|
||||
addAccelNamespace("(anonymous namespace)", NDie);
|
||||
addSourceLine(NDie, NS);
|
||||
addToContextOwner(NDie, NS.getContext());
|
||||
return NDie;
|
||||
}
|
||||
|
||||
@ -1506,9 +1513,14 @@ void CompileUnit::createGlobalVariableDIE(const MDNode *N) {
|
||||
// If this is not a static data member definition, create the variable
|
||||
// DIE and add the initial set of attributes to it.
|
||||
if (!VariableDIE) {
|
||||
VariableDIE = new DIE(GV.getTag());
|
||||
// Construct the context before querying for the existence of the DIE in
|
||||
// case such construction creates the DIE.
|
||||
DIE *ContextDIE = getOrCreateContextDIE(GVContext);
|
||||
if (!ContextDIE)
|
||||
ContextDIE = CUDie.get();
|
||||
|
||||
// Add to map.
|
||||
insertDIE(N, VariableDIE);
|
||||
VariableDIE = createAndAddDIE(GV.getTag(), *ContextDIE, N);
|
||||
|
||||
// Add name and type.
|
||||
addString(VariableDIE, dwarf::DW_AT_name, GV.getDisplayName());
|
||||
@ -1520,8 +1532,6 @@ void CompileUnit::createGlobalVariableDIE(const MDNode *N) {
|
||||
|
||||
// Add line number info.
|
||||
addSourceLine(VariableDIE, GV);
|
||||
// Add to context owner.
|
||||
addToContextOwner(VariableDIE, GVContext);
|
||||
}
|
||||
|
||||
// Add location.
|
||||
|
@ -1,7 +1,7 @@
|
||||
; RUN: llc -mtriple=i686-linux -O0 -filetype=obj -o %t %s
|
||||
; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
|
||||
; CHECK: DW_TAG_constant [4]
|
||||
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000002c] = "ro")
|
||||
; CHECK: DW_TAG_constant
|
||||
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "ro")
|
||||
|
||||
define void @foo() nounwind ssp {
|
||||
entry:
|
||||
|
@ -37,13 +37,13 @@ declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
|
||||
!19 = metadata !{i32 5, i32 5, metadata !16, null}
|
||||
!20 = metadata !{metadata !"test.c", metadata !"/work/llvm/vanilla/test/DebugInfo"}
|
||||
|
||||
; CHECK: DW_TAG_variable [3]
|
||||
; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000043] = "GLB")
|
||||
; CHECK: DW_TAG_variable
|
||||
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "GLB")
|
||||
; CHECK: DW_AT_decl_file [DW_FORM_data1] (0x01)
|
||||
; CHECK: DW_AT_decl_line [DW_FORM_data1] (0x01)
|
||||
|
||||
; CHECK: DW_TAG_variable [6]
|
||||
; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000004d] = "LOC")
|
||||
; CHECK: DW_TAG_variable
|
||||
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "LOC")
|
||||
; CHECK: DW_AT_decl_file [DW_FORM_data1] (0x01)
|
||||
; CHECK: DW_AT_decl_line [DW_FORM_data1] (0x04)
|
||||
|
||||
|
@ -3,10 +3,10 @@
|
||||
|
||||
; Check that the friend tag is there and is followed by a DW_AT_friend that has a reference back.
|
||||
|
||||
; CHECK: [[BACK:0x[0-9a-f]*]]: DW_TAG_class_type [4]
|
||||
; CHECK: [[BACK:0x[0-9a-f]*]]: DW_TAG_class_type
|
||||
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[{{.*}}] = "A")
|
||||
; CHECK: DW_TAG_friend [9]
|
||||
; CHECK-NEXT: DW_AT_friend [DW_FORM_ref4] (cu + 0x0032 => {[[BACK]]})
|
||||
; CHECK: DW_TAG_friend
|
||||
; CHECK-NEXT: DW_AT_friend [DW_FORM_ref4] (cu + 0x{{[0-9a-f]*}} => {[[BACK]]})
|
||||
|
||||
|
||||
%class.A = type { i32 }
|
||||
|
@ -6,21 +6,22 @@
|
||||
|
||||
@a = global %class.A zeroinitializer, align 4
|
||||
|
||||
; CHECK: 0x0000002d: DW_TAG_base_type [3]
|
||||
; CHECK: [[BASETYPE:0x[0-9a-f]*]]: DW_TAG_base_type
|
||||
; CHECK: [[BASE2:0x[0-9a-f]*]]: DW_TAG_base_type
|
||||
; CHECK-NEXT: DW_AT_name
|
||||
; CHECK-NEXT: DW_AT_byte_size [DW_FORM_data1] (0x04)
|
||||
; CHECK-NEXT: DW_AT_encoding [DW_FORM_data1] (0x05)
|
||||
|
||||
; CHECK: 0x00000034: DW_TAG_array_type [4] *
|
||||
; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x0026 => {0x00000026})
|
||||
; CHECK: [[ARRAY:0x[0-9a-f]*]]: DW_TAG_array_type [{{.*}}] *
|
||||
; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x{{[0-9a-f]*}} => {[[BASETYPE]]})
|
||||
|
||||
; CHECK: 0x00000039: DW_TAG_subrange_type [5]
|
||||
; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x002d => {0x0000002d})
|
||||
; CHECK: DW_TAG_subrange_type
|
||||
; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x{{[0-9a-f]*}} => {[[BASE2]]})
|
||||
; CHECK-NOT: DW_AT_upper_bound
|
||||
|
||||
; CHECK: DW_TAG_member [8]
|
||||
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000003f] = "x")
|
||||
; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x0034 => {0x00000034})
|
||||
; CHECK: DW_TAG_member
|
||||
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "x")
|
||||
; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x{{[0-9a-f]*}} => {[[ARRAY]]})
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
|
||||
|
@ -28,12 +28,12 @@
|
||||
!21 = metadata !{i32 786484, i32 0, null, metadata !"c", metadata !"c", metadata !"", metadata !4, i32 6, metadata !12, i32 0, i32 1, i32* @c, null} ; [ DW_TAG_variable ]
|
||||
!22 = metadata !{metadata !"foo.cpp", metadata !"/Users/echristo/tmp"}
|
||||
|
||||
; CHECK: DW_TAG_enumeration_type [3]
|
||||
; CHECK: DW_TAG_enumeration_type [{{.*}}]
|
||||
; CHECK: DW_AT_type [DW_FORM_ref4]
|
||||
; CHECK: DW_AT_enum_class [DW_FORM_flag_present] (true)
|
||||
; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[{{.*}}] = "A")
|
||||
|
||||
; CHECK: DW_TAG_enumeration_type [3] *
|
||||
; CHECK: DW_TAG_enumeration_type [{{.*}}] *
|
||||
; CHECK: DW_AT_type [DW_FORM_ref4]
|
||||
; CHECK: DW_AT_enum_class [DW_FORM_flag_present] (true)
|
||||
; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[{{.*}}] = "B")
|
||||
|
@ -54,12 +54,7 @@
|
||||
; CHECK-NOT: DW_AT_comp_dir
|
||||
; CHECK: DW_AT_GNU_dwo_id DW_FORM_data8
|
||||
|
||||
; CHECK: [2] DW_TAG_base_type DW_CHILDREN_no
|
||||
; CHECK: DW_AT_name DW_FORM_GNU_str_index
|
||||
; CHECK: DW_AT_encoding DW_FORM_data1
|
||||
; CHECK: DW_AT_byte_size DW_FORM_data1
|
||||
|
||||
; CHECK: [3] DW_TAG_variable DW_CHILDREN_no
|
||||
; CHECK: [2] DW_TAG_variable DW_CHILDREN_no
|
||||
; CHECK: DW_AT_name DW_FORM_GNU_str_index
|
||||
; CHECK: DW_AT_type DW_FORM_ref4
|
||||
; CHECK: DW_AT_external DW_FORM_flag_present
|
||||
@ -67,6 +62,11 @@
|
||||
; CHECK: DW_AT_decl_line DW_FORM_data1
|
||||
; CHECK: DW_AT_location DW_FORM_block1
|
||||
|
||||
; CHECK: [3] DW_TAG_base_type DW_CHILDREN_no
|
||||
; CHECK: DW_AT_name DW_FORM_GNU_str_index
|
||||
; CHECK: DW_AT_encoding DW_FORM_data1
|
||||
; CHECK: DW_AT_byte_size DW_FORM_data1
|
||||
|
||||
; Check that the rest of the compile units have information.
|
||||
; CHECK: .debug_info.dwo contents:
|
||||
; CHECK: DW_TAG_compile_unit
|
||||
@ -77,15 +77,15 @@
|
||||
; CHECK-NOT: DW_AT_stmt_list
|
||||
; CHECK-NOT: DW_AT_comp_dir
|
||||
; CHECK: DW_AT_GNU_dwo_id [DW_FORM_data8] (0x0000000000000000)
|
||||
; CHECK: DW_TAG_base_type
|
||||
; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000003) string = "int")
|
||||
; CHECK: DW_TAG_variable
|
||||
; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000002) string = "a")
|
||||
; CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0018 => {0x00000018})
|
||||
; CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x{{[0-9a-f]*}} => {[[TYPE:0x[0-9a-f]*]]})
|
||||
; CHECK: DW_AT_external [DW_FORM_flag_present] (true)
|
||||
; CHECK: DW_AT_decl_file [DW_FORM_data1] (0x01)
|
||||
; CHECK: DW_AT_decl_line [DW_FORM_data1] (0x01)
|
||||
; CHECK: DW_AT_location [DW_FORM_block1] (<0x02> fb 00 )
|
||||
; CHECK: [[TYPE]]: DW_TAG_base_type
|
||||
; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000003) string = "int")
|
||||
|
||||
|
||||
; CHECK: .debug_str.dwo contents:
|
||||
|
@ -77,12 +77,12 @@
|
||||
; CHECK: [[GLOB_NS_VAR_DECL:[0-9a-f]+]]: DW_TAG_variable
|
||||
; CHECK-NEXT: DW_AT_name {{.*}} "global_namespace_variable"
|
||||
|
||||
; CHECK: [[D:[0-9a-f]+]]: DW_TAG_structure_type
|
||||
; CHECK-NEXT: DW_AT_name {{.*}} "D"
|
||||
|
||||
; CHECK: [[D_VAR_DECL:[0-9a-f]+]]: DW_TAG_variable
|
||||
; CHECK-NEXT: DW_AT_name {{.*}} "d"
|
||||
|
||||
; CHECK: [[D:[0-9a-f]+]]: DW_TAG_structure_type
|
||||
; CHECK-NEXT: DW_AT_name {{.*}} "D"
|
||||
|
||||
; CHECK: [[GLOB_NS_FUNC:[0-9a-f]+]]: DW_TAG_subprogram
|
||||
; CHECK-NEXT: DW_AT_MIPS_linkage_name
|
||||
; CHECK-NEXT: DW_AT_name {{.*}} "global_namespace_function"
|
||||
|
@ -8,22 +8,23 @@
|
||||
; Check that we can handle non-default array bounds. In this case, the array
|
||||
; goes from [-3, 38].
|
||||
|
||||
; CHECK: 0x0000002d: DW_TAG_base_type [3]
|
||||
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000041] = "int")
|
||||
; CHECK: [[BASE:0x[0-9a-f]*]]: DW_TAG_base_type
|
||||
; CHECK: [[BASE2:0x[0-9a-f]*]]: DW_TAG_base_type
|
||||
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "int")
|
||||
; CHECK-NEXT: DW_AT_byte_size [DW_FORM_data1] (0x04)
|
||||
; CHECK-NEXT: DW_AT_encoding [DW_FORM_data1] (0x05)
|
||||
|
||||
; CHECK: 0x00000034: DW_TAG_array_type [4] *
|
||||
; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x0026 => {0x00000026})
|
||||
; CHECK: [[ARRAY:0x[0-9a-f]*]]: DW_TAG_array_type [{{.*}}] *
|
||||
; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x{{[0-9a-f]*}} => {[[BASE]]})
|
||||
|
||||
; CHECK: 0x00000039: DW_TAG_subrange_type [5]
|
||||
; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x002d => {0x0000002d})
|
||||
; CHECK: DW_TAG_subrange_type
|
||||
; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x{{[0-9a-f]*}} => {[[BASE2]]})
|
||||
; CHECK-NEXT: DW_AT_lower_bound [DW_FORM_data8] (0xfffffffffffffffd)
|
||||
; CHECK-NEXT: DW_AT_upper_bound [DW_FORM_data1] (0x26)
|
||||
|
||||
; CHECK: 0x00000055: DW_TAG_member [8]
|
||||
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000003f] = "x")
|
||||
; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x0034 => {0x00000034})
|
||||
; CHECK: DW_TAG_member
|
||||
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "x")
|
||||
; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x{{[0-9a-f]*}} => {[[ARRAY]]})
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
; RUN: llc -mtriple=x86_64-macosx %s -o %t -filetype=obj
|
||||
; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
|
||||
|
||||
; CHECK: 0x00000027: DW_TAG_structure_type
|
||||
; CHECK: DW_TAG_structure_type
|
||||
; CHECK: DW_AT_declaration
|
||||
; CHECK: DW_AT_APPLE_runtime_class
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
; Verify that we refer to 'yyyy' with a relocation.
|
||||
; LINUX: .long .Linfo_string3 # DW_AT_name
|
||||
; LINUX-NEXT: .long 38 # DW_AT_type
|
||||
; LINUX-NEXT: .long {{[0-9]+}} # DW_AT_type
|
||||
; LINUX-NEXT: # DW_AT_external
|
||||
; LINUX-NEXT: .byte 1 # DW_AT_decl_file
|
||||
; LINUX-NEXT: .byte 1 # DW_AT_decl_line
|
||||
@ -30,9 +30,9 @@
|
||||
; LINUX-NEXT: .quad yyyy
|
||||
|
||||
; Verify that we refer to 'yyyy' without a relocation.
|
||||
; DARWIN: Lset5 = Linfo_string3-Linfo_string ## DW_AT_name
|
||||
; DARWIN-NEXT: .long Lset5
|
||||
; DARWIN-NEXT: .long 38 ## DW_AT_type
|
||||
; DARWIN: Lset[[ID:[0-9]+]] = Linfo_string3-Linfo_string ## DW_AT_name
|
||||
; DARWIN-NEXT: .long Lset[[ID]]
|
||||
; DARWIN-NEXT: .long {{[0-9]+}} ## DW_AT_type
|
||||
; DARWIN-NEXT: ## DW_AT_external
|
||||
; DARWIN-NEXT: .byte 1 ## DW_AT_decl_file
|
||||
; DARWIN-NEXT: .byte 1 ## DW_AT_decl_line
|
||||
|
@ -2,7 +2,7 @@
|
||||
; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
|
||||
|
||||
; Make sure that structures have a decl file and decl line attached.
|
||||
; CHECK: DW_TAG_structure_type [3]
|
||||
; CHECK: DW_TAG_structure_type
|
||||
; CHECK: DW_AT_decl_file
|
||||
; CHECK: DW_AT_decl_line
|
||||
; CHECK: DW_TAG_member
|
||||
|
@ -13,7 +13,7 @@
|
||||
; class bar : public foo<void> { };
|
||||
; bar filters;
|
||||
|
||||
; CHECK: DW_TAG_template_type_parameter [10]
|
||||
; CHECK: DW_TAG_template_type_parameter [{{.*}}]
|
||||
; CHECK-NEXT: DW_AT_name{{.*}}"T"
|
||||
; CHECK-NOT: DW_AT_type
|
||||
; CHECK: NULL
|
||||
|
Loading…
Reference in New Issue
Block a user