mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-10 20:33:15 +00:00
Fix debug info crashes for PIC16.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88761 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
20162ac566
commit
6fb01a7750
@ -138,7 +138,7 @@ bool AsmPrinter::doInitialization(Module &M) {
|
|||||||
if (MMI)
|
if (MMI)
|
||||||
MMI->AnalyzeModule(M);
|
MMI->AnalyzeModule(M);
|
||||||
DW = getAnalysisIfAvailable<DwarfWriter>();
|
DW = getAnalysisIfAvailable<DwarfWriter>();
|
||||||
if (DW)
|
if (DW && MAI->doesSupportDebugInformation())
|
||||||
DW->BeginModule(&M, MMI, O, this, MAI);
|
DW->BeginModule(&M, MMI, O, this, MAI);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -467,12 +467,18 @@ void PIC16DbgInfo::EmitVarDebugInfo(Module &M) {
|
|||||||
void PIC16DbgInfo::SwitchToCU(MDNode *CU) {
|
void PIC16DbgInfo::SwitchToCU(MDNode *CU) {
|
||||||
// Get the file path from CU.
|
// Get the file path from CU.
|
||||||
DICompileUnit cu(CU);
|
DICompileUnit cu(CU);
|
||||||
|
std::string FilePath = "";
|
||||||
|
if (cu.getDirectory()) {
|
||||||
std::string DirName = cu.getDirectory();
|
std::string DirName = cu.getDirectory();
|
||||||
|
FilePath = FilePath + DirName + "/";
|
||||||
|
}
|
||||||
|
if (cu.getFilename()) {
|
||||||
std::string FileName = cu.getFilename();
|
std::string FileName = cu.getFilename();
|
||||||
std::string FilePath = DirName + "/" + FileName;
|
FilePath = FilePath + FileName;
|
||||||
|
}
|
||||||
|
|
||||||
// Nothing to do if source file is still same.
|
// Nothing to do if source file is still same or it is empty.
|
||||||
if ( FilePath == CurFile ) return;
|
if ( FilePath == CurFile || FilePath == "") return;
|
||||||
|
|
||||||
// Else, close the current one and start a new.
|
// Else, close the current one and start a new.
|
||||||
if (CurFile != "") O << "\n\t.eof";
|
if (CurFile != "") O << "\n\t.eof";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user