llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.26k stars 12.09k forks source link

lldb-dap.exe crashes in vscode debugging swift code #115603

Open felixf4xu opened 2 weeks ago

felixf4xu commented 2 weeks ago

Hi,

When I use lldb-dap in VSCode, I had a crash like this, I attached the log:

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.  Program arguments: C:\\Users\\Cc\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.0.2+Asserts\\usr\\bin\\lldb-dap.exe
1.  Program arguments: C:\\Users\\Cc\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.0.2+Asserts\\usr\\bin\\lldb-dap.exe
Exception Code: 0xC0000005
 #0 0x0000000000000000 
 #1 0x00007ffe74e63a3a PyInit__lldb (C:\Users\Cc\AppData\Local\Programs\Swift\Toolchains\6.0.2+Asserts\usr\bin\liblldb.dll+0x523a3a)
 #2 0x00007ffe74e5a528 PyInit__lldb (C:\Users\Cc\AppData\Local\Programs\Swift\Toolchains\6.0.2+Asserts\usr\bin\liblldb.dll+0x51a528)
 #3 0x00007ffe74becd9b lldb::SBValue::GetSP(void) const (C:\Users\Cc\AppData\Local\Programs\Swift\Toolchains\6.0.2+Asserts\usr\bin\liblldb.dll+0x2acd9b)
 #4 0x00007ffe74beca6f lldb::SBValue::GetSP(class ValueLocker &) const (C:\Users\Cc\AppData\Local\Programs\Swift\Toolchains\6.0.2+Asserts\usr\bin\liblldb.dll+0x2aca6f)
 #5 0x00007ffe74beb4c2 lldb::SBValue::GetName(void) (C:\Users\Cc\AppData\Local\Programs\Swift\Toolchains\6.0.2+Asserts\usr\bin\liblldb.dll+0x2ab4c2)
 #6 0x00007ff7ec9b7e4a (C:\Users\Cc\AppData\Local\Programs\Swift\Toolchains\6.0.2+Asserts\usr\bin\lldb-dap.exe+0x27e4a)
 #7 0x00007ff7ec9a843f (C:\Users\Cc\AppData\Local\Programs\Swift\Toolchains\6.0.2+Asserts\usr\bin\lldb-dap.exe+0x1843f)
 #8 0x00007ff7ec9c3a27 (C:\Users\Cc\AppData\Local\Programs\Swift\Toolchains\6.0.2+Asserts\usr\bin\lldb-dap.exe+0x33a27)
 #9 0x00007ff7ec9c3f58 (C:\Users\Cc\AppData\Local\Programs\Swift\Toolchains\6.0.2+Asserts\usr\bin\lldb-dap.exe+0x33f58)
#10 0x00007ff7ec9a94a2 (C:\Users\Cc\AppData\Local\Programs\Swift\Toolchains\6.0.2+Asserts\usr\bin\lldb-dap.exe+0x194a2)
#11 0x00007ff7ec9f61b0 (C:\Users\Cc\AppData\Local\Programs\Swift\Toolchains\6.0.2+Asserts\usr\bin\lldb-dap.exe+0x661b0)
#12 0x00007fff4414257d (C:\WINDOWS\System32\KERNEL32.DLL+0x1257d)
#13 0x00007fff45a6af08 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x5af08)
EugeneZelenko commented 2 weeks ago

@felixf4xu: Could you please provide reproducer?

felixf4xu commented 2 weeks ago

I hope I can.

git clone https://github.com/Sweet-St/swift-win32-fork.git --recursive
cd swift-win32-fork
swift build
  1. then code . open it by vscode (latest version), it has a pre-configured .vscode/launch.json file;
  2. Search for "if !InitCommonControlsEx(&ICCE) {" and set a break point at line 105; <--this is the key step
  3. Use that launch file to launch debugger: "Debug UICatalog"; the debug will stop at line 105,
  4. then click "Step Over" and let it run to line 106

Now in "Debug Console", the crash stack dump is displayed.

felixf4xu commented 2 weeks ago

In the top of the stack dump, it actually displays the source line:

Assertion failed: false && "object not found in shared cluster when expected", file C:\Users\swift-ci\jenkins\workspace\swift-6.0.2-windows-toolchain\llvm-project\lldb\include\lldb/Utility/SharedCluster.h, line 45