[llvm] [llvm-pdbutil] Avoid reading EC names from non-EC modules (PR #223253)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 13 08:14:16 PDT 2026
https://github.com/oltolm created https://github.com/llvm/llvm-project/pull/223253
The module dumper resolves the PDB and source file name indices for every module, even when the module does not contain Edit and Continue information. If the DBI stream has no EC names table, `dump --modules` fails with:
Unexpected error processing modules: Stream Error: The stream is too short
to perform the requested operation.
Only resolve and print the EC names when the module's EC flag is set.
>From 373553ea5f4e77018cc1c700e56de5616719e308 Mon Sep 17 00:00:00 2001
From: Oleg Tolmatcev <oleg.tolmatcev at gmail.com>
Date: Sun, 13 Sep 2026 17:05:54 +0200
Subject: [PATCH] [llvm-pdbutil] Avoid reading EC names from non-EC modules
The module dumper resolves the PDB and source file name indices for every
module, even when the module does not contain Edit and Continue information.
If the DBI stream has no EC names table, `dump --modules` fails with:
Unexpected error processing modules: Stream Error: The stream is too short
to perform the requested operation.
Only resolve and print the EC names when the module's EC flag is set.
---
llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp | 28 +++++++++++----------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp b/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
index feb23ca2083d5..c1d82d0810daf 100644
--- a/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
+++ b/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
@@ -503,19 +503,21 @@ Error DumpOutputStyle::dumpModules() {
Desc.getModuleStreamIndex(), Desc.getNumberOfFiles(),
Desc.hasECInfo());
- auto PdbPathOrErr = Stream.getECName(Desc.getPdbFilePathNameIndex());
- if (!PdbPathOrErr)
- return PdbPathOrErr.takeError();
- StringRef PdbFilePath = *PdbPathOrErr;
-
- auto SrcPathOrErr = Stream.getECName(Desc.getSourceFileNameIndex());
- if (!SrcPathOrErr)
- return SrcPathOrErr.takeError();
- StringRef SrcFilePath = *SrcPathOrErr;
-
- P.formatLine("pdb file ni: {0} `{1}`, src file ni: {2} `{3}`",
- Desc.getPdbFilePathNameIndex(), PdbFilePath,
- Desc.getSourceFileNameIndex(), SrcFilePath);
+ if (Desc.hasECInfo()) {
+ auto PdbPathOrErr = Stream.getECName(Desc.getPdbFilePathNameIndex());
+ if (!PdbPathOrErr)
+ return PdbPathOrErr.takeError();
+ StringRef PdbFilePath = *PdbPathOrErr;
+
+ auto SrcPathOrErr = Stream.getECName(Desc.getSourceFileNameIndex());
+ if (!SrcPathOrErr)
+ return SrcPathOrErr.takeError();
+ StringRef SrcFilePath = *SrcPathOrErr;
+
+ P.formatLine("pdb file ni: {0} `{1}`, src file ni: {2} `{3}`",
+ Desc.getPdbFilePathNameIndex(), PdbFilePath,
+ Desc.getSourceFileNameIndex(), SrcFilePath);
+ }
return Error::success();
});
}
More information about the llvm-commits
mailing list