[Lldb-commits] [lldb] [lldb][NativePDB] don't assert when a public symbol sits past its section (PR #225734)

Charles Zablit via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 23 10:51:38 PDT 2026


================
@@ -1290,12 +1290,25 @@ void SymbolFileNativePDB::AddSymbols(Symtab &symtab) {
       return;
 
     if (next && last_sym.Segment == next->Segment) {
-      assert(last_sym.Offset <= next->Offset);
+      if (next->Offset < last_sym.Offset) {
+        LLDB_LOG(GetLog(LLDBLog::Symbols),
+                 "Ignoring size estimate for '{0}': segment {1} offset {2} is "
+                 "greater than the following offset {3}",
+                 last_sym.Name, last_sym.Segment, last_sym.Offset,
+                 next->Offset);
+        return;
+      }
       last->SetByteSize(next->Offset - last_sym.Offset);
     } else {
       // the last symbol was the last in its section
-      assert(section_sp->GetByteSize() >= last_sym.Offset);
-      assert(!next || next->Segment > last_sym.Segment);
+      if (section_sp->GetByteSize() < last_sym.Offset) {
----------------
charles-zablit wrote:

I don't think so. #220618 is about `ObjectFilePECOFF::GetSectionDataSize()`, which clamps data reads to `min(GetByteSize(), GetFileSize())`. However, `section_sp->GetByteSize()` is already `VirtualSize`. So my understanding is that a public symbol in the tail of a section is still within `GetByteSize()` and should not reach this assert.

https://github.com/llvm/llvm-project/pull/225734


More information about the lldb-commits mailing list