[lldb] [llvm] [lldb][NativePDB] Fix crash in debugger when PDB has bad type index value (PR #166455)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 23 13:52:24 PST 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp llvm/include/llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
index 6a74683e6..b6b20f2b8 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
@@ -974,10 +974,10 @@ PdbAstBuilder::CreateFunctionDeclFromId(PdbTypeSymId func_tid,
SymbolFileNativePDB *pdb = static_cast<SymbolFileNativePDB *>(
m_clang.GetSymbolFile()->GetBackingSymbolFile());
PdbIndex &index = pdb->GetIndex();
- std::optional<CVType> func_cvt = index.ipi().typeCollection().tryGetType(
- func_tid.index);
- if (!func_cvt)
- return nullptr;
+ std::optional<CVType> func_cvt =
+ index.ipi().typeCollection().tryGetType(func_tid.index);
+ if (!func_cvt)
+ return nullptr;
llvm::StringRef func_name;
TypeIndex func_ti;
clang::DeclContext *parent = nullptr;
``````````
</details>
https://github.com/llvm/llvm-project/pull/166455
More information about the llvm-commits
mailing list