// Debug info constants.
enum {
- LLVMDebugVersion = (5 << 16), // Current version of debug information.
+ LLVMDebugVersion = (6 << 16), // Current version of debug information.
+ LLVMDebugVersion5 = (5 << 16), // Constant for version 5.
LLVMDebugVersion4 = (4 << 16), // Constant for version 4.
LLVMDebugVersionMask = 0xffff0000 // Mask for version number.
};
private:
DebugInfoDesc *Context; // Context debug descriptor.
std::string Name; // Global name.
- std::string DisplayName; // C++ unmangled name.
+ std::string FullName; // Fully qualified name.
+ std::string LinkageName; // Name for binding to MIPS linkage.
DebugInfoDesc *File; // Defined compile unit (may be NULL.)
unsigned Line; // Defined line# (may be zero.)
DebugInfoDesc *TyDesc; // Type debug descriptor.
// Accessors
DebugInfoDesc *getContext() const { return Context; }
const std::string &getName() const { return Name; }
- const std::string &getDisplayName() const { return DisplayName; }
+ const std::string &getFullName() const { return FullName; }
+ const std::string &getLinkageName() const { return LinkageName; }
CompileUnitDesc *getFile() const {
return static_cast<CompileUnitDesc *>(File);
}
bool isDefinition() const { return IsDefinition; }
void setContext(DebugInfoDesc *C) { Context = C; }
void setName(const std::string &N) { Name = N; }
- void setDisplayName(const std::string &N) { DisplayName = N; }
+ void setFullName(const std::string &N) { FullName = N; }
+ void setLinkageName(const std::string &N) { LinkageName = N; }
void setFile(CompileUnitDesc *U) {
File = static_cast<DebugInfoDesc *>(U);
}
}
void setIsStatic(bool IS) { IsStatic = IS; }
void setIsDefinition(bool ID) { IsDefinition = ID; }
- bool hasMangledName() const {
- return !DisplayName.empty();
- }
/// ApplyToFields - Target the visitor to the fields of the GlobalDesc.
///
DIE *Static = new DIE(DW_TAG_variable);
// Add name and mangled name.
- const std::string &Name = StaticDesc->getDisplayName();
- const std::string &MangledName = StaticDesc->getName();
+ const std::string &Name = StaticDesc->getName();
+ const std::string &LinkageName = StaticDesc->getLinkageName();
AddString(Static, DW_AT_name, DW_FORM_string, Name);
- AddString(Static, DW_AT_MIPS_linkage_name, DW_FORM_string,
- MangledName);
+ if (!LinkageName.empty()) {
+ AddString(Static, DW_AT_MIPS_linkage_name, DW_FORM_string,
+ LinkageName);
+ }
// Add location.
AddSourceLine(Static, StaticDesc->getFile(), StaticDesc->getLine());
DIE *Method = new DIE(DW_TAG_subprogram);
// Add name and mangled name.
- const std::string &Name = MethodDesc->getDisplayName();
- const std::string &MangledName = MethodDesc->getName();
- bool IsCTor = false;
+ const std::string &Name = MethodDesc->getName();
+ const std::string &LinkageName = MethodDesc->getLinkageName();
+
+ AddString(Method, DW_AT_name, DW_FORM_string, Name);
+ bool IsCTor = TyDesc->getName() == Name;
- if (Name.empty()) {
- AddString(Method, DW_AT_name, DW_FORM_string, MangledName);
- IsCTor = TyDesc->getName() == MangledName;
- } else {
- AddString(Method, DW_AT_name, DW_FORM_string, Name);
+ if (!LinkageName.empty()) {
AddString(Method, DW_AT_MIPS_linkage_name, DW_FORM_string,
- MangledName);
+ LinkageName);
}
// Add location.
// Get the global variable itself.
GlobalVariable *GV = GVD->getGlobalVariable();
- const std::string &Name = GVD->hasMangledName() ? GVD->getDisplayName()
- : GVD->getName();
- const std::string &MangledName = GVD->hasMangledName() ? GVD->getName()
- : "";
+ const std::string &Name = GVD->getName();
+ const std::string &FullName = GVD->getFullName();
+ const std::string &LinkageName = GVD->getLinkageName();
// Create the global's variable DIE.
DIE *VariableDie = new DIE(DW_TAG_variable);
AddString(VariableDie, DW_AT_name, DW_FORM_string, Name);
- if (!MangledName.empty()) {
+ if (!LinkageName.empty()) {
AddString(VariableDie, DW_AT_MIPS_linkage_name, DW_FORM_string,
- MangledName);
+ LinkageName);
}
AddType(VariableDie, GVD->getType(), Unit);
AddUInt(VariableDie, DW_AT_external, DW_FORM_flag, 1);
// Add source line info if available.
AddSourceLine(VariableDie, UnitDesc, GVD->getLine());
- // Work up linkage name.
- const std::string LinkageName = Asm->getGlobalLinkName(GV);
-
// Add address.
DIEBlock *Block = new DIEBlock();
AddUInt(Block, 0, DW_FORM_data1, DW_OP_addr);
- AddObjectLabel(Block, 0, DW_FORM_udata, LinkageName);
- AddBlock(VariableDie, DW_AT_location, 0, Block);
+ AddObjectLabel(Block, 0, DW_FORM_udata, Asm->getGlobalLinkName(GV));
+ AddBlock(VariableDie, DW_AT_location, 0, Block);
// Add to map.
Slot = VariableDie;
// Expose as global.
// FIXME - need to check external flag.
- Unit->AddGlobal(Name, VariableDie);
+ Unit->AddGlobal(FullName, VariableDie);
return VariableDie;
}
if (Slot) return Slot;
// Gather the details (simplify add attribute code.)
- const std::string &Name = SPD->hasMangledName() ? SPD->getDisplayName()
- : SPD->getName();
- const std::string &MangledName = SPD->hasMangledName() ? SPD->getName()
- : "";
+ const std::string &Name = SPD->getName();
+ const std::string &FullName = SPD->getFullName();
+ const std::string &LinkageName = SPD->getLinkageName();
unsigned IsExternal = SPD->isStatic() ? 0 : 1;
DIE *SubprogramDie = new DIE(DW_TAG_subprogram);
AddString(SubprogramDie, DW_AT_name, DW_FORM_string, Name);
- if (!MangledName.empty()) {
+ if (!LinkageName.empty()) {
AddString(SubprogramDie, DW_AT_MIPS_linkage_name, DW_FORM_string,
- MangledName);
+ LinkageName);
}
if (SPD->getType()) AddType(SubprogramDie, SPD->getType(), Unit);
AddUInt(SubprogramDie, DW_AT_external, DW_FORM_flag, IsExternal);
Unit->getDie()->AddChild(SubprogramDie);
// Expose as global.
- Unit->AddGlobal(Name, SubprogramDie);
+ Unit->AddGlobal(FullName, SubprogramDie);
return SubprogramDie;
}
: AnchoredDesc(T)
, Context(0)
, Name("")
-, DisplayName("")
+, FullName("")
+, LinkageName("")
, File(NULL)
, Line(0)
, TyDesc(NULL)
Visitor->Apply(Context);
Visitor->Apply(Name);
- if (getVersion() > LLVMDebugVersion4) Visitor->Apply(DisplayName);
+ Visitor->Apply(FullName);
+ Visitor->Apply(LinkageName);
Visitor->Apply(File);
Visitor->Apply(Line);
Visitor->Apply(TyDesc);
<< "Tag(" << getTag() << "), "
<< "Anchor(" << getAnchor() << "), "
<< "Name(\"" << getName() << "\"), "
- << "DisplayName(\"" << getDisplayName() << "\"), "
+ << "FullName(\"" << getFullName() << "\"), "
+ << "LinkageName(\"" << getLinkageName() << "\"), "
<< "File(" << getFile() << "),"
<< "Line(" << getLine() << "),"
<< "Type(" << getType() << "), "
<< "Tag(" << getTag() << "), "
<< "Anchor(" << getAnchor() << "), "
<< "Name(\"" << getName() << "\"), "
- << "DisplayName(\"" << getDisplayName() << "\"), "
+ << "FullName(\"" << getFullName() << "\"), "
+ << "LinkageName(\"" << getLinkageName() << "\"), "
<< "File(" << getFile() << "),"
<< "Line(" << getLine() << "),"
<< "Type(" << getType() << "), "