mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 04:33:05 +00:00
Debug Info: for static member variables, always put AT_MIPS_linkage_name to the
definition DIE (TAG_variable), and put AT_MIPS_linkage_name to TAG_member when DarwinGDBCompat is true. Darwin GDB needs AT_MIPS_linkage_name at both places to work. Follow-up patch to r176143. rdar://problem/13291234 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176220 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
139f50a1a8
commit
21a08a1189
@ -1349,12 +1349,19 @@ void CompileUnit::createGlobalVariableDIE(const MDNode *N) {
|
||||
// Add linkage name.
|
||||
StringRef LinkageName = GV.getLinkageName();
|
||||
if (!LinkageName.empty() && isGlobalVariable) {
|
||||
addString(VariableDIE, dwarf::DW_AT_MIPS_linkage_name,
|
||||
// From dwarf-4: DIE to which DW_AT_linkage_name may apply include:
|
||||
// TAG_commono_block, TAG_constant, TAG_entry_point, TAG_subporgram and
|
||||
// TAG_variable. For static member variables, gcc 4.7 puts
|
||||
// MIPS_linkage_name on the definition DIE only, but Darwin gdb needs
|
||||
// MIPS_linkage_name at both places.
|
||||
// Per discussion with Eric, for static member variables, we put
|
||||
// MIPS_linkage_name on the definition DIE (TAG_variable) and conditionaly
|
||||
// put MIPS_linkage_name on TAG_member when DarwinGDBCompat is on.
|
||||
addString(IsStaticMember && VariableSpecDIE ?
|
||||
VariableSpecDIE : VariableDIE, dwarf::DW_AT_MIPS_linkage_name,
|
||||
getRealLinkageName(LinkageName));
|
||||
// To make old GDB happy, for static member variables, we add
|
||||
// AT_MIPS_linkage_name to the definition DIE as well.
|
||||
if (IsStaticMember && VariableSpecDIE)
|
||||
addString(VariableSpecDIE, dwarf::DW_AT_MIPS_linkage_name,
|
||||
if (IsStaticMember && VariableSpecDIE && DD->useDarwinGDBCompat())
|
||||
addString(VariableDIE, dwarf::DW_AT_MIPS_linkage_name,
|
||||
getRealLinkageName(LinkageName));
|
||||
}
|
||||
} else if (const ConstantInt *CI =
|
||||
|
@ -1,6 +1,9 @@
|
||||
; RUN: llc %s -o %t -filetype=obj -O0 -mtriple=x86_64-unknown-linux-gnu
|
||||
; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s -check-prefix=PRESENT
|
||||
; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s -check-prefix=ABSENT
|
||||
; RUN: llc %s -o %t -filetype=obj -O0 -mtriple=x86_64-apple-darwin
|
||||
; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s -check-prefix=DARWINP
|
||||
; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s -check-prefix=DARWINA
|
||||
; Verify that attributes we do want are PRESENT;
|
||||
; verify that attributes we don't want are ABSENT.
|
||||
; It's a lot easier to do this in two passes than in one.
|
||||
@ -97,7 +100,6 @@ declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
|
||||
; PRESENT: DW_AT_external
|
||||
; PRESENT: DW_AT_declaration
|
||||
; PRESENT: DW_AT_accessibility [DW_FORM_data1] (0x03)
|
||||
; PRESENT: DW_AT_MIPS_linkage_name {{.*}} "_ZN1C1aE"
|
||||
; PRESENT: DW_TAG_member
|
||||
; PRESENT-NEXT: DW_AT_name {{.*}} "const_a"
|
||||
; PRESENT: DW_AT_external
|
||||
@ -107,7 +109,6 @@ declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
|
||||
; PRESENT: 0x[[DECL_B:[0-9a-f]+]]: DW_TAG_member
|
||||
; PRESENT-NEXT: DW_AT_name {{.*}} "b"
|
||||
; PRESENT: DW_AT_accessibility [DW_FORM_data1] (0x02)
|
||||
; PRESENT: DW_AT_MIPS_linkage_name {{.*}} "_ZN1C1bE"
|
||||
; PRESENT: DW_TAG_member
|
||||
; PRESENT-NEXT: DW_AT_name {{.*}} "const_b"
|
||||
; PRESENT: DW_AT_accessibility [DW_FORM_data1] (0x02)
|
||||
@ -115,7 +116,6 @@ declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
|
||||
; PRESENT: 0x[[DECL_C:[0-9a-f]+]]: DW_TAG_member
|
||||
; PRESENT-NEXT: DW_AT_name {{.*}} "c"
|
||||
; PRESENT: DW_AT_accessibility [DW_FORM_data1] (0x01)
|
||||
; PRESENT: DW_AT_MIPS_linkage_name {{.*}} "_ZN1C1cE"
|
||||
; PRESENT: DW_TAG_member
|
||||
; PRESENT-NEXT: DW_AT_name {{.*}} "const_c"
|
||||
; PRESENT: DW_AT_accessibility [DW_FORM_data1] (0x01)
|
||||
@ -141,6 +141,59 @@ declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
|
||||
; PRESENT-NEXT: DW_AT_location
|
||||
; PRESENT-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_ZN1C1cE"
|
||||
|
||||
; For Darwin gdb:
|
||||
; DARWINP: .debug_info contents:
|
||||
; DARWINP: DW_TAG_class_type
|
||||
; DARWINP-NEXT: DW_AT_name {{.*}} "C"
|
||||
; DARWINP: 0x[[DECL_A:[0-9a-f]+]]: DW_TAG_member
|
||||
; DARWINP-NEXT: DW_AT_name {{.*}} "a"
|
||||
; DARWINP: DW_AT_external
|
||||
; DARWINP: DW_AT_declaration
|
||||
; DARWINP: DW_AT_accessibility [DW_FORM_data1] (0x03)
|
||||
; DARWINP: DW_AT_MIPS_linkage_name {{.*}} "_ZN1C1aE"
|
||||
; DARWINP: DW_TAG_member
|
||||
; DARWINP-NEXT: DW_AT_name {{.*}} "const_a"
|
||||
; DARWINP: DW_AT_external
|
||||
; DARWINP: DW_AT_declaration
|
||||
; DARWINP: DW_AT_accessibility [DW_FORM_data1] (0x03)
|
||||
; DARWINP: DW_AT_const_value {{.*}} (1)
|
||||
; DARWINP: 0x[[DECL_B:[0-9a-f]+]]: DW_TAG_member
|
||||
; DARWINP-NEXT: DW_AT_name {{.*}} "b"
|
||||
; DARWINP: DW_AT_accessibility [DW_FORM_data1] (0x02)
|
||||
; DARWINP: DW_AT_MIPS_linkage_name {{.*}} "_ZN1C1bE"
|
||||
; DARWINP: DW_TAG_member
|
||||
; DARWINP-NEXT: DW_AT_name {{.*}} "const_b"
|
||||
; DARWINP: DW_AT_accessibility [DW_FORM_data1] (0x02)
|
||||
; DARWINP: DW_AT_const_value {{.*}} (0x4048f5c3)
|
||||
; DARWINP: 0x[[DECL_C:[0-9a-f]+]]: DW_TAG_member
|
||||
; DARWINP-NEXT: DW_AT_name {{.*}} "c"
|
||||
; DARWINP: DW_AT_accessibility [DW_FORM_data1] (0x01)
|
||||
; DARWINP: DW_AT_MIPS_linkage_name {{.*}} "_ZN1C1cE"
|
||||
; DARWINP: DW_TAG_member
|
||||
; DARWINP-NEXT: DW_AT_name {{.*}} "const_c"
|
||||
; DARWINP: DW_AT_accessibility [DW_FORM_data1] (0x01)
|
||||
; DARWINP: DW_AT_const_value {{.*}} (0x00000012)
|
||||
; While we're here, a normal member has data_member_location and
|
||||
; accessibility attributes.
|
||||
; DARWINP: DW_TAG_member
|
||||
; DARWINP-NEXT: DW_AT_name {{.*}} "d"
|
||||
; DARWINP: DW_AT_data_member_location
|
||||
; DARWINP: DW_AT_accessibility [DW_FORM_data1] (0x01)
|
||||
; DARWINP: NULL
|
||||
; Definitions point back to their declarations, and have a location.
|
||||
; DARWINP: DW_TAG_variable
|
||||
; DARWINP-NEXT: DW_AT_specification {{.*}} {0x[[DECL_A]]}
|
||||
; DARWINP-NEXT: DW_AT_location
|
||||
; DARWINP-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_ZN1C1aE"
|
||||
; DARWINP: DW_TAG_variable
|
||||
; DARWINP-NEXT: DW_AT_specification {{.*}} {0x[[DECL_B]]}
|
||||
; DARWINP-NEXT: DW_AT_location
|
||||
; DARWINP-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_ZN1C1bE"
|
||||
; DARWINP: DW_TAG_variable
|
||||
; DARWINP-NEXT: DW_AT_specification {{.*}} {0x[[DECL_C]]}
|
||||
; DARWINP-NEXT: DW_AT_location
|
||||
; DARWINP-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_ZN1C1cE"
|
||||
|
||||
; ABSENT verifies that static member declarations do not have either
|
||||
; DW_AT_location or DW_AT_data_member_location; also, variables do not
|
||||
; have DW_AT_const_value and constants do not have DW_AT_MIPS_linkage_name.
|
||||
@ -172,3 +225,32 @@ declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
|
||||
; ABSENT-NOT: DW_AT_const_value
|
||||
; ABSENT-NOT: DW_AT_location
|
||||
; ABSENT: NULL
|
||||
|
||||
; For Darwin gdb:
|
||||
; DARWINA: .debug_info contents:
|
||||
; DARWINA: DW_TAG_member
|
||||
; DARWINA: DW_AT_name {{.*}} "a"
|
||||
; DARWINA-NOT: DW_AT_const_value
|
||||
; DARWINA-NOT: location
|
||||
; DARWINA: DW_AT_name {{.*}} "const_a"
|
||||
; DARWINA-NOT: DW_AT_MIPS_linkage_name
|
||||
; DARWINA-NOT: location
|
||||
; DARWINA: DW_AT_name {{.*}} "b"
|
||||
; DARWINA-NOT: DW_AT_const_value
|
||||
; DARWINA-NOT: location
|
||||
; DARWINA: DW_AT_name {{.*}} "const_b"
|
||||
; DARWINA-NOT: DW_AT_MIPS_linkage_name
|
||||
; DARWINA-NOT: location
|
||||
; DARWINA: DW_AT_name {{.*}} "c"
|
||||
; DARWINA-NOT: DW_AT_const_value
|
||||
; DARWINA-NOT: location
|
||||
; DARWINA: DW_AT_name {{.*}} "const_c"
|
||||
; DARWINA-NOT: DW_AT_MIPS_linkage_name
|
||||
; DARWINA-NOT: location
|
||||
; While we're here, a normal member does not have a linkage name, constant
|
||||
; value, or DW_AT_location.
|
||||
; DARWINA: DW_AT_name {{.*}} "d"
|
||||
; DARWINA-NOT: DW_AT_MIPS_linkage_name
|
||||
; DARWINA-NOT: DW_AT_const_value
|
||||
; DARWINA-NOT: DW_AT_location
|
||||
; DARWINA: NULL
|
||||
|
Loading…
Reference in New Issue
Block a user