Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix debug info builds with inlining on #999

Merged
merged 1 commit into from
Jul 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion gen/dibuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,13 @@ void ldc::DIBuilder::EmitBlockEnd()

void ldc::DIBuilder::EmitStopPoint(Loc& loc)
{
if (!global.params.symdebug || !loc.linnum)
if (!global.params.symdebug)
return;

// If we already have a location set and the current loc is invalid
// (line 0), then we can just ignore it (see GitHub issue #998 for why we
// cannot do this in all cases).
if (!loc.linnum && !IR->ir->getCurrentDebugLocation().isUnknown())
return;

Logger::println("D to dwarf stoppoint at line %u, column %u", loc.linnum, loc.charnum);
Expand Down
6 changes: 5 additions & 1 deletion gen/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,11 @@ static llvm::Function* build_module_function(const std::string &name, const std:
IRBuilder<> builder(bb);

// debug info
gIR->DBuilder.EmitModuleCTor(fn, name.c_str());
llvm::DISubprogram dis = gIR->DBuilder.EmitModuleCTor(fn, name.c_str());
if (global.params.symdebug) {
// Need _some_ debug info to avoid inliner bug, see GitHub issue #998.
builder.SetCurrentDebugLocation(llvm::DebugLoc::get(0, 0, dis));
}

// Call ctor's
typedef std::list<FuncDeclaration*>::const_iterator FuncIterator;
Expand Down