numaru / vscode-ceedling-test-adapter

Ceedling Test Adapter for the VS Code Test Explorer
MIT License
35 stars 11 forks source link

Can't figure out how to set up debugger #61

Open dbak-invn opened 4 years ago

dbak-invn commented 4 years ago

Hi,

I can't figure out how to set up the debugger, the README is pretty unclear (at least for somebody unfamiliar with ceedling).

I copy/pasted the following into my settings file, but I am still getting the same error:

{
    "name": "Ceedling Test Explorer Debug",
    "type": "cppdbg",
    "request": "launch",
    "program": "${workspaceFolder}/build/test/out/${command:ceedlingExplorer.debugTestExecutable}",
    "args": [],
    "stopAtEntry": false,
    "cwd": "${workspaceFolder}",
    "environment": [],
    "externalConsole": false,
    "MIMode": "gdb",
    "miDebuggerPath": "C:/MinGW/bin/gdb.exe",
    "setupCommands": [
        {
            "description": "Enable pretty-printing for gdb",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
        }
    ]
}

Is there a part of this that I need to fill in, or something? I don't know what a debug configuration is, or how to specify them.

luis-possatti commented 3 years ago

Hi @dbak-invn

I have the same problem understanding this section of README, it is not quite clear. I will show how I could make it work in my case:

  1. Click in "Run->Add Configuration"
    • This step will guide you to create a "launch.json" file in your .vscode folder. In my case, I choose in the predefined configurations the option "C++(GDB/LLDB). By doing this, the content of my "launch.json" was:
      
      {
      // Use IntelliSense to learn about possible attributes.
      // Hover to view descriptions of existing attributes.
      // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
      "version": "0.2.0",
      "configurations": [
      {
          "name": "(gdb) Launch",
          "type": "cppdbg",
          "request": "launch",
          "program": "enter program name, for example ${workspaceFolder}/a.exe",
          "args": [],
          "stopAtEntry": false,
          "cwd": "${workspaceFolder}",
          "environment": [],
          "externalConsole": false,
          "MIMode": "gdb",
          "miDebuggerPath": "/path/to/gdb",
          "setupCommands": [
              {
                  "description": "Enable pretty-printing for gdb",
                  "text": "-enable-pretty-printing",
                  "ignoreFailures": true
              }
          ]
      }
      ]
      }

2. I used the file that was generated in the step below as a template and inserted the suggested code of the documentation as another element of the **configurations** array, like below. I my case, I need to make a few modifications in the configuration code provided in extension's the documentation, to point to the correct path of gdb in my computer.

{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { // object generated in the previous step },

    {
        "name": "Ceedling Test Explorer Debug",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceFolder}/build/test/out/${command:ceedlingExplorer.debugTestExecutable}",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceFolder}",
        "environment": [],
        "externalConsole": false,
        "MIMode": "gdb",
        "miDebuggerPath": "C:/cygwin64/bin/gdb.exe",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
        ]
    }
]

}


3. The object I've inserted in the launch's configuration array has a field called _name_ and its value is **_Ceedling Test Explorer Debug_**. You should open the _Ceedling Test Explorer_ settings' page and point to this value in the _Debugging Configuration_ field, like in the image below:

![image](https://user-images.githubusercontent.com/8042139/90401576-862ac700-e074-11ea-962d-3baaafd7d147.png)

I hope you can make it works.

Luis