Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging won't start if env_logger::init() is called. #626

Closed
msklywenn opened this issue Jan 21, 2022 · 3 comments
Closed

Debugging won't start if env_logger::init() is called. #626

msklywenn opened this issue Jan 21, 2022 · 3 comments

Comments

@msklywenn
Copy link

msklywenn commented Jan 21, 2022

OS: Windows 10 Pro 64 bits 21H1
VSCode version: 1.63.2
CodeLLDB version: 1.6.10
Compiler: rustc 1.58.0 (02072b482 2022-01-11)
Debuggee: stable-x86_64-pc-windows-msvc

A simple rust program like

fn main() {
    println!("hello");
}

works properly. Breakpoints even work if set on the println! line, for example.

However, if I add env_logger 0.9 to Cargo.toml and then just add a call to env_logger::init,

fn main() {
    env_logger::init();
    println!("hello");
}

debugging fails with the following message: Error: Os { code: 10061, kind: ConnectionRefused, message: "Aucune connexion n’a pu être établie car l’ordinateur cible l’a expressément refusée." } (Loose translation: "no connection could be established because the computer expressly refused it")

I'm not a 100% sure if this is a codelldb or env_logger bug but it feels to me that it's the former.

Cargo.toml:

[package]
name = "test"
version = "0.1.0"
edition = "2021"

[dependencies]
"env_logger" = "0.9"
Verbose log
Running `cargo build --bin=test --package=test --message-format=json`...
   Compiling test v0.1.0 (E:\rust\projects\test)
    Finished dev [unoptimized + debuginfo] target(s) in 0.63s
Raw artifacts:
{
  fileName: 'e:\\rust\\projects\\test\\target\\debug\\test.exe',
  name: 'test',
  kind: 'bin'
}
Filtered artifacts: 
{
  fileName: 'e:\\rust\\projects\\test\\target\\debug\\test.exe',
  name: 'test',
  kind: 'bin'
}
configuration: {
  type: 'lldb',
  request: 'launch',
  name: "Debug executable 'test'",
  args: [],
  cwd: '${workspaceFolder}',
  terminal: 'external',
  __configurationTarget: 5,
  relativePathBase: 'e:\\rust\\projects\\test',
  program: 'e:\\rust\\projects\\test\\target\\debug\\test.exe',
  sourceLanguages: [ 'rust' ]
}
liblldb: c:\Users\Daniel\.vscode\extensions\vadimcn.vscode-lldb-1.6.10\lldb\bin\liblldb.dll
environment: {}
params: {
  evaluateForHovers: true,
  commandCompletions: true,
  sourceLanguages: [ 'rust' ]
}
Listening on port 59945
[2022-01-21T14:02:45.546Z DEBUG codelldb] New debug session
INFO(Python) 15:02:45 formatters: Initializing
INFO(Python) 15:02:45 formatters.rust: Initializing
[2022-01-21T14:02:45.946Z DEBUG codelldb::dap_codec] --> {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"lldb","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"fr","supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true},"type":"request","seq":1}
[2022-01-21T14:02:45.947Z DEBUG codelldb::dap_codec] <-- {"type":"response","request_seq":1,"success":true,"command":"initialize","body":{"exceptionBreakpointFilters":[{"default":true,"filter":"rust_panic","label":"Rust: on panic"}],"supportTerminateDebuggee":true,"supportsCancelRequest":true,"supportsCompletionsRequest":true,"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsDataBreakpoints":true,"supportsDelayedStackTraceLoading":true,"supportsEvaluateForHovers":true,"supportsFunctionBreakpoints":true,"supportsGotoTargetsRequest":true,"supportsHitConditionalBreakpoints":true,"supportsLogPoints":true,"supportsReadMemoryRequest":true,"supportsRestartFrame":true,"supportsSetVariable":true}}
[2022-01-21T14:02:45.954Z DEBUG codelldb::dap_codec] --> {"command":"launch","arguments":{"type":"lldb","request":"launch","name":"Debug executable 'test'","args":[],"cwd":"E:\\rust\\projects\\test","terminal":"external","__configurationTarget":5,"relativePathBase":"e:\\rust\\projects\\test","program":"e:\\rust\\projects\\test\\target\\debug\\test.exe","sourceLanguages":["rust"],"_adapterSettings":{"displayFormat":"auto","showDisassembly":"auto","dereferencePointers":true,"suppressMissingSourceFiles":true,"evaluationTimeout":5,"consoleMode":"commands","sourceLanguages":null,"terminalPromptClear":null,"evaluateForHovers":true,"commandCompletions":true,"reproducer":false},"__sessionId":"a8df0089-8ed1-4e93-aa2c-e405b6a68835"},"type":"request","seq":2}
[2022-01-21T14:02:45.954Z DEBUG codelldb::dap_codec] <-- {"type":"event","seq":1,"event":"capabilities","body":{"capabilities":{"exceptionBreakpointFilters":[{"default":true,"filter":"rust_panic","label":"Rust: on panic"}],"supportTerminateDebuggee":true,"supportsCancelRequest":true,"supportsCompletionsRequest":true,"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsDataBreakpoints":true,"supportsDelayedStackTraceLoading":true,"supportsEvaluateForHovers":true,"supportsFunctionBreakpoints":true,"supportsGotoTargetsRequest":true,"supportsHitConditionalBreakpoints":true,"supportsLogPoints":true,"supportsReadMemoryRequest":true,"supportsRestartFrame":true,"supportsSetVariable":true}}}
[2022-01-21T14:02:46.110Z DEBUG codelldb::dap_codec] <-- {"type":"event","seq":2,"event":"initialized"}
[2022-01-21T14:02:46.110Z DEBUG codelldb::debug_session] Debug event: 000001DC2D40AD60 Event: broadcaster = 000001DC2CBAB6C8 (lldb.target), type = 0x00000002 (modules-loaded), data = {test.exe}
[2022-01-21T14:02:46.110Z DEBUG codelldb::dap_codec] <-- {"type":"event","seq":3,"event":"module","body":{"module":{"addressRange":"FFFFFFFFFFFFFFFF","id":"FFFFFFFFFFFFFFFF","name":"test.exe","path":"e:\\rust\\projects\\test\\target\\debug\\test.exe","symbolFilePath":"e:\\rust\\projects\\test\\target\\debug\\test.exe","symbolStatus":"Symbols loaded."},"reason":"new"}}
[2022-01-21T14:02:46.111Z DEBUG codelldb::dap_codec] <-- {"type":"request","seq":4,"command":"runInTerminal","arguments":{"args":["c:\\Users\\Daniel\\.vscode\\extensions\\vadimcn.vscode-lldb-1.6.10\\adapter\\codelldb.exe","terminal-agent","--port=59947"],"cwd":"","kind":"external","title":"Debug executable 'test'"}}
[2022-01-21T14:02:46.117Z DEBUG codelldb::dap_codec] --> {"command":"setFunctionBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":3}
[2022-01-21T14:02:46.117Z DEBUG codelldb::dap_codec] <-- {"type":"response","request_seq":3,"success":true,"command":"setFunctionBreakpoints","body":{"breakpoints":[]}}
[2022-01-21T14:02:46.124Z DEBUG codelldb::dap_codec] --> {"type":"response","seq":4,"command":"runInTerminal","request_seq":4,"success":true,"body":{}}
[2022-01-21T14:02:46.128Z DEBUG codelldb::dap_codec] --> {"command":"setDataBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":5}
[2022-01-21T14:02:46.129Z DEBUG codelldb::dap_codec] <-- {"type":"response","request_seq":5,"success":true,"command":"setDataBreakpoints","body":{"breakpoints":[]}}
[2022-01-21T14:02:46.140Z DEBUG codelldb::dap_codec] --> {"command":"setExceptionBreakpoints","arguments":{"filters":["rust_panic"]},"type":"request","seq":6}
Debug adapter exit code=3221225620, signal=null.

@vadimcn
Copy link
Owner

vadimcn commented Jan 25, 2022

duplicate of #323

@vadimcn vadimcn closed this as completed Jan 25, 2022
@msklywenn
Copy link
Author

@vadimcn I didn't see it as a duplicate because the proposed workaround did not work. Any terminal exhibits the issue.

@fatboyzz
Copy link

fatboyzz commented Aug 9, 2022

Same error for lldb here.
But cppvsdbg works with env_logger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants