[Lldb-commits] [lldb] [LLDB] Fix std::shared_ptr formatter crash on windows (PR #141348)

2025-05-24 Thread Emanuel Berggren via lldb-commits

MrBoboGet wrote:

Ah, it does, didn't think about double checking if it had been solved outside 
of main. Then this pull request is completely redundant

https://github.com/llvm/llvm-project/pull/141348
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Fix std::shared_ptr formatter crash on windows (PR #141348)

2025-05-24 Thread Emanuel Berggren via lldb-commits

https://github.com/MrBoboGet created 
https://github.com/llvm/llvm-project/pull/141348

lldb-dap crashes when requesting variables if the scope includes a 
std::shared_ptr, as it assumes that m_ptr_obj is not null after Update. This is 
however only true if Update doesn't fail for any reason, and the problem is 
that LibStdcppSharedPtrSyntheticFrontEnd is used even when running on windows 
and not using libstdcpp. As _M_ptr is not present in the class, so is m_ptr_obj 
always null, which results in a crash when calling GetChildAtIndex with idx= 0. 

This commit only fixes the crash by adding a null check, whether or not it's a 
bug that LibStdcppSharedPtrSyntheticFrontEnd is used on windows at all is 
difficult for me to decide, and there doesn't seem to be any support for 
microsoft STL regardless.

A minimal example showcasing the bug is easy to provide:
```cpp
#include 
#include 
int main(int arg, char** argv)
{
std::shared_ptr broken = std::make_shared();
std::cout<<"Hello world!"GetSP();
   if (idx == 1) {
 if (m_ptr_obj && !m_obj_obj) {

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Fix std::shared_ptr formatter crash on windows (PR #141348)

2025-05-24 Thread Emanuel Berggren via lldb-commits

https://github.com/MrBoboGet closed 
https://github.com/llvm/llvm-project/pull/141348
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits