mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
Pass in a std::string when getting the names of debugging things. This cuts down
on the number of times a std::string is created and copied. llvm-svn: 66396
This commit is contained in:
parent
7253459805
commit
13fcab1ef3
@ -40,7 +40,7 @@ namespace llvm {
|
|||||||
/// not, the debug info is corrupt and we ignore it.
|
/// not, the debug info is corrupt and we ignore it.
|
||||||
DIDescriptor(GlobalVariable *GV, unsigned RequiredTag);
|
DIDescriptor(GlobalVariable *GV, unsigned RequiredTag);
|
||||||
|
|
||||||
std::string getStringField(unsigned Elt) const;
|
const std::string &getStringField(unsigned Elt, std::string &Result) const;
|
||||||
unsigned getUnsignedField(unsigned Elt) const {
|
unsigned getUnsignedField(unsigned Elt) const {
|
||||||
return (unsigned)getUInt64Field(Elt);
|
return (unsigned)getUInt64Field(Elt);
|
||||||
}
|
}
|
||||||
@ -106,9 +106,15 @@ namespace llvm {
|
|||||||
explicit DICompileUnit(GlobalVariable *GV = 0);
|
explicit DICompileUnit(GlobalVariable *GV = 0);
|
||||||
|
|
||||||
unsigned getLanguage() const { return getUnsignedField(2); }
|
unsigned getLanguage() const { return getUnsignedField(2); }
|
||||||
std::string getFilename() const { return getStringField(3); }
|
const std::string &getFilename(std::string &F) const {
|
||||||
std::string getDirectory() const { return getStringField(4); }
|
return getStringField(3, F);
|
||||||
std::string getProducer() const { return getStringField(5); }
|
}
|
||||||
|
const std::string &getDirectory(std::string &F) const {
|
||||||
|
return getStringField(4, F);
|
||||||
|
}
|
||||||
|
const std::string &getProducer(std::string &F) const {
|
||||||
|
return getStringField(5, F);
|
||||||
|
}
|
||||||
|
|
||||||
/// isMain - Each input file is encoded as a separate compile unit in LLVM
|
/// isMain - Each input file is encoded as a separate compile unit in LLVM
|
||||||
/// debugging information output. However, many target specific tool chains
|
/// debugging information output. However, many target specific tool chains
|
||||||
@ -121,7 +127,9 @@ namespace llvm {
|
|||||||
|
|
||||||
bool isMain() const { return getUnsignedField(6); }
|
bool isMain() const { return getUnsignedField(6); }
|
||||||
bool isOptimized() const { return getUnsignedField(7); }
|
bool isOptimized() const { return getUnsignedField(7); }
|
||||||
std::string getFlags() const { return getStringField(8); }
|
const std::string &getFlags(std::string &F) const {
|
||||||
|
return getStringField(8, F);
|
||||||
|
}
|
||||||
unsigned getRunTimeVersion() const { return getUnsignedField(9); }
|
unsigned getRunTimeVersion() const { return getUnsignedField(9); }
|
||||||
|
|
||||||
/// Verify - Verify that a compile unit is well formed.
|
/// Verify - Verify that a compile unit is well formed.
|
||||||
@ -138,7 +146,9 @@ namespace llvm {
|
|||||||
public:
|
public:
|
||||||
explicit DIEnumerator(GlobalVariable *GV = 0);
|
explicit DIEnumerator(GlobalVariable *GV = 0);
|
||||||
|
|
||||||
std::string getName() const { return getStringField(1); }
|
const std::string &getName(std::string &F) const {
|
||||||
|
return getStringField(1, F);
|
||||||
|
}
|
||||||
uint64_t getEnumValue() const { return getUInt64Field(2); }
|
uint64_t getEnumValue() const { return getUInt64Field(2); }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -182,7 +192,9 @@ namespace llvm {
|
|||||||
virtual ~DIType() {}
|
virtual ~DIType() {}
|
||||||
|
|
||||||
DIDescriptor getContext() const { return getDescriptorField(1); }
|
DIDescriptor getContext() const { return getDescriptorField(1); }
|
||||||
std::string getName() const { return getStringField(2); }
|
const std::string &getName(std::string &F) const {
|
||||||
|
return getStringField(2, F);
|
||||||
|
}
|
||||||
DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(3); }
|
DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(3); }
|
||||||
unsigned getLineNumber() const { return getUnsignedField(4); }
|
unsigned getLineNumber() const { return getUnsignedField(4); }
|
||||||
uint64_t getSizeInBits() const { return getUInt64Field(5); }
|
uint64_t getSizeInBits() const { return getUInt64Field(5); }
|
||||||
@ -264,9 +276,15 @@ namespace llvm {
|
|||||||
virtual ~DIGlobal() {}
|
virtual ~DIGlobal() {}
|
||||||
|
|
||||||
DIDescriptor getContext() const { return getDescriptorField(2); }
|
DIDescriptor getContext() const { return getDescriptorField(2); }
|
||||||
std::string getName() const { return getStringField(3); }
|
const std::string &getName(std::string &F) const {
|
||||||
std::string getDisplayName() const { return getStringField(4); }
|
return getStringField(3, F);
|
||||||
std::string getLinkageName() const { return getStringField(5); }
|
}
|
||||||
|
const std::string &getDisplayName(std::string &F) const {
|
||||||
|
return getStringField(4, F);
|
||||||
|
}
|
||||||
|
const std::string &getLinkageName(std::string &F) const {
|
||||||
|
return getStringField(5, F);
|
||||||
|
}
|
||||||
DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(6); }
|
DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(6); }
|
||||||
unsigned getLineNumber() const { return getUnsignedField(7); }
|
unsigned getLineNumber() const { return getUnsignedField(7); }
|
||||||
DIType getType() const { return getFieldAs<DIType>(8); }
|
DIType getType() const { return getFieldAs<DIType>(8); }
|
||||||
@ -313,7 +331,9 @@ namespace llvm {
|
|||||||
explicit DIVariable(GlobalVariable *GV = 0);
|
explicit DIVariable(GlobalVariable *GV = 0);
|
||||||
|
|
||||||
DIDescriptor getContext() const { return getDescriptorField(1); }
|
DIDescriptor getContext() const { return getDescriptorField(1); }
|
||||||
std::string getName() const { return getStringField(2); }
|
const std::string &getName(std::string &F) const {
|
||||||
|
return getStringField(2, F);
|
||||||
|
}
|
||||||
DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(3); }
|
DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(3); }
|
||||||
unsigned getLineNumber() const { return getUnsignedField(4); }
|
unsigned getLineNumber() const { return getUnsignedField(4); }
|
||||||
DIType getType() const { return getFieldAs<DIType>(5); }
|
DIType getType() const { return getFieldAs<DIType>(5); }
|
||||||
|
@ -59,8 +59,9 @@ void PrintDbgInfo::printVariableDeclaration(const Value *V)
|
|||||||
{
|
{
|
||||||
if(const DbgDeclareInst* DDI = findDbgDeclare(V)) {
|
if(const DbgDeclareInst* DDI = findDbgDeclare(V)) {
|
||||||
DIVariable Var(cast<GlobalVariable>(DDI->getVariable()));
|
DIVariable Var(cast<GlobalVariable>(DDI->getVariable()));
|
||||||
Out << "; variable " << Var.getName()
|
std::string Res1, Res2;
|
||||||
<< " of type " << Var.getType().getName()
|
Out << "; variable " << Var.getName(Res1)
|
||||||
|
<< " of type " << Var.getType().getName(Res2)
|
||||||
<< " at line " << Var.getLineNumber() << "\n";
|
<< " at line " << Var.getLineNumber() << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,8 +84,9 @@ void PrintDbgInfo::printStopPoint(const DbgStopPointInst *DSI)
|
|||||||
void PrintDbgInfo::printFuncStart(const DbgFuncStartInst *FS)
|
void PrintDbgInfo::printFuncStart(const DbgFuncStartInst *FS)
|
||||||
{
|
{
|
||||||
DISubprogram Subprogram(cast<GlobalVariable>(FS->getSubprogram()));
|
DISubprogram Subprogram(cast<GlobalVariable>(FS->getSubprogram()));
|
||||||
Out << ";fully qualified function name: " << Subprogram.getDisplayName()
|
std::string Res1, Res2;
|
||||||
<< " return type: " << Subprogram.getType().getName()
|
Out << ";fully qualified function name: " << Subprogram.getDisplayName(Res1)
|
||||||
|
<< " return type: " << Subprogram.getType().getName(Res2)
|
||||||
<< " at line " << Subprogram.getLineNumber()
|
<< " at line " << Subprogram.getLineNumber()
|
||||||
<< "\n\n";
|
<< "\n\n";
|
||||||
}
|
}
|
||||||
|
@ -35,17 +35,23 @@ DIDescriptor::DIDescriptor(GlobalVariable *gv, unsigned RequiredTag) {
|
|||||||
GV = 0;
|
GV = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string &
|
||||||
|
DIDescriptor::getStringField(unsigned Elt, std::string &Result) const {
|
||||||
|
if (GV == 0) {
|
||||||
|
Result.clear();
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
std::string DIDescriptor::getStringField(unsigned Elt) const {
|
|
||||||
if (GV == 0) return "";
|
|
||||||
Constant *C = GV->getInitializer();
|
Constant *C = GV->getInitializer();
|
||||||
if (C == 0 || Elt >= C->getNumOperands())
|
if (C == 0 || Elt >= C->getNumOperands()) {
|
||||||
return "";
|
Result.clear();
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
std::string Result;
|
|
||||||
// Fills in the string if it succeeds
|
// Fills in the string if it succeeds
|
||||||
if (!GetConstantStringInfo(C->getOperand(Elt), Result))
|
if (!GetConstantStringInfo(C->getOperand(Elt), Result))
|
||||||
Result.clear();
|
Result.clear();
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +65,6 @@ uint64_t DIDescriptor::getUInt64Field(unsigned Elt) const {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DIDescriptor DIDescriptor::getDescriptorField(unsigned Elt) const {
|
DIDescriptor DIDescriptor::getDescriptorField(unsigned Elt) const {
|
||||||
if (GV == 0) return DIDescriptor();
|
if (GV == 0) return DIDescriptor();
|
||||||
Constant *C = GV->getInitializer();
|
Constant *C = GV->getInitializer();
|
||||||
@ -185,7 +190,8 @@ unsigned DIArray::getNumElements() const {
|
|||||||
bool DICompileUnit::Verify() const {
|
bool DICompileUnit::Verify() const {
|
||||||
if (isNull())
|
if (isNull())
|
||||||
return false;
|
return false;
|
||||||
if (getFilename().empty())
|
std::string Res;
|
||||||
|
if (getFilename(Res).empty())
|
||||||
return false;
|
return false;
|
||||||
// It is possible that directory and produce string is empty.
|
// It is possible that directory and produce string is empty.
|
||||||
return true;
|
return true;
|
||||||
@ -864,16 +870,22 @@ namespace llvm {
|
|||||||
void DICompileUnit::dump() const {
|
void DICompileUnit::dump() const {
|
||||||
if (getLanguage())
|
if (getLanguage())
|
||||||
cerr << " [" << dwarf::LanguageString(getLanguage()) << "] ";
|
cerr << " [" << dwarf::LanguageString(getLanguage()) << "] ";
|
||||||
cerr << " [" << getDirectory() << "/" << getFilename() << " ]";
|
|
||||||
|
std::string Res1, Res2;
|
||||||
|
cerr << " [" << getDirectory(Res1) << "/" << getFilename(Res2) << " ]";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// dump - print type.
|
/// dump - print type.
|
||||||
void DIType::dump() const {
|
void DIType::dump() const {
|
||||||
if (isNull()) return;
|
if (isNull()) return;
|
||||||
if (!getName().empty())
|
|
||||||
cerr << " [" << getName() << "] ";
|
std::string Res;
|
||||||
|
if (!getName(Res).empty())
|
||||||
|
cerr << " [" << Res << "] ";
|
||||||
|
|
||||||
unsigned Tag = getTag();
|
unsigned Tag = getTag();
|
||||||
cerr << " [" << dwarf::TagString(Tag) << "] ";
|
cerr << " [" << dwarf::TagString(Tag) << "] ";
|
||||||
|
|
||||||
// TODO : Print context
|
// TODO : Print context
|
||||||
getCompileUnit().dump();
|
getCompileUnit().dump();
|
||||||
cerr << " ["
|
cerr << " ["
|
||||||
@ -882,10 +894,12 @@ void DIType::dump() const {
|
|||||||
<< getAlignInBits() << ", "
|
<< getAlignInBits() << ", "
|
||||||
<< getOffsetInBits()
|
<< getOffsetInBits()
|
||||||
<< "] ";
|
<< "] ";
|
||||||
|
|
||||||
if (isPrivate())
|
if (isPrivate())
|
||||||
cerr << " [private] ";
|
cerr << " [private] ";
|
||||||
else if (isProtected())
|
else if (isProtected())
|
||||||
cerr << " [protected] ";
|
cerr << " [protected] ";
|
||||||
|
|
||||||
if (isForwardDecl())
|
if (isForwardDecl())
|
||||||
cerr << " [fwd] ";
|
cerr << " [fwd] ";
|
||||||
|
|
||||||
@ -899,6 +913,7 @@ void DIType::dump() const {
|
|||||||
cerr << "Invalid DIType\n";
|
cerr << "Invalid DIType\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cerr << "\n";
|
cerr << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -923,16 +938,20 @@ void DICompositeType::dump() const {
|
|||||||
|
|
||||||
/// dump - print global.
|
/// dump - print global.
|
||||||
void DIGlobal::dump() const {
|
void DIGlobal::dump() const {
|
||||||
|
std::string Res;
|
||||||
|
if (!getName(Res).empty())
|
||||||
|
cerr << " [" << Res << "] ";
|
||||||
|
|
||||||
if (!getName().empty())
|
|
||||||
cerr << " [" << getName() << "] ";
|
|
||||||
unsigned Tag = getTag();
|
unsigned Tag = getTag();
|
||||||
cerr << " [" << dwarf::TagString(Tag) << "] ";
|
cerr << " [" << dwarf::TagString(Tag) << "] ";
|
||||||
|
|
||||||
// TODO : Print context
|
// TODO : Print context
|
||||||
getCompileUnit().dump();
|
getCompileUnit().dump();
|
||||||
cerr << " [" << getLineNumber() << "] ";
|
cerr << " [" << getLineNumber() << "] ";
|
||||||
|
|
||||||
if (isLocalToUnit())
|
if (isLocalToUnit())
|
||||||
cerr << " [local] ";
|
cerr << " [local] ";
|
||||||
|
|
||||||
if (isDefinition())
|
if (isDefinition())
|
||||||
cerr << " [def] ";
|
cerr << " [def] ";
|
||||||
|
|
||||||
@ -954,8 +973,10 @@ void DIGlobalVariable::dump() const {
|
|||||||
|
|
||||||
/// dump - print variable.
|
/// dump - print variable.
|
||||||
void DIVariable::dump() const {
|
void DIVariable::dump() const {
|
||||||
if (!getName().empty())
|
std::string Res;
|
||||||
cerr << " [" << getName() << "] ";
|
if (!getName(Res).empty())
|
||||||
|
cerr << " [" << Res << "] ";
|
||||||
|
|
||||||
getCompileUnit().dump();
|
getCompileUnit().dump();
|
||||||
cerr << " [" << getLineNumber() << "] ";
|
cerr << " [" << getLineNumber() << "] ";
|
||||||
getType().dump();
|
getType().dump();
|
||||||
|
@ -1622,7 +1622,8 @@ private:
|
|||||||
DIBasicType BTy) {
|
DIBasicType BTy) {
|
||||||
|
|
||||||
// Get core information.
|
// Get core information.
|
||||||
const std::string &Name = BTy.getName();
|
std::string Name;
|
||||||
|
BTy.getName(Name);
|
||||||
Buffer.setTag(DW_TAG_base_type);
|
Buffer.setTag(DW_TAG_base_type);
|
||||||
AddUInt(&Buffer, DW_AT_encoding, DW_FORM_data1, BTy.getEncoding());
|
AddUInt(&Buffer, DW_AT_encoding, DW_FORM_data1, BTy.getEncoding());
|
||||||
// Add name if not anonymous or intermediate type.
|
// Add name if not anonymous or intermediate type.
|
||||||
@ -1637,13 +1638,16 @@ private:
|
|||||||
DIDerivedType DTy) {
|
DIDerivedType DTy) {
|
||||||
|
|
||||||
// Get core information.
|
// Get core information.
|
||||||
const std::string &Name = DTy.getName();
|
std::string Name;
|
||||||
|
DTy.getName(Name);
|
||||||
uint64_t Size = DTy.getSizeInBits() >> 3;
|
uint64_t Size = DTy.getSizeInBits() >> 3;
|
||||||
unsigned Tag = DTy.getTag();
|
unsigned Tag = DTy.getTag();
|
||||||
|
|
||||||
// FIXME - Workaround for templates.
|
// FIXME - Workaround for templates.
|
||||||
if (Tag == DW_TAG_inheritance) Tag = DW_TAG_reference_type;
|
if (Tag == DW_TAG_inheritance) Tag = DW_TAG_reference_type;
|
||||||
|
|
||||||
Buffer.setTag(Tag);
|
Buffer.setTag(Tag);
|
||||||
|
|
||||||
// Map to main type, void will not have a type.
|
// Map to main type, void will not have a type.
|
||||||
DIType FromTy = DTy.getTypeDerivedFrom();
|
DIType FromTy = DTy.getTypeDerivedFrom();
|
||||||
AddType(DW_Unit, &Buffer, FromTy);
|
AddType(DW_Unit, &Buffer, FromTy);
|
||||||
@ -1665,12 +1669,14 @@ private:
|
|||||||
/// ConstructTypeDIE - Construct type DIE from DICompositeType.
|
/// ConstructTypeDIE - Construct type DIE from DICompositeType.
|
||||||
void ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer,
|
void ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer,
|
||||||
DICompositeType CTy) {
|
DICompositeType CTy) {
|
||||||
|
|
||||||
// Get core information.
|
// Get core information.
|
||||||
const std::string &Name = CTy.getName();
|
std::string Name;
|
||||||
|
CTy.getName(Name);
|
||||||
|
|
||||||
uint64_t Size = CTy.getSizeInBits() >> 3;
|
uint64_t Size = CTy.getSizeInBits() >> 3;
|
||||||
unsigned Tag = CTy.getTag();
|
unsigned Tag = CTy.getTag();
|
||||||
Buffer.setTag(Tag);
|
Buffer.setTag(Tag);
|
||||||
|
|
||||||
switch (Tag) {
|
switch (Tag) {
|
||||||
case DW_TAG_vector_type:
|
case DW_TAG_vector_type:
|
||||||
case DW_TAG_array_type:
|
case DW_TAG_array_type:
|
||||||
@ -1806,7 +1812,8 @@ private:
|
|||||||
DIE *ConstructEnumTypeDIE(CompileUnit *DW_Unit, DIEnumerator *ETy) {
|
DIE *ConstructEnumTypeDIE(CompileUnit *DW_Unit, DIEnumerator *ETy) {
|
||||||
|
|
||||||
DIE *Enumerator = new DIE(DW_TAG_enumerator);
|
DIE *Enumerator = new DIE(DW_TAG_enumerator);
|
||||||
const std::string &Name = ETy->getName();
|
std::string Name;
|
||||||
|
ETy->getName(Name);
|
||||||
AddString(Enumerator, DW_AT_name, DW_FORM_string, Name);
|
AddString(Enumerator, DW_AT_name, DW_FORM_string, Name);
|
||||||
int64_t Value = ETy->getEnumValue();
|
int64_t Value = ETy->getEnumValue();
|
||||||
AddSInt(Enumerator, DW_AT_const_value, DW_FORM_sdata, Value);
|
AddSInt(Enumerator, DW_AT_const_value, DW_FORM_sdata, Value);
|
||||||
@ -1817,9 +1824,11 @@ private:
|
|||||||
DIE *CreateGlobalVariableDIE(CompileUnit *DW_Unit, const DIGlobalVariable &GV)
|
DIE *CreateGlobalVariableDIE(CompileUnit *DW_Unit, const DIGlobalVariable &GV)
|
||||||
{
|
{
|
||||||
DIE *GVDie = new DIE(DW_TAG_variable);
|
DIE *GVDie = new DIE(DW_TAG_variable);
|
||||||
const std::string &Name = GV.getDisplayName();
|
std::string Name;
|
||||||
|
GV.getDisplayName(Name);
|
||||||
AddString(GVDie, DW_AT_name, DW_FORM_string, Name);
|
AddString(GVDie, DW_AT_name, DW_FORM_string, Name);
|
||||||
const std::string &LinkageName = GV.getLinkageName();
|
std::string LinkageName;
|
||||||
|
GV.getLinkageName(LinkageName);
|
||||||
if (!LinkageName.empty())
|
if (!LinkageName.empty())
|
||||||
AddString(GVDie, DW_AT_MIPS_linkage_name, DW_FORM_string, LinkageName);
|
AddString(GVDie, DW_AT_MIPS_linkage_name, DW_FORM_string, LinkageName);
|
||||||
AddType(DW_Unit, GVDie, GV.getType());
|
AddType(DW_Unit, GVDie, GV.getType());
|
||||||
@ -1832,7 +1841,8 @@ private:
|
|||||||
/// CreateMemberDIE - Create new member DIE.
|
/// CreateMemberDIE - Create new member DIE.
|
||||||
DIE *CreateMemberDIE(CompileUnit *DW_Unit, const DIDerivedType &DT) {
|
DIE *CreateMemberDIE(CompileUnit *DW_Unit, const DIDerivedType &DT) {
|
||||||
DIE *MemberDie = new DIE(DT.getTag());
|
DIE *MemberDie = new DIE(DT.getTag());
|
||||||
const std::string &Name = DT.getName();
|
std::string Name;
|
||||||
|
DT.getName(Name);
|
||||||
if (!Name.empty())
|
if (!Name.empty())
|
||||||
AddString(MemberDie, DW_AT_name, DW_FORM_string, Name);
|
AddString(MemberDie, DW_AT_name, DW_FORM_string, Name);
|
||||||
|
|
||||||
@ -1876,9 +1886,11 @@ private:
|
|||||||
const DISubprogram &SP,
|
const DISubprogram &SP,
|
||||||
bool IsConstructor = false) {
|
bool IsConstructor = false) {
|
||||||
DIE *SPDie = new DIE(DW_TAG_subprogram);
|
DIE *SPDie = new DIE(DW_TAG_subprogram);
|
||||||
const std::string &Name = SP.getName();
|
std::string Name;
|
||||||
|
SP.getName(Name);
|
||||||
AddString(SPDie, DW_AT_name, DW_FORM_string, Name);
|
AddString(SPDie, DW_AT_name, DW_FORM_string, Name);
|
||||||
const std::string &LinkageName = SP.getLinkageName();
|
std::string LinkageName;
|
||||||
|
SP.getLinkageName(LinkageName);
|
||||||
if (!LinkageName.empty())
|
if (!LinkageName.empty())
|
||||||
AddString(SPDie, DW_AT_MIPS_linkage_name, DW_FORM_string,
|
AddString(SPDie, DW_AT_MIPS_linkage_name, DW_FORM_string,
|
||||||
LinkageName);
|
LinkageName);
|
||||||
@ -1945,7 +1957,8 @@ private:
|
|||||||
|
|
||||||
// Define variable debug information entry.
|
// Define variable debug information entry.
|
||||||
DIE *VariableDie = new DIE(Tag);
|
DIE *VariableDie = new DIE(Tag);
|
||||||
const std::string &Name = VD.getName();
|
std::string Name;
|
||||||
|
VD.getName(Name);
|
||||||
AddString(VariableDie, DW_AT_name, DW_FORM_string, Name);
|
AddString(VariableDie, DW_AT_name, DW_FORM_string, Name);
|
||||||
|
|
||||||
// Add source line info if available.
|
// Add source line info if available.
|
||||||
@ -2769,21 +2782,23 @@ private:
|
|||||||
|
|
||||||
void ConstructCompileUnit(GlobalVariable *GV) {
|
void ConstructCompileUnit(GlobalVariable *GV) {
|
||||||
DICompileUnit DIUnit(GV);
|
DICompileUnit DIUnit(GV);
|
||||||
unsigned ID = getOrCreateSourceID(DIUnit.getDirectory(),
|
std::string Dir, FN, Prod;
|
||||||
DIUnit.getFilename());
|
unsigned ID = getOrCreateSourceID(DIUnit.getDirectory(Dir),
|
||||||
|
DIUnit.getFilename(FN));
|
||||||
|
|
||||||
DIE *Die = new DIE(DW_TAG_compile_unit);
|
DIE *Die = new DIE(DW_TAG_compile_unit);
|
||||||
AddSectionOffset(Die, DW_AT_stmt_list, DW_FORM_data4,
|
AddSectionOffset(Die, DW_AT_stmt_list, DW_FORM_data4,
|
||||||
DWLabel("section_line", 0), DWLabel("section_line", 0),
|
DWLabel("section_line", 0), DWLabel("section_line", 0),
|
||||||
false);
|
false);
|
||||||
AddString(Die, DW_AT_producer, DW_FORM_string, DIUnit.getProducer());
|
AddString(Die, DW_AT_producer, DW_FORM_string, DIUnit.getProducer(Prod));
|
||||||
AddUInt(Die, DW_AT_language, DW_FORM_data1, DIUnit.getLanguage());
|
AddUInt(Die, DW_AT_language, DW_FORM_data1, DIUnit.getLanguage());
|
||||||
AddString(Die, DW_AT_name, DW_FORM_string, DIUnit.getFilename());
|
AddString(Die, DW_AT_name, DW_FORM_string, FN);
|
||||||
if (!DIUnit.getDirectory().empty())
|
if (!Dir.empty())
|
||||||
AddString(Die, DW_AT_comp_dir, DW_FORM_string, DIUnit.getDirectory());
|
AddString(Die, DW_AT_comp_dir, DW_FORM_string, Dir);
|
||||||
if (DIUnit.isOptimized())
|
if (DIUnit.isOptimized())
|
||||||
AddUInt(Die, DW_AT_APPLE_optimized, DW_FORM_flag, 1);
|
AddUInt(Die, DW_AT_APPLE_optimized, DW_FORM_flag, 1);
|
||||||
const std::string &Flags = DIUnit.getFlags();
|
std::string Flags;
|
||||||
|
DIUnit.getFlags(Flags);
|
||||||
if (!Flags.empty())
|
if (!Flags.empty())
|
||||||
AddString(Die, DW_AT_APPLE_flags, DW_FORM_string, Flags);
|
AddString(Die, DW_AT_APPLE_flags, DW_FORM_string, Flags);
|
||||||
unsigned RVer = DIUnit.getRunTimeVersion();
|
unsigned RVer = DIUnit.getRunTimeVersion();
|
||||||
@ -2843,7 +2858,8 @@ private:
|
|||||||
// Add to context owner.
|
// Add to context owner.
|
||||||
DW_Unit->getDie()->AddChild(VariableDie);
|
DW_Unit->getDie()->AddChild(VariableDie);
|
||||||
// Expose as global. FIXME - need to check external flag.
|
// Expose as global. FIXME - need to check external flag.
|
||||||
DW_Unit->AddGlobal(DI_GV.getName(), VariableDie);
|
std::string Name;
|
||||||
|
DW_Unit->AddGlobal(DI_GV.getName(Name), VariableDie);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2895,7 +2911,8 @@ private:
|
|||||||
// Add to context owner.
|
// Add to context owner.
|
||||||
Unit->getDie()->AddChild(SubprogramDie);
|
Unit->getDie()->AddChild(SubprogramDie);
|
||||||
// Expose as global.
|
// Expose as global.
|
||||||
Unit->AddGlobal(SP.getName(), SubprogramDie);
|
std::string Name;
|
||||||
|
Unit->AddGlobal(SP.getName(Name), SubprogramDie);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,8 +319,9 @@ bool FastISel::SelectCall(User *I) {
|
|||||||
DbgStopPointInst *SPI = cast<DbgStopPointInst>(I);
|
DbgStopPointInst *SPI = cast<DbgStopPointInst>(I);
|
||||||
if (DW && DW->ValidDebugInfo(SPI->getContext())) {
|
if (DW && DW->ValidDebugInfo(SPI->getContext())) {
|
||||||
DICompileUnit CU(cast<GlobalVariable>(SPI->getContext()));
|
DICompileUnit CU(cast<GlobalVariable>(SPI->getContext()));
|
||||||
unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(),
|
std::string Dir, FN;
|
||||||
CU.getFilename());
|
unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(Dir),
|
||||||
|
CU.getFilename(FN));
|
||||||
unsigned Line = SPI->getLine();
|
unsigned Line = SPI->getLine();
|
||||||
unsigned Col = SPI->getColumn();
|
unsigned Col = SPI->getColumn();
|
||||||
unsigned ID = DW->RecordSourceLine(Line, Col, SrcFile);
|
unsigned ID = DW->RecordSourceLine(Line, Col, SrcFile);
|
||||||
@ -361,8 +362,9 @@ bool FastISel::SelectCall(User *I) {
|
|||||||
// (most?) gdb expects.
|
// (most?) gdb expects.
|
||||||
DISubprogram Subprogram(cast<GlobalVariable>(SP));
|
DISubprogram Subprogram(cast<GlobalVariable>(SP));
|
||||||
DICompileUnit CompileUnit = Subprogram.getCompileUnit();
|
DICompileUnit CompileUnit = Subprogram.getCompileUnit();
|
||||||
unsigned SrcFile = DW->getOrCreateSourceID(CompileUnit.getDirectory(),
|
std::string Dir, FN;
|
||||||
CompileUnit.getFilename());
|
unsigned SrcFile = DW->getOrCreateSourceID(CompileUnit.getDirectory(Dir),
|
||||||
|
CompileUnit.getFilename(FN));
|
||||||
|
|
||||||
// Record the source line but does not create a label for the normal
|
// Record the source line but does not create a label for the normal
|
||||||
// function start. It will be emitted at asm emission time. However,
|
// function start. It will be emitted at asm emission time. However,
|
||||||
|
@ -1287,8 +1287,9 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
|
|||||||
GlobalVariable *CU_GV = cast<GlobalVariable>(DSP->getCompileUnit());
|
GlobalVariable *CU_GV = cast<GlobalVariable>(DSP->getCompileUnit());
|
||||||
if (DW && (useDEBUG_LOC || useLABEL) && !CU_GV->isDeclaration()) {
|
if (DW && (useDEBUG_LOC || useLABEL) && !CU_GV->isDeclaration()) {
|
||||||
DICompileUnit CU(cast<GlobalVariable>(DSP->getCompileUnit()));
|
DICompileUnit CU(cast<GlobalVariable>(DSP->getCompileUnit()));
|
||||||
unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(),
|
std::string Dir, FN;
|
||||||
CU.getFilename());
|
unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(Dir),
|
||||||
|
CU.getFilename(FN));
|
||||||
|
|
||||||
unsigned Line = DSP->getLine();
|
unsigned Line = DSP->getLine();
|
||||||
unsigned Col = DSP->getColumn();
|
unsigned Col = DSP->getColumn();
|
||||||
|
@ -335,8 +335,9 @@ void FunctionLoweringInfo::set(Function &fn, MachineFunction &mf,
|
|||||||
|
|
||||||
if (DW && DW->ValidDebugInfo(SPI->getContext())) {
|
if (DW && DW->ValidDebugInfo(SPI->getContext())) {
|
||||||
DICompileUnit CU(cast<GlobalVariable>(SPI->getContext()));
|
DICompileUnit CU(cast<GlobalVariable>(SPI->getContext()));
|
||||||
unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(),
|
std::string Dir, FN;
|
||||||
CU.getFilename());
|
unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(Dir),
|
||||||
|
CU.getFilename(FN));
|
||||||
unsigned idx = MF->getOrCreateDebugLocID(SrcFile,
|
unsigned idx = MF->getOrCreateDebugLocID(SrcFile,
|
||||||
SPI->getLine(),
|
SPI->getLine(),
|
||||||
SPI->getColumn());
|
SPI->getColumn());
|
||||||
@ -354,8 +355,9 @@ void FunctionLoweringInfo::set(Function &fn, MachineFunction &mf,
|
|||||||
if (DW->ValidDebugInfo(SP)) {
|
if (DW->ValidDebugInfo(SP)) {
|
||||||
DISubprogram Subprogram(cast<GlobalVariable>(SP));
|
DISubprogram Subprogram(cast<GlobalVariable>(SP));
|
||||||
DICompileUnit CU(Subprogram.getCompileUnit());
|
DICompileUnit CU(Subprogram.getCompileUnit());
|
||||||
unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(),
|
std::string Dir, FN;
|
||||||
CU.getFilename());
|
unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(Dir),
|
||||||
|
CU.getFilename(FN));
|
||||||
unsigned Line = Subprogram.getLineNumber();
|
unsigned Line = Subprogram.getLineNumber();
|
||||||
DL = DebugLoc::get(MF->getOrCreateDebugLocID(SrcFile, Line, 0));
|
DL = DebugLoc::get(MF->getOrCreateDebugLocID(SrcFile, Line, 0));
|
||||||
}
|
}
|
||||||
@ -3902,8 +3904,9 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
|
|||||||
SPI.getColumn(),
|
SPI.getColumn(),
|
||||||
SPI.getContext()));
|
SPI.getContext()));
|
||||||
DICompileUnit CU(cast<GlobalVariable>(SPI.getContext()));
|
DICompileUnit CU(cast<GlobalVariable>(SPI.getContext()));
|
||||||
unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(),
|
std::string Dir, FN;
|
||||||
CU.getFilename());
|
unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(Dir),
|
||||||
|
CU.getFilename(FN));
|
||||||
unsigned idx = MF.getOrCreateDebugLocID(SrcFile,
|
unsigned idx = MF.getOrCreateDebugLocID(SrcFile,
|
||||||
SPI.getLine(), SPI.getColumn());
|
SPI.getLine(), SPI.getColumn());
|
||||||
setCurDebugLoc(DebugLoc::get(idx));
|
setCurDebugLoc(DebugLoc::get(idx));
|
||||||
@ -3947,8 +3950,9 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
|
|||||||
MachineFunction &MF = DAG.getMachineFunction();
|
MachineFunction &MF = DAG.getMachineFunction();
|
||||||
DISubprogram Subprogram(cast<GlobalVariable>(SP));
|
DISubprogram Subprogram(cast<GlobalVariable>(SP));
|
||||||
DICompileUnit CompileUnit = Subprogram.getCompileUnit();
|
DICompileUnit CompileUnit = Subprogram.getCompileUnit();
|
||||||
unsigned SrcFile = DW->getOrCreateSourceID(CompileUnit.getDirectory(),
|
std::string Dir, FN;
|
||||||
CompileUnit.getFilename());
|
unsigned SrcFile = DW->getOrCreateSourceID(CompileUnit.getDirectory(Dir),
|
||||||
|
CompileUnit.getFilename(FN));
|
||||||
|
|
||||||
// Record the source line but does not create a label for the normal
|
// Record the source line but does not create a label for the normal
|
||||||
// function start. It will be emitted at asm emission time. However,
|
// function start. It will be emitted at asm emission time. However,
|
||||||
|
@ -179,7 +179,8 @@ std::string DOTGraphTraits<SelectionDAG*>::getNodeLabel(const SDNode *Node,
|
|||||||
}
|
}
|
||||||
} else if (const DbgStopPointSDNode *D = dyn_cast<DbgStopPointSDNode>(Node)) {
|
} else if (const DbgStopPointSDNode *D = dyn_cast<DbgStopPointSDNode>(Node)) {
|
||||||
DICompileUnit CU(cast<GlobalVariable>(D->getCompileUnit()));
|
DICompileUnit CU(cast<GlobalVariable>(D->getCompileUnit()));
|
||||||
Op += ": " + CU.getFilename();
|
std::string FN;
|
||||||
|
Op += ": " + CU.getFilename(FN);
|
||||||
Op += ":" + utostr(D->getLine());
|
Op += ":" + utostr(D->getLine());
|
||||||
if (D->getColumn() != 0)
|
if (D->getColumn() != 0)
|
||||||
Op += ":" + utostr(D->getColumn());
|
Op += ":" + utostr(D->getColumn());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user