Fix debug_inlined section entries for routines whose names are changed through __asm() extension.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92533 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel 2010-01-04 23:04:36 +00:00
parent 1d44df6afe
commit ba1d8264e6
2 changed files with 25 additions and 5 deletions

View File

@ -1393,7 +1393,16 @@ DIE *DwarfDebug::constructInlinedScopeDIE(DbgScope *Scope) {
I->second.push_back(std::make_pair(StartID, ScopeDIE));
StringPool.insert(InlinedSP.getName());
StringPool.insert(InlinedSP.getLinkageName());
StringRef LinkageName = InlinedSP.getLinkageName();
if (!LinkageName.empty()) {
// Skip special LLVM prefix that is used to inform the asm printer to not
// emit usual symbol prefix before the symbol name. This happens for
// Objective-C symbol names and symbol whose name is replaced using GCC's
// __asm__ attribute.
if (LinkageName[0] == 1)
LinkageName = LinkageName.substr(1);
}
StringPool.insert(LinkageName);
DILocation DL(Scope->getInlinedAt());
addUInt(ScopeDIE, dwarf::DW_AT_call_file, 0, ModuleCU->getID());
addUInt(ScopeDIE, dwarf::DW_AT_call_line, 0, DL.getLineNumber());
@ -2918,8 +2927,6 @@ void DwarfDebug::emitDebugInlineInfo() {
for (SmallVector<MDNode *, 4>::iterator I = InlinedSPNodes.begin(),
E = InlinedSPNodes.end(); I != E; ++I) {
// for (ValueMap<MDNode *, SmallVector<InlineInfoLabels, 4> >::iterator
// I = InlineInfo.begin(), E = InlineInfo.end(); I != E; ++I) {
MDNode *Node = *I;
ValueMap<MDNode *, SmallVector<InlineInfoLabels, 4> >::iterator II
= InlineInfo.find(Node);
@ -2937,13 +2944,11 @@ void DwarfDebug::emitDebugInlineInfo() {
// __asm__ attribute.
if (LName[0] == 1)
LName = LName.substr(1);
// Asm->EmitString(LName);
EmitSectionOffset("string", "section_str",
StringPool.idFor(LName), false, true);
}
Asm->EOL("MIPS linkage name");
// Asm->EmitString(Name);
EmitSectionOffset("string", "section_str",
StringPool.idFor(Name), false, true);
Asm->EOL("Function name");

View File

@ -0,0 +1,15 @@
// RUN: %llvmgcc -O2 -S -g %s -o - | llc -o 2010-01-05-LinkageName.s -O0
// RUN: %compile_c 2010-01-05-LinkageName.s -o 2010-01-05-LinkageName.s
struct tm {};
long mktime(struct tm *) __asm("_mktime$UNIX2003");
tzload(name, sp, doextend){}
long mktime(tmp)
struct tm *const tmp;
{
tzset();
}
timelocal(tmp) {
return mktime(tmp);
}