diff --git a/src/common/windows/pdb_source_line_writer.cc b/src/common/windows/pdb_source_line_writer.cc index ca0c6a39..25a1ca05 100644 --- a/src/common/windows/pdb_source_line_writer.cc +++ b/src/common/windows/pdb_source_line_writer.cc @@ -343,8 +343,10 @@ void PDBSourceLineWriter::Lines::AddLine(const Line& line) { do { auto iter = line_map_.lower_bound(line.rva); if (iter == line_map_.end()) { - --iter; - intercept(iter->second); + if (!line_map_.empty()) { + --iter; + intercept(iter->second); + } break; } is_intercept = false; @@ -570,6 +572,10 @@ bool PDBSourceLineWriter::PrintSourceFiles() { return false; } + // Print a dummy file with id equals 0 to represent unknown file, because + // inline records might have unknown call site. + fwprintf(output_, L"FILE %d unknown file\n", 0); + CComPtr compiland; ULONG count; while (SUCCEEDED(compilands->Next(1, &compiland, &count)) && count == 1) {