mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Debug Info: In DIBuilder, the context field of subprogram is updated to use
DIScopeRef. A paired commit at clang is required due to changes to DIBuilder. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192378 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
75a3ad485c
commit
b8e48a636e
@ -562,6 +562,20 @@ namespace llvm {
|
||||
MDNode *TParam = 0,
|
||||
MDNode *Decl = 0);
|
||||
|
||||
/// FIXME: this is added for dragonegg. Once we update dragonegg
|
||||
/// to call resolve function, this will be removed.
|
||||
DISubprogram createFunction(DIScopeRef Scope, StringRef Name,
|
||||
StringRef LinkageName,
|
||||
DIFile File, unsigned LineNo,
|
||||
DICompositeType Ty, bool isLocalToUnit,
|
||||
bool isDefinition,
|
||||
unsigned ScopeLine,
|
||||
unsigned Flags = 0,
|
||||
bool isOptimized = false,
|
||||
Function *Fn = 0,
|
||||
MDNode *TParam = 0,
|
||||
MDNode *Decl = 0);
|
||||
|
||||
/// createMethod - Create a new descriptor for the specified C++ method.
|
||||
/// See comments in DISubprogram for descriptions of these fields.
|
||||
/// @param Scope Function scope.
|
||||
|
@ -434,7 +434,7 @@ class DISubprogram : public DIScope {
|
||||
public:
|
||||
explicit DISubprogram(const MDNode *N = 0) : DIScope(N) {}
|
||||
|
||||
DIScope getContext() const { return getFieldAs<DIScope>(2); }
|
||||
DIScopeRef getContext() const { return getFieldAs<DIScopeRef>(2); }
|
||||
StringRef getName() const { return getStringField(3); }
|
||||
StringRef getDisplayName() const { return getStringField(4); }
|
||||
StringRef getLinkageName() const { return getStringField(5); }
|
||||
|
@ -1300,7 +1300,7 @@ DIE *CompileUnit::getOrCreateSubprogramDIE(DISubprogram SP) {
|
||||
// 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
|
||||
// declarations).
|
||||
DIE *ContextDIE = getOrCreateContextDIE(SP.getContext());
|
||||
DIE *ContextDIE = getOrCreateContextDIE(resolve(SP.getContext()));
|
||||
if (!ContextDIE)
|
||||
ContextDIE = CUDie.get();
|
||||
|
||||
|
@ -393,9 +393,10 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(CompileUnit *SPCU,
|
||||
// function then gdb prefers the definition at top level and but does not
|
||||
// expect specification DIE in parent function. So avoid creating
|
||||
// specification DIE for a function defined inside a function.
|
||||
if (SP.isDefinition() && !SP.getContext().isCompileUnit() &&
|
||||
!SP.getContext().isFile() &&
|
||||
!isSubprogramContext(SP.getContext())) {
|
||||
DIScope SPContext = resolve(SP.getContext());
|
||||
if (SP.isDefinition() && !SPContext.isCompileUnit() &&
|
||||
!SPContext.isFile() &&
|
||||
!isSubprogramContext(SPContext)) {
|
||||
SPCU->addFlag(SPDie, dwarf::DW_AT_declaration);
|
||||
|
||||
// Add arguments.
|
||||
|
@ -1040,6 +1040,28 @@ DIVariable DIBuilder::createComplexVariable(unsigned Tag, DIDescriptor Scope,
|
||||
return DIVariable(MDNode::get(VMContext, Elts));
|
||||
}
|
||||
|
||||
/// createFunction - Create a new descriptor for the specified function.
|
||||
/// FIXME: this is added for dragonegg. Once we update dragonegg
|
||||
/// to call resolve function, this will be removed.
|
||||
DISubprogram DIBuilder::createFunction(DIScopeRef Context,
|
||||
StringRef Name,
|
||||
StringRef LinkageName,
|
||||
DIFile File, unsigned LineNo,
|
||||
DICompositeType Ty,
|
||||
bool isLocalToUnit, bool isDefinition,
|
||||
unsigned ScopeLine,
|
||||
unsigned Flags, bool isOptimized,
|
||||
Function *Fn,
|
||||
MDNode *TParams,
|
||||
MDNode *Decl) {
|
||||
// dragonegg does not generate identifier for types, so using an empty map
|
||||
// to resolve the context should be fine.
|
||||
DITypeIdentifierMap EmptyMap;
|
||||
return createFunction(Context.resolve(EmptyMap), Name, LinkageName, File,
|
||||
LineNo, Ty, isLocalToUnit, isDefinition, ScopeLine,
|
||||
Flags, isOptimized, Fn, TParams, Decl);
|
||||
}
|
||||
|
||||
/// createFunction - Create a new descriptor for the specified function.
|
||||
DISubprogram DIBuilder::createFunction(DIDescriptor Context,
|
||||
StringRef Name,
|
||||
@ -1058,7 +1080,7 @@ DISubprogram DIBuilder::createFunction(DIDescriptor Context,
|
||||
Value *Elts[] = {
|
||||
GetTagConstant(VMContext, dwarf::DW_TAG_subprogram),
|
||||
File.getFileNode(),
|
||||
getNonCompileUnitScope(Context),
|
||||
DIScope(getNonCompileUnitScope(Context)).getRef(),
|
||||
MDString::get(VMContext, Name),
|
||||
MDString::get(VMContext, Name),
|
||||
MDString::get(VMContext, LinkageName),
|
||||
@ -1107,7 +1129,7 @@ DISubprogram DIBuilder::createMethod(DIDescriptor Context,
|
||||
Value *Elts[] = {
|
||||
GetTagConstant(VMContext, dwarf::DW_TAG_subprogram),
|
||||
F.getFileNode(),
|
||||
getNonCompileUnitScope(Context),
|
||||
DIScope(getNonCompileUnitScope(Context)).getRef(),
|
||||
MDString::get(VMContext, Name),
|
||||
MDString::get(VMContext, Name),
|
||||
MDString::get(VMContext, LinkageName),
|
||||
|
@ -511,8 +511,8 @@ bool DISubprogram::Verify() const {
|
||||
if (!isSubprogram())
|
||||
return false;
|
||||
|
||||
// Make sure context @ field 2 and type @ field 7 are MDNodes.
|
||||
if (!fieldIsMDNode(DbgNode, 2))
|
||||
// Make sure context @ field 2 is a ScopeRef and type @ field 7 is a MDNode.
|
||||
if (!fieldIsScopeRef(DbgNode, 2))
|
||||
return false;
|
||||
if (!fieldIsMDNode(DbgNode, 7))
|
||||
return false;
|
||||
@ -1071,7 +1071,7 @@ void DebugInfoFinder::processLexicalBlock(DILexicalBlock LB) {
|
||||
void DebugInfoFinder::processSubprogram(DISubprogram SP) {
|
||||
if (!addSubprogram(SP))
|
||||
return;
|
||||
processScope(SP.getContext());
|
||||
processScope(SP.getContext().resolve(TypeIdentifierMap));
|
||||
processType(SP.getType());
|
||||
DIArray TParams = SP.getTemplateParams();
|
||||
for (unsigned I = 0, E = TParams.getNumElements(); I != E; ++I) {
|
||||
|
@ -6,9 +6,16 @@
|
||||
; Make sure we correctly handle containing type of a struct being a type identifier.
|
||||
; CHECK-NEXT: DW_AT_containing_type [DW_FORM_ref4] (cu + {{.*}} => {[[TYPE]]})
|
||||
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] {{.*}}= "C")
|
||||
|
||||
; Make sure we correctly handle context of a subprogram being a type identifier.
|
||||
; CHECK: [[SP:.*]]: DW_TAG_subprogram
|
||||
; CHECK: DW_AT_name [DW_FORM_strp] {{.*}}= "foo")
|
||||
; Make sure we correctly handle containing type of a subprogram being a type identifier.
|
||||
; CHECK: DW_AT_containing_type [DW_FORM_ref4] (cu + {{.*}} => {[[TYPE]]})
|
||||
; CHECK: DW_TAG_formal_parameter
|
||||
; CHECK: NULL
|
||||
; CHECK: NULL
|
||||
|
||||
; CHECK: [[TYPE2:.*]]: DW_TAG_structure_type
|
||||
; CHECK: DW_TAG_structure_type
|
||||
; CHECK: DW_AT_name [DW_FORM_strp] {{.*}}= "D")
|
||||
@ -128,7 +135,7 @@ attributes #1 = { nounwind readnone }
|
||||
!10 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !11, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
||||
!11 = metadata !{metadata !12}
|
||||
!12 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
|
||||
!13 = metadata !{i32 786478, metadata !1, metadata !4, metadata !"foo", metadata !"foo", metadata !"_ZN1C3fooEv", i32 2, metadata !14, i1 false, i1 false, i32 1, i32 0, metadata !"_ZTS1C", i32 256, i1 false, null, null, i32 0, metadata !17, i32 2} ; [ DW_TAG_subprogram ] [line 2] [foo]
|
||||
!13 = metadata !{i32 786478, metadata !1, metadata !"_ZTS1C", metadata !"foo", metadata !"foo", metadata !"_ZN1C3fooEv", i32 2, metadata !14, i1 false, i1 false, i32 1, i32 0, metadata !"_ZTS1C", i32 256, i1 false, null, null, i32 0, metadata !17, i32 2} ; [ DW_TAG_subprogram ] [line 2] [foo]
|
||||
!14 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !15, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
||||
!15 = metadata !{null, metadata !16}
|
||||
!16 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 1088, metadata !"_ZTS1C"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [artificial] [from _ZTS1C]
|
||||
|
@ -404,7 +404,7 @@ struct BreakpointPrinter : public ModulePass {
|
||||
"A MDNode in llvm.dbg.sp should be null or a DISubprogram.");
|
||||
if (!SP)
|
||||
continue;
|
||||
getContextName(SP.getContext(), Name);
|
||||
getContextName(SP.getContext().resolve(TypeIdentifierMap), Name);
|
||||
Name = Name + SP.getDisplayName().str();
|
||||
if (!Name.empty() && Processed.insert(Name)) {
|
||||
Out << Name << "\n";
|
||||
|
Loading…
Reference in New Issue
Block a user