Skip to content
New issue

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

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

Already on GitHub? # to your account

How to configure VSCode to achieve the same debugging behavior as GoLand? #3710

Closed
phantacix opened this issue Mar 12, 2025 · 2 comments
Closed
Labels
Debug Issues related to the debugging functionality of the extension. Question This is a question, rather than an issue report.
Milestone

Comments

@phantacix
Copy link

Issue: How to configure VSCode to achieve the same debugging behavior as GoLand?

Image on macOS

Environment:

MAC OS

VS Code 1.98.1

Mac-OS 12

Business Impact:

When terminating debug session using Shift+F5 (stop button), dlv directly kills the program process

Demo Code:

test-signal

Demo Video:
VSCode Debug

GoLand Debug

Question:

How to configure VSCode to achieve the same debugging behavior as GoLand?

@gopherbot gopherbot added this to the Untriaged milestone Mar 12, 2025
@phantacix
Copy link
Author

Demonstration code related to the problem
https://github.com/cherry-game/test-signal

项目简介 | Project Introduction

这个项目主要用于研究和比较VSCode与GoLand在Go程序调试过程中的行为差异。

This project is dedicated to studying and comparing the debugging behavior differences between VSCode and GoLand for Go programs.

主要发现 | Key Findings

调试终止行为差异 | Debug Termination Behavior Difference

  • VSCode:

    • 使用Shift+F5(停止按钮)终止调试时,dlv会直接杀死程序进程
    • When terminating debug session using Shift+F5 (stop button), dlv directly kills the program process
  • GoLand:

    • 使用Stop按钮终止调试时,不会直接杀死程序进程,程序会接收signal,根据业务逻辑处理完成后并优雅地终止进程
    • When terminating debug session using stop button, it does not directly kill the program process; instead, the program receives a signal and gracefully terminates after completing business logic

技术细节 | Technical Details

此项目有助于理解不同IDE在Go程序调试实现上的差异,特别是在进程管理和信号处理方面的不同表现。

This project helps understand the differences in Go program debugging implementation between IDEs, especially in terms of process management and signal handling.

疑问 | Questions

怎样配置VSCode让它在调试时与GoLand效果一样?

How to configure VSCode to achieve the same debugging behavior as GoLand?

@findleyr findleyr added Debug Issues related to the debugging functionality of the extension. Question This is a question, rather than an issue report. labels Mar 19, 2025
@h9jiang
Copy link
Member

h9jiang commented Mar 19, 2025

Thanks for raising this issue,

I have locally verified the behavior, vscode-go debugging does not gracefully terminate the process. I don't have goland installed but based on your recording, seems like goland grant process time to gracefully terminate.

There is a very old issue related to gracefully termination upon debugging here #120.

But I'm not aware that goland already support this behavior. I will check if dlv have any update on their side and how we can integrate it with vscode-go.

I will close this as duplicated and post my update in the issue 120 once I done by investigations.

@h9jiang h9jiang closed this as completed Mar 19, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Debug Issues related to the debugging functionality of the extension. Question This is a question, rather than an issue report.
Projects
None yet
Development

No branches or pull requests

4 participants