https://github.com/Nerixyz updated https://github.com/llvm/llvm-project/pull/140761
>From e08ec0697c9d22ad002c83c4e5c7ce3e0d10b0b6 Mon Sep 17 00:00:00 2001 From: Nerixyz <nerix...@outlook.de> Date: Wed, 21 May 2025 17:32:48 +0200 Subject: [PATCH 1/2] [LLDB] Pass `/std:...` before `--` on MSVC --- lldb/test/Shell/helper/build.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lldb/test/Shell/helper/build.py b/lldb/test/Shell/helper/build.py index b2b8146e88c75..caaa14f90af1c 100755 --- a/lldb/test/Shell/helper/build.py +++ b/lldb/test/Shell/helper/build.py @@ -683,14 +683,14 @@ def _get_compilation_command(self, source, obj): args.append("-fms-compatibility-version=19") args.append("/c") + if self.std: + args.append("/std:" + self.std) + args.append("/Fo" + obj) if self.toolchain_type == "clang-cl": args.append("--") args.append(source) - if self.std: - args.append("/std:" + self.std) - return ("compiling", [source], obj, self.compile_env, args) def _get_link_command(self): >From 355cdcdef902335c60b30e0206b704427160a2f2 Mon Sep 17 00:00:00 2001 From: Nerixyz <nerix...@outlook.de> Date: Wed, 21 May 2025 17:34:39 +0200 Subject: [PATCH 2/2] [LLDB] Avoid crashes when inspecting MS STL types --- .../Language/CPlusPlus/GenericOptional.cpp | 7 ++- .../Plugins/Language/CPlusPlus/LibStdcpp.cpp | 3 + .../Shell/Process/Windows/msstl_smoke.cpp | 57 +++++++++++++++++++ 3 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 lldb/test/Shell/Process/Windows/msstl_smoke.cpp diff --git a/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp b/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp index b1fdc0fe37763..c041f39022d10 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp @@ -74,9 +74,10 @@ lldb::ChildCacheState GenericOptionalFrontend::Update() { if (m_stdlib == StdLib::LibCxx) engaged_sp = m_backend.GetChildMemberWithName("__engaged_"); - else if (m_stdlib == StdLib::LibStdcpp) - engaged_sp = m_backend.GetChildMemberWithName("_M_payload") - ->GetChildMemberWithName("_M_engaged"); + else if (m_stdlib == StdLib::LibStdcpp) { + if (ValueObjectSP payload = m_backend.GetChildMemberWithName("_M_payload")) + engaged_sp = payload->GetChildMemberWithName("_M_engaged"); + } if (!engaged_sp) return lldb::ChildCacheState::eRefetch; diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp index 02113baf64b8c..08cfcd4a26b8e 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp @@ -379,6 +379,9 @@ LibStdcppSharedPtrSyntheticFrontEnd::CalculateNumChildren() { lldb::ValueObjectSP LibStdcppSharedPtrSyntheticFrontEnd::GetChildAtIndex(uint32_t idx) { + if (!m_ptr_obj) + return nullptr; + if (idx == 0) return m_ptr_obj->GetSP(); if (idx == 1) { diff --git a/lldb/test/Shell/Process/Windows/msstl_smoke.cpp b/lldb/test/Shell/Process/Windows/msstl_smoke.cpp new file mode 100644 index 0000000000000..4ae8f4256f24e --- /dev/null +++ b/lldb/test/Shell/Process/Windows/msstl_smoke.cpp @@ -0,0 +1,57 @@ +// clang-format off + +// REQUIRES: target-windows +// RUN: %build --compiler=clang-cl -o %t.exe --std c++20 -- %s +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o "b main" -o "run" -o "fr v" -o c | FileCheck %s + +#include <bitset> +#include <coroutine> +#include <deque> +#include <forward_list> +#include <list> +#include <map> +#include <memory> +#include <optional> +#include <set> +#include <string> +#include <tuple> +#include <unordered_map> +#include <unordered_set> +#include <variant> +#include <vector> + +int main() { + std::shared_ptr<int> foo; + std::weak_ptr<int> weak = foo; + std::unique_ptr<int> unique(new int(42)); + std::optional<int> opt; + std::string str = "str"; + std::string longStr = + "string that is long enough such that no SSO can happen"; + std::wstring wStr = L"wstr"; + std::wstring longWStr = + L"string that is long enough such that no SSO can happen"; + std::tuple<int, bool, float> tuple{1, false, 4.2}; + std::coroutine_handle<> coroHandle; + std::bitset<16> bitset(123); + + std::map<int, int> map{{1, 2}, {2, 4}, {3, 6}, {4, 8}, {5, 10}}; + auto mapIt = map.find(3); + auto mapItEnd = map.find(9); + std::set<int> set{1, 2, 3}; + std::multimap<int, int> mMap{{1, 2}, {1, 1}, {2, 4}}; + std::multiset<int> mSet{1, 2, 3}; + + std::variant<int, float, std::string, std::monostate> variant; + std::list<int> list{1, 2, 3}; + std::forward_list<int> fwList{1, 2, 3}; + + std::unordered_map<int, int> uMap{{1, 2}, {2, 4}, {3, 6}}; + std::unordered_set<int> uSet{1, 2, 4}; + std::unordered_multimap<int, int> uMMap{{1, 2}, {1, 1}, {2, 4}}; + std::unordered_multiset<int> uMSet{1, 1, 2}; + std::deque<int> deque{1, 2, 3}; + std::vector<int> vec{1, 2, 3}; +} + +// CHECK: Process {{.*}} exited with status = 0 (0x00000000) _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits