Closed lokinfey closed 3 years ago
Can you please try removing lldb.libpython
from your configuration settings?
@vadimcn i tried that. it will not help. i think the problem is in the fact that liblldb shipped with swift is linked to libpython of different version (or forked version, who knows) that is found on the system. removing the liblldb condig allows me to launch the debug session, but there's no proper symbols and p/po commands to not work. breakpoints do work tho :)
I try all method , but it can not show local variable in VSCode debug mode ...........
I get similar errors when trying to use an external liblldb on Ubuntu 18.04, tried Swift 5.1.5 and 5.3, setting lldb.libpython to either the 3.6 or the 2.7 .so, all resulting in the same error:
configuration: {
type: 'lldb',
request: 'launch',
preLaunchTask: 'swift-build',
name: 'Run Pal4',
program: '${workspaceFolder}/.build/debug/Pal4',
cwd: '${workspaceFolder}/Sources/Pal4',
args: [],
sourceLanguages: [ 'swift' ],
env: {
LLDB_DEBUGSERVER_PATH: '/home/t/swift/swift-5.1.5/usr/bin/lldb-server'
},
relativePathBase: '/home/t/swft/pals'
}
liblldb: /home/t/swift/swift-5.1.5/usr/lib/liblldb.so.992.8.1svn
libpython: null
environment: {}
params: { sourceLanguages: [ 'swift' ] }
[2020-10-07T12:59:35Z INFO codelldb::find_python] Querying python sysconfig
[2020-10-07T12:59:35Z INFO codelldb::find_python] Query returned ["libpython3.6m.so.1.0"]
[2020-10-07T12:59:35Z INFO codelldb::find_python] Probing "libpython3.6m.so.1.0"
[2020-10-07T12:59:35Z INFO codelldb::find_python] Py_GetVersion returned "3.6.9 (default, Jul 17 2020, 12:50:27) \n[GCC 8.4.0]"
[2020-10-07T12:59:35Z INFO codelldb::find_python] Parsed version as 3.6
[2020-10-07T12:59:35Z INFO codelldb::find_python] Accepted
Listening on port 37117
[2020-10-07T12:59:35Z DEBUG codelldb] New debug session
Fatal Python error: take_gil: NULL tstate
Received signal: SIGABRT
0: codelldb::hook_crashes::handler
1: <unknown>
2: gsignal
3: abort
4: Py_FatalError
5: <unknown>
6: PyEval_InitThreads
7: _ZN12lldb_private27ScriptInterpreterPythonImpl17InitializePrivateEv
8: _ZN12lldb_private27ScriptInterpreterPythonImplC1ERNS_8DebuggerE
9: _ZN12lldb_private27ScriptInterpreterPythonImpl14CreateInstanceERNS_8DebuggerE
10: _ZN12lldb_private13PluginManager31GetScriptInterpreterForLanguageEN4lldb14ScriptLanguageERNS_8DebuggerE
11: _ZN12lldb_private8Debugger20GetScriptInterpreterEb
12: _ZN33CommandObjectCommandsScriptImport9DoExecuteERN12lldb_private4ArgsERNS0_19CommandReturnObjectE
13: _ZN12lldb_private19CommandObjectParsed7ExecuteEPKcRNS_19CommandReturnObjectE
14: _ZN12lldb_private18CommandInterpreter13HandleCommandEPKcNS_8LazyBoolERNS_19CommandReturnObjectEPNS_16ExecutionContextEbb
15: _ZN4lldb20SBCommandInterpreter13HandleCommandEPKcRNS_18SBExecutionContextERNS_21SBCommandReturnObjectEb
16: _ZN4lldb20SBCommandInterpreter13HandleCommandEPKcRNS_21SBCommandReturnObjectEb
17: __cpp_closure_8324812709926371778
18: lldb::strings::with_cstr
19: lldb::sbcommandinterpreter::SBCommandInterpreter::handle_command
20: codelldb::python::initialize
21: codelldb::debug_session::DebugSession::run
22: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
23: tokio::runtime::thread_pool::ThreadPool::block_on
24: tokio::runtime::context::enter
25: tokio::runtime::handle::Handle::enter
26: entry
27: codelldb::main
28: std::rt::lang_start::{{closure}}
29: std::rt::lang_start_internal
30: main
31: __libc_start_main
32: _start
Debug adapter exit code=255, signal=null.
settings.json has the following contents:
{
"sourcekit-lsp.toolchainPath": "/home/t/swift/swift-5.1.5/",
"[swift]": {
},
"sourcekit-lsp.serverPath": "/home/t/swift/swift-5.1.5/usr/bin/sourcekit-lsp",
"swift.path.swift_driver_bin": "/home/t/swift/swift-5.1.5/usr/bin/swift",
"swift.path.sourcekite": "/home/t/bin/sourcekite",
"sde.languageServerMode": "sourcekit-lsp",
"lldb.library": "/home/t/swift/swift-5.1.5/usr/lib/liblldb.so.992.8.1svn",
"lldb.launch.env": {
"LLDB_DEBUGSERVER_PATH": "/home/t/swift/swift-5.1.5/usr/bin/lldb-server"
},
"lldb.verboseLogging": true,
"lldb.dbgconfig": {
}
}
Please upgrade to v1.6 and try again.. I've tested with Swift 5.3.
@lokinfey @andigena @smumryak Can you try out setup instructions for VS Code here? https://github.com/pwsacademy/swift-setup/blob/main/editors/vscode-linux/README.md
These have been tested on the various distributions we support (Ubuntu, Fedora, and derivatives), so check the instructions for those platforms as well, in case you’ve set up Swift differently.
@svanimpe Just got around to try this out and everything seems to work. Thank you!
Hi
I need to debug swift 5.2.x in Ubuntu , But it always show me that problem
configuration: { type: 'lldb', request: 'launch', name: 'Debug', program: '${workspaceFolder}/.build/debug/Run', args: [], cwd: '${workspaceFolder}', preLaunchTask: 'swift-build', expressions: 'simple', relativePathBase: '/home/lokinfey/dev/web/swift/hello' } liblldb: /usr/share/swift/usr/lib/liblldb.so.7.0.0svn libpython: null environment: { LLDB_DEBUGSERVER_PATH: '/usr/share/swift/usr/bin/lldb-server' } params: {} [2020-07-18T02:54:20Z INFO codelldb::find_python] Querying python sysconfig [2020-07-18T02:54:20Z INFO codelldb::find_python] Query returned ["libpython3.7m.so.1.0"] [2020-07-18T02:54:20Z INFO codelldb::find_python] Probing "libpython3.7m.so.1.0" [2020-07-18T02:54:20Z INFO codelldb::find_python] Py_GetVersion returned "3.7.4 (default, Jul 15 2020, 20:26:18) \n[GCC 9.3.0]" [2020-07-18T02:54:20Z INFO codelldb::find_python] Parsed version as 3.7 [2020-07-18T02:54:20Z INFO codelldb::find_python] Accepted Listening on port 38929 [2020-07-18T02:54:20Z DEBUG codelldb] New debug session Fatal Python error: PyThreadState_Get: no current thread Received signal: SIGABRT 0: codelldb::hook_crashes::handler 1:
2: gsignal
3: abort
4: Py_FatalError
5: PyThreadState_Get
6: Py_InitModule4_64
7: init_lldb
8: _ZN12lldb_private27ScriptInterpreterPythonImpl17InitializePrivateEv
9: _ZN12lldb_private27ScriptInterpreterPythonImplC1ERNS_8DebuggerE
10: _ZN12lldb_private27ScriptInterpreterPythonImpl14CreateInstanceERNS_8DebuggerE
11: _ZN12lldb_private13PluginManager31GetScriptInterpreterForLanguageEN4lldb14ScriptLanguageERNS_8DebuggerE
12: _ZN12lldb_private8Debugger20GetScriptInterpreterEb
13: _ZN33CommandObjectCommandsScriptImport9DoExecuteERN12lldb_private4ArgsERNS0_19CommandReturnObjectE
14: _ZN12lldb_private19CommandObjectParsed7ExecuteEPKcRNS_19CommandReturnObjectE
15: _ZN12lldb_private18CommandInterpreter13HandleCommandEPKcNS_8LazyBoolERNS_19CommandReturnObjectEPNS_16ExecutionContextEbb
16: _ZN4lldb20SBCommandInterpreter13HandleCommandEPKcRNS_18SBExecutionContextERNS_21SBCommandReturnObjectEb
17: _ZN4lldb20SBCommandInterpreter13HandleCommandEPKcRNS_21SBCommandReturnObjectEb
18: __cpp_closure_8324812709926371778
19: lldb::strings::with_cstr
20: lldb::sbcommandinterpreter::SBCommandInterpreter::handle_command
21: codelldb::python::initialize
22: codelldb::debug_session::DebugSession::run
23: <core::future::from_generator::GenFuture as core::future::future::Future>::poll
24: tokio::runtime::thread_pool::ThreadPool::block_on
25: tokio::runtime::context::enter
26: tokio::runtime::handle::Handle::enter
27: entry
28: codelldb::main
29: std::rt::lang_start::{{closure}}
30: std::rt::lang_start_internal
31: main
32: __libc_start_main
33: _start
Debug adapter exit code=255, signal=nul
I set settings.json like this
{
}