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

[CATCH2] CPPDBG Debug a single test does not trigger breakpoints anymore since 3.6.7 #240

Closed
4 tasks done
NovarisOberion opened this issue Dec 4, 2020 · 7 comments
Closed
4 tasks done

Comments

@NovarisOberion
Copy link

NovarisOberion commented Dec 4, 2020

Checklist

  • The issue is about this extension and NOT about a fork.
  • Check the known issues list.
  • The latest version of the extension was used.
  • It is not related to remote-vscode or I checked the following issue

Describe the bug

I am using microsoft's cpp extension and a launch.json setup for their debugger. Since the version 3.6.8 the "debug this test" option does no longer work. With 3.6.7 I am able to start a single test section and constrain the debugger to only this test, With 3.6.8 onwards this does no longer work, the debugger starts but it does not enter the programm, it simply quits again with signal 0.

To Reproduce

  • Create a CPP project
  • use the following launch.json
        {
            "name": "GDB Debug",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}\\build\\bin\\debug\\test.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}\\build\\bin\\debug",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "MAKE debug"
        },
  • implement a test, like this one:

#include

#include "catch.hpp"

TEST_CASE("name of the test case group")
{
std::unique_ptr pData = std::make_unique();
*pData = 1;

SECTION("name of a single test")
{
    *pData = 2;
    CHECK(*pData == 2);
}

pData.release();

}

  • place a breakpoint at the pointer assignment
  • start the test, it should pass
  • click the "debug" icon next to the TEST_CASE name in the test explorer
  • the breakpoint is NOT hit, the programm simply closes

Screenshots (optional)

Desktop

  • Extension Version: 3.6.11
  • VS Code Version: 1.52.0insider
  • Catch2 / Google Test / DOCTest Version: 2.13.3
  • OS Type and Version: Windows 10
  • Using remote-ssh/docker/wsl?: no

Regression bug?

With 3.6.7 the debugger works and the breakpoint is hit

  • Last extension version in which the feature were working: 3.6.7

Log (optional but recommended)

@NovarisOberion
Copy link
Author

As a side-comment, the latest version works with webfreak's debugger, its just microsoft's implementation that does not work

@matepek
Copy link
Owner

matepek commented Dec 4, 2020

Are you sure your source is in sync with the binary?

@NovarisOberion
Copy link
Author

Yes, I deleted all binaries and intermediate files and did a clean build

@NovarisOberion
Copy link
Author

If I start the debugger from the debug terminal so it runs through all tests, it hits the breakpoint

@matepek
Copy link
Owner

matepek commented Dec 4, 2020

Please enable logging, try to debug with the extension and attach the log

@NovarisOberion
Copy link
Author

Another finding: adding this line to the settings.json the latest version also works again and finds the breakpoint:
"testMate.cpp.debug.configTemplate": {
"type": "cppdbg",
"MIMode": "gdb",
"name": "${label} (${suiteLabel})",
"program": "${exec}",
"args": "${args}",
"cwd": "${cwd}",
"externalConsole": false,
"environment": []
}

@matepek
Copy link
Owner

matepek commented Dec 5, 2020

Yeah, this is the intended fully customizable way of doing it. Everything else is an unexpected journey. Btw:
you want this instead of that:

"testMate.cpp.debug.configTemplate": {
  "program": "${exec}",
  "args": "${argsArray}",
  "cwd": "${cwd}",
  "environment": "${envObjArray}",
  "sourceFileMap": "${sourceFileMapObj}"
}

@matepek matepek closed this as completed Dec 5, 2020
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

2 participants