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

Cannot start CMake debugger in (Conan-)bootstrapped environments #4022

Closed
rschuurmanbench opened this issue Aug 29, 2024 · 6 comments
Closed
Labels
more info needed More info is needed from the community for us to properly triage and investigate.

Comments

@rschuurmanbench
Copy link

rschuurmanbench commented Aug 29, 2024

Brief Issue Summary

I am using Conan and CMake, and Conan will start CMake in the def build(), as shown here:

class MyProject(ConanFile):
    #... Lots of  stuff

    def build(self):
        # Pre-build actions

        cmake = CMake(self)
        cli_args = []

        if debugging:
            cli_args += ["--debugger", "--debugger-pipe",
                         r'\\.\pipe\MyCmakeDebugger']

        cmake.configure(cli_args=cli_args)
        if self.should_build:
            cmake.build()  # This calls CMake

As I understand, this means that if I want to use the CMake debugger for this, I need to set vscode debug type to external and provide --debugger --debugger-pipe \\.\pipe\MyCmakeDebugger as arguments to CMake.
The conanfile looks like this:

Now I have this launch configuration:

{
	"name": "Create build with CMake",
	"type": "cmake",
	"request": "launch",
	"pipeName": "\\\\.\\pipe\\MyCmakeDebugger",
	"preLaunchTask": "MyTaskThatBootstrapsTheBuild", // <-- Note that this does not work because VSCode will wait for the task to complete
	"cmakeDebugType": "external"
},

Now if I run this, the preLaunchTask will block, waiting for a debugger to connect.

It would be much better if VSCode just waits for the preLaunchTask to open the pipeName, and then connect to that.
If I seperate the 2 calls (run the task manually, then start the debugger), then it works perfectly fine.

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

No response

@gcampbell-msft
Copy link
Collaborator

gcampbell-msft commented Aug 29, 2024

Thanks for posting the issue! To help us understand the issue and prioritize it, could you tell us what version of the extension is this on?

@rschuurmanbench
Copy link
Author

It's on v1.19.49, which is the latest available for me now.

@gcampbell-msft
Copy link
Collaborator

@rschuurmanbench Can you install the 1.18.44 version and let me know if it works there? Our expectation is that it still won't work there. We're trying to understand if this is a regression

@rschuurmanbench
Copy link
Author

It's still there in 1.18.44. In both versions it's stuck here:
image
What I think is happening: Conan/Python calls CMake with --debugger -> This makes CMake blocking while waiting for a debugger to attach.
Because the PreLaunchTask probably has to be exited before the debugger even tries to connect, it blocks.

@v-frankwang v-frankwang added more info needed More info is needed from the community for us to properly triage and investigate. and removed triage labels Aug 30, 2024
@gcampbell-msft gcampbell-msft added triage and removed more info needed More info is needed from the community for us to properly triage and investigate. labels Aug 30, 2024
@v-frankwang
Copy link
Collaborator

@gcampbell-msft Users have verified that this issue is still reproduced on CMake Tools:v1.18.44, can you give some advice?

@v-frankwang v-frankwang added more info needed More info is needed from the community for us to properly triage and investigate. and removed triage labels Sep 20, 2024
@gcampbell-msft
Copy link
Collaborator

@v-frankwang Yes, this is a feature request.

@rschuurmanbench I actually believe this would be a possible feature request for VS Code. We don't control how the preLaunchTask runs, our task only starts to execute once this is finished. Therefore, I don't believe there is anything for us to do here.

@gcampbell-msft gcampbell-msft closed this as not planned Won't fix, can't repro, duplicate, stale Sep 20, 2024
@github-project-automation github-project-automation bot moved this from Blocked to Completed in CMake Tools Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more info needed More info is needed from the community for us to properly triage and investigate.
Projects
Status: Completed
Development

No branches or pull requests

3 participants