vscode-cmake-tools icon indicating copy to clipboard operation
vscode-cmake-tools copied to clipboard

Allow test debugging without a launch configuration

Open quyykk opened this issue 2 years ago • 10 comments

Brief Issue Summary

When I press on the Debug play button on a test in the Testing tab, it says in the output window:

[ctest] No launch configurations found.

Why do I need to provide a launch configuration when I want to debug a test? I can run the test, and debug the main target without any launch configuration.

The same should apply when debugging a test.

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

No response

quyykk avatar Sep 16 '23 19:09 quyykk

@quyykk Thanks for the suggestion! Marking it a feature request and putting it on the backlog to try and assess when/if we can fit this work in! Thanks again.

gcampbell-msft avatar Sep 25 '23 17:09 gcampbell-msft

@gcampbell-msft Seems like this feature (debugging a test) is actually broken.

I added a launch configuration to workaround and tried to debug a test, but instead of the test being launched with a debugger attached, it started my main application with a debugger. I'm assuming it uses my launch configuration? which is wrong

This issue should probably be reprioritized I think :smile:

quyykk avatar Sep 25 '23 22:09 quyykk

@xisui-MSFT can you comment on how this scenario is supposed to work?

benmcmorran avatar Oct 03 '23 19:10 benmcmorran

This is by design. VS Code requires a launch config in order to debug anything. CMake tools doesn't depend on extensions that provide debug adapters and so it's not appropriate to have a default one that uses "cppdbg" or something alike.

As for usage, @gcampbell-msft I remember you wrote a doc on creating a launch config for debugging tests?

xisui-MSFT avatar Oct 03 '23 20:10 xisui-MSFT

so it's not appropriate to have a default one that uses "cppdbg" or something alike.

This extension already uses cppdbg for Quick Debugging, so I don't really see the issue.

quyykk avatar Oct 03 '23 20:10 quyykk

I'm pretty sure Quick Debugging is added after this, so the original design is also fine. However, since it's decided that this extension now have a higher level of dependency on cpptools, it's OK to add some default launch options. @benmcmorran

xisui-MSFT avatar Oct 03 '23 20:10 xisui-MSFT

+1

weyllor avatar Apr 20 '24 09:04 weyllor

I am confused as well. I could set up the cmake build with gtest and let tests run with TestMate. So why does running a test work out of the box, but debugging requires a "configuration"? Furthermore, when I search about VSCode and debugging, it is said that in the launch.json file, one must give the path to the executable. But isn't selecting the executable job of the test runner, because there are many executables??? (Sorry, maybe I am spoiled from other IDEs, but why all that setting up stuff? Isn't this why there are extensions made for?)

IngmarPaetzold avatar Aug 16 '24 09:08 IngmarPaetzold

Or just make it easy to generate a boilerplate launch configuration.

AssortedBits avatar Oct 08 '24 17:10 AssortedBits