Skip to content

lldb on windows: The debugger crashes when trying to print a shared_ptr #91996

@sigasigasiga

Description

@sigasigasiga
#include <iostream>
#include <memory>

int main() {
    std::shared_ptr<void> p;
    std::cout << p << std::endl;
}

Given the code above which was compiled with clang++ -g3 cpp.cpp I'm unable to print the contents of p:

$ lldb a.exe
(lldb) target create "a.exe"
(lldb) Current executable set to 'C:\dev\toy\a.exe' (x86_64).
(lldb) process launch -m
(lldb) Process 24372 launched: 'C:\dev\toy\a.exe' (x86_64)
Process 24372 stopped
* thread #1, stop reason = one-shot breakpoint 1
    frame #0: 0x00007ff71ba4bd60 a.exe`main at cpp.cpp:4
   1    #include <iostream>
   2    #include <memory>
   3
-> 4    int main() {
   5        std::shared_ptr<void> p;
   6        std::cout << p << std::endl;
   7    }
(lldb) n
Process 24372 stopped
* thread #1, stop reason = step over
    frame #0: 0x00007ff71ba4bd7a a.exe`main at cpp.cpp:5
   2    #include <memory>
   3
   4    int main() {
-> 5        std::shared_ptr<void> p;
   6        std::cout << p << std::endl;
   7    }
(lldb) p p
error: a.exe :: Class 'std::strong_ordering' has a member 'less' of type 'std::strong_ordering' which does not have a complete definition.
error: a.exe :: Class 'std::partial_ordering' has a member 'less' of type 'std::partial_ordering' which does not have a complete definition.
error: a.exe :: Class 'std::weak_ordering' has a member 'less' of type 'std::weak_ordering' which does not have a complete definition.
(lldb) LLDB diagnostics will be written to C:\Users\EGORBY~1\AppData\Local\Temp\diagnostics-dbd91a
Please include the directory content when filing a bug report
Exception Code: 0xC0000005
 #0 0x00007ffcc890e457 (C:\Program Files\LLVM\bin\liblldb.dll+0x12de457)
 #1 0x00007ffcc86a27dd (C:\Program Files\LLVM\bin\liblldb.dll+0x10727dd)
 #2 0x00007ffcc86a72d8 (C:\Program Files\LLVM\bin\liblldb.dll+0x10772d8)
 #3 0x00007ffcc86a6136 (C:\Program Files\LLVM\bin\liblldb.dll+0x1076136)
 #4 0x00007ffcc86a4d80 (C:\Program Files\LLVM\bin\liblldb.dll+0x1074d80)
 #5 0x00007ffcc7fdbc18 (C:\Program Files\LLVM\bin\liblldb.dll+0x9abc18)
 #6 0x00007ffcc86de283 (C:\Program Files\LLVM\bin\liblldb.dll+0x10ae283)
 #7 0x00007ffcc802756f (C:\Program Files\LLVM\bin\liblldb.dll+0x9f756f)
 #8 0x00007ffcc803b824 (C:\Program Files\LLVM\bin\liblldb.dll+0xa0b824)
 #9 0x00007ffcc803fc46 (C:\Program Files\LLVM\bin\liblldb.dll+0xa0fc46)
#10 0x00007ffcc8681c52 (C:\Program Files\LLVM\bin\liblldb.dll+0x1051c52)
#11 0x00007ffcc7fba997 (C:\Program Files\LLVM\bin\liblldb.dll+0x98a997)
#12 0x00007ffcc8041600 (C:\Program Files\LLVM\bin\liblldb.dll+0xa11600)
#13 0x00007ffcc7de0a32 (C:\Program Files\LLVM\bin\liblldb.dll+0x7b0a32)
#14 0x00007ff723dfe925 (C:\Program Files\LLVM\bin\lldb.exe+0xe925)
#15 0x00007ff723dff328 (C:\Program Files\LLVM\bin\lldb.exe+0xf328)
#16 0x00007ff723e0c790 (C:\Program Files\LLVM\bin\lldb.exe+0x1c790)
#17 0x00007ffdccc2257d (C:\Windows\System32\KERNEL32.DLL+0x1257d)
#18 0x00007ffdce94aa48 (C:\Windows\SYSTEM32\ntdll.dll+0x5aa48)
Segmentation fault

The diagnostics file is not very interesting, as it duplicates the information in the error output

a.exe :: Class 'std::strong_ordering' has a member 'less' of type 'std::strong_ordering' which does not have a complete definition.a.exe :: Class 'std::partial_ordering' has a member 'less' of type 'std::partial_ordering' which does not have a complete definition.a.exe :: Class 'std::weak_ordering' has a member 'less' of type 'std::weak_ordering' which does not have a complete definition.

OS: Windows 11 23H2

> cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.39.33519 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]

> clang++ --version
clang version 18.1.4
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin

> lldb --version
lldb version 18.1.4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions