Skip to content

[LLDB] frame variable crashes when printing a shared_ptr when program uses MSVC STL #120310

@TheRealCringengineer

Description

@TheRealCringengineer

LLDB is crashing when im trying to execute frame variable command and there is instance of a class that contains shared_ptr inside of it

Platform: Windows 11 23H2
Compiler that used to build executable: MSVC v19.41

What version of lldb were tested:
lldb v19.0 (installed from visual studio installer)
lldb v20.0 (builded from sources on 17 of december 2024)

Minimal code to reproduce bug

#include <iostream>

class Test
{
public:
  Test(std::shared_ptr<int> v)
      : value(v)
  {}

  std::shared_ptr<int> GetValue() { return value; }

private:
  std::shared_ptr<int> value;
};

int main()
{

  std::unique_ptr<int> test = std::make_unique<int>(25);

  std::cout << "Test " << *test << std::endl;

  Test t(std::make_shared<int>(42));

  std::cout << "Test2 " << *t.GetValue() << std::endl;
}

Actions to reproduce this bug

  1. Build executable
  2. Attach lldb to it with lldb app.exe
  3. Set breakpoint on main
  4. run program to hit the breakpoint
  5. execute command frame variable
  6. expect crash

Stacktrace generated by lldb v20.0 builded from sources

Exception Code: 0xC0000005
 #0 0x00007ff953a9d065 lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\llvm-project\Release\bin\liblldb.dll+0x29d065)
 #1 0x00007ff953d8ad4e lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\llvm-project\Release\bin\liblldb.dll+0x58ad4e)
 #2 0x00007ff953c87964 lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\llvm-project\Release\bin\liblldb.dll+0x487964)
 #3 0x00007ff953ab3e4b lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\llvm-project\Release\bin\liblldb.dll+0x2b3e4b)
 #4 0x00007ff953ab44ec lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\llvm-project\Release\bin\liblldb.dll+0x2b44ec)
 #5 0x00007ff953ab583a lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\llvm-project\Release\bin\liblldb.dll+0x2b583a)
 #6 0x00007ff953ab3b09 lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\llvm-project\Release\bin\liblldb.dll+0x2b3b09)
 #7 0x00007ff953ab3fba lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\llvm-project\Release\bin\liblldb.dll+0x2b3fba)
 #8 0x00007ff953ab44ec lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\llvm-project\Release\bin\liblldb.dll+0x2b44ec)
 #9 0x00007ff953ab583a lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\llvm-project\Release\bin\liblldb.dll+0x2b583a)
#10 0x00007ff953c77308 lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\llvm-project\Release\bin\liblldb.dll+0x477308)
#11 0x00007ff955cb80cb lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\llvm-project\Release\bin\liblldb.dll+0x24b80cb)
#12 0x00007ff953ae0aee lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\llvm-project\Release\bin\liblldb.dll+0x2e0aee)
#13 0x00007ff953aed662 lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\llvm-project\Release\bin\liblldb.dll+0x2ed662)
#14 0x00007ff953aef829 lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\llvm-project\Release\bin\liblldb.dll+0x2ef829)
#15 0x00007ff953a90f60 lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\llvm-project\Release\bin\liblldb.dll+0x290f60)
#16 0x00007ff953a488b9 lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\llvm-project\Release\bin\liblldb.dll+0x2488b9)
#17 0x00007ff953afa519 lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\llvm-project\Release\bin\liblldb.dll+0x2fa519)
#18 0x00007ff953930a74 lldb::SBDebugger::RunCommandInterpreter(bool, bool) (W:\llvm-project\Release\bin\liblldb.dll+0x130a74)
#19 0x00007ff6003d5083 (W:\llvm-project\Release\bin\lldb.exe+0x5083)
#20 0x00007ff6003d921f (W:\llvm-project\Release\bin\lldb.exe+0x921f)
#21 0x00007ff6003fd4ec (W:\llvm-project\Release\bin\lldb.exe+0x2d4ec)
#22 0x00007ffa6c42259d (C:\WINDOWS\System32\KERNEL32.DLL+0x1259d)
#23 0x00007ffa6d34af38 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x5af38)

