Fix bug so that programIndex (et al.) are available in the debugger.
It's now possible to successfully print out the value of programIndex, programCount, etc., in the debugger. The issue was that they were defined as having InternalLinkage, which meant that DCE removed them at the end of compilation. Now they're declared to have WeakODRLinkage, which ensures that one copy survives (but there aren't multiply-defined symbols when compiling multiple files.)
This commit is contained in:
23
ctx.cpp
23
ctx.cpp
@@ -339,29 +339,6 @@ FunctionEmitContext::FunctionEmitContext(Function *func, Symbol *funSym,
|
||||
|
||||
/* And start a scope representing the initial function scope */
|
||||
StartScope();
|
||||
|
||||
llvm::DIFile file = funcStartPos.GetDIFile();
|
||||
Symbol *programIndexSymbol = m->symbolTable->LookupVariable("programIndex");
|
||||
Assert(programIndexSymbol && programIndexSymbol->storagePtr);
|
||||
llvm::DIGlobalVariable var =
|
||||
m->diBuilder->createGlobalVariable(programIndexSymbol->name,
|
||||
file,
|
||||
funcStartPos.first_line,
|
||||
programIndexSymbol->type->GetDIType(file),
|
||||
true /* static */,
|
||||
programIndexSymbol->storagePtr);
|
||||
Assert(var.Verify());
|
||||
|
||||
Symbol *programCountSymbol = m->symbolTable->LookupVariable("programCount");
|
||||
Assert(programCountSymbol);
|
||||
var =
|
||||
m->diBuilder->createGlobalVariable(programCountSymbol->name,
|
||||
file,
|
||||
funcStartPos.first_line,
|
||||
programCountSymbol->type->GetDIType(file),
|
||||
true /* static */,
|
||||
programCountSymbol->storagePtr);
|
||||
Assert(var.Verify());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user