[Lldb-commits] [lldb] [lldb][NativePDB] Sort function name maps deterministically. (PR #156530)
Zequan Wu via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 2 13:45:56 PDT 2025
https://github.com/ZequanWu created https://github.com/llvm/llvm-project/pull/156530
https://github.com/llvm/llvm-project/pull/153160 created those function maps and uses default sort comparator which is not deterministic when there are multiple entries with same name because llvm::sort is unstable sort.
This fixes it by comparing the id value when tie happens.
>From ca5ad064c8e12454df9e1cdd1ef22da070f55703 Mon Sep 17 00:00:00 2001
From: Zequan Wu <zequanwu at google.com>
Date: Tue, 2 Sep 2025 13:38:04 -0700
Subject: [PATCH] [lldb][NativePDB] Sort function name maps deterministically.
---
.../Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index 112eb06e462fc..f7a807366070e 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -1735,11 +1735,11 @@ void SymbolFileNativePDB::CacheFunctionNames() {
}
// Sort them before value searching is working properly.
- m_func_full_names.Sort();
+ m_func_full_names.Sort(std::less<uint32_t>());
m_func_full_names.SizeToFit();
- m_func_method_names.Sort();
+ m_func_method_names.Sort(std::less<uint32_t>());
m_func_method_names.SizeToFit();
- m_func_base_names.Sort();
+ m_func_base_names.Sort(std::less<uint32_t>());
m_func_base_names.SizeToFit();
}
More information about the lldb-commits
mailing list