Stacktrace generated by lldb v19.0.0 (from visual studio installer)

Exception Code: 0xC0000005
 #0 0x00007ff9a4b2547c lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\binary\liblldb.dll+0x50547c)
 #1 0x00007ff9a486b95a lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\binary\liblldb.dll+0x24b95a)
 #2 0x00007ff9a4881a0b lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\binary\liblldb.dll+0x261a0b)
 #3 0x00007ff9a48820a7 lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\binary\liblldb.dll+0x2620a7)
 #4 0x00007ff9a4883362 lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\binary\liblldb.dll+0x263362)
 #5 0x00007ff9a488179e lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\binary\liblldb.dll+0x26179e)
 #6 0x00007ff9a4881b85 lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\binary\liblldb.dll+0x261b85)
 #7 0x00007ff9a48820a7 lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\binary\liblldb.dll+0x2620a7)
 #8 0x00007ff9a4883362 lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\binary\liblldb.dll+0x263362)
 #9 0x00007ff9a484e3a6 lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\binary\liblldb.dll+0x22e3a6)
#10 0x00007ff9a67d898f lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\binary\liblldb.dll+0x21b898f)
#11 0x00007ff9a48b8dce lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\binary\liblldb.dll+0x298dce)
#12 0x00007ff9a48c6a05 lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\binary\liblldb.dll+0x2a6a05)
#13 0x00007ff9a48c849b lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\binary\liblldb.dll+0x2a849b)
#14 0x00007ff9a4861d72 lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\binary\liblldb.dll+0x241d72)
#15 0x00007ff9a480bed9 lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\binary\liblldb.dll+0x1ebed9)
#16 0x00007ff9a48d2b1c lldb::SBUnixSignals::SetShouldSuppress(int, bool) (W:\binary\liblldb.dll+0x2b2b1c)
#17 0x00007ff9a471445a lldb::SBDebugger::RunCommandInterpreter(bool, bool) (W:\binary\liblldb.dll+0xf445a)
#18 0x00007ff6eb084568 C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\bin\lldb.exe 0x4568 C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\bin\lldb.exe 0x52a9
#19 0x00007ff6eb084568 C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\bin\lldb.exe 0x2adb4 (C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\bin\lldb.exe+0x4568)
#20 0x00007ff6eb084568
#21 0x00007ff6eb084568 (C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\bin\lldb.exe+0x4568)
0x00007FF9A4B2547C, W:\binary\liblldb.dll(0x00007FF9A4620000) + 0x50547C byte(s), ?SetShouldSuppress@SBUnixSignals@lldb@@QEAA_NH_N@Z() + 0x3538EC byte(s)
0x00007FF9A486B95A, W:\binary\liblldb.dll(0x00007FF9A4620000) + 0x24B95A byte(s), ?SetShouldSuppress@SBUnixSignals@lldb@@QEAA_NH_N@Z() + 0x99DCA byte(s)
0x00007FF9A4881A0B, W:\binary\liblldb.dll(0x00007FF9A4620000) + 0x261A0B byte(s), ?SetShouldSuppress@SBUnixSignals@lldb@@QEAA_NH_N@Z() + 0xAFE7B byte(s)
0x00007FF9A48820A7, W:\binary\liblldb.dll(0x00007FF9A4620000) + 0x2620A7 byte(s), ?SetShouldSuppress@SBUnixSignals@lldb@@QEAA_NH_N@Z() + 0xB0517 byte(s)
0x00007FF9A4883362, W:\binary\liblldb.dll(0x00007FF9A4620000) + 0x263362 byte(s), ?SetShouldSuppress@SBUnixSignals@lldb@@QEAA_NH_N@Z() + 0xB17D2 byte(s)
0x00007FF9A488179E, W:\binary\liblldb.dll(0x00007FF9A4620000) + 0x26179E byte(s), ?SetShouldSuppress@SBUnixSignals@lldb@@QEAA_NH_N@Z() + 0xAFC0E byte(s)
0x00007FF9A4881B85, W:\binary\liblldb.dll(0x00007FF9A4620000) + 0x261B85 byte(s), ?SetShouldSuppress@SBUnixSignals@lldb@@QEAA_NH_N@Z() + 0xAFFF5 byte(s)
0x00007FF9A48820A7, W:\binary\liblldb.dll(0x00007FF9A4620000) + 0x2620A7 byte(s), ?SetShouldSuppress@SBUnixSignals@lldb@@QEAA_NH_N@Z() + 0xB0517 byte(s)
0x00007FF9A4883362, W:\binary\liblldb.dll(0x00007FF9A4620000) + 0x263362 byte(s), ?SetShouldSuppress@SBUnixSignals@lldb@@QEAA_NH_N@Z() + 0xB17D2 byte(s)
0x00007FF9A484E3A6, W:\binary\liblldb.dll(0x00007FF9A4620000) + 0x22E3A6 byte(s), ?SetShouldSuppress@SBUnixSignals@lldb@@QEAA_NH_N@Z() + 0x7C816 byte(s)
0x00007FF9A67D898F, W:\binary\liblldb.dll(0x00007FF9A4620000) + 0x21B898F byte(s), ?SetShouldSuppress@SBUnixSignals@lldb@@QEAA_NH_N@Z() + 0x2006DFF byte(s)
0x00007FF9A48B8DCE, W:\binary\liblldb.dll(0x00007FF9A4620000) + 0x298DCE byte(s), ?SetShouldSuppress@SBUnixSignals@lldb@@QEAA_NH_N@Z() + 0xE723E byte(s)
0x00007FF9A48C6A05, W:\binary\liblldb.dll(0x00007FF9A4620000) + 0x2A6A05 byte(s), ?SetShouldSuppress@SBUnixSignals@lldb@@QEAA_NH_N@Z() + 0xF4E75 byte(s)
0x00007FF9A48C849B, W:\binary\liblldb.dll(0x00007FF9A4620000) + 0x2A849B byte(s), ?SetShouldSuppress@SBUnixSignals@lldb@@QEAA_NH_N@Z() + 0xF690B byte(s)
0x00007FF9A4861D72, W:\binary\liblldb.dll(0x00007FF9A4620000) + 0x241D72 byte(s), ?SetShouldSuppress@SBUnixSignals@lldb@@QEAA_NH_N@Z() + 0x901E2 byte(s)
0x00007FF9A480BED9, W:\binary\liblldb.dll(0x00007FF9A4620000) + 0x1EBED9 byte(s), ?SetShouldSuppress@SBUnixSignals@lldb@@QEAA_NH_N@Z() + 0x3A349 byte(s)
0x00007FF9A48D2B1C, W:\binary\liblldb.dll(0x00007FF9A4620000) + 0x2B2B1C byte(s), ?SetShouldSuppress@SBUnixSignals@lldb@@QEAA_NH_N@Z() + 0x100F8C byte(s)
0x00007FF9A471445A, W:\binary\liblldb.dll(0x00007FF9A4620000) + 0xF445A byte(s), ?RunCommandInterpreter@SBDebugger@lldb@@QEAAX_N0@Z() + 0x21A byte(s)
0x00007FF6EB084568, C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\bin\lldb.exe(0x00007FF6EB080000) + 0x4568 byte(s)
0x00007FF6EB0852A9, C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\bin\lldb.exe(0x00007FF6EB080000) + 0x52A9 byte(s)
0x00007FF6EB0AADB4, C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\bin\lldb.exe(0x00007FF6EB080000) + 0x2ADB4 byte(s)
0x00007FFA6C42259D, C:\WINDOWS\System32\KERNEL32.DLL(0x00007FFA6C410000) + 0x1259D byte(s), BaseThreadInitThunk() + 0x1D byte(s)
0x00007FFA6D34AF38, C:\WINDOWS\SYSTEM32\ntdll.dll(0x00007FFA6D2F0000) + 0x5AF38 byte(s), RtlUserThreadStart() + 0x28 byte(s)

There should be diagnostics logs in my Temp folder according to this message

LLDB diagnostics will be written to C:\Users\{USER}\AppData\Local\Temp\diagnostics-897c9d

But diagnostics.log file is competly empty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions