Giter Club home page Giter Club logo

Comments (3)

v-frankwang avatar v-frankwang commented on June 14, 2024

@Zingam Am I correct in understanding that the Feature Request you propose is that the following two fields are automatically (semi) auto-populated when the user adds the launch.json file? Can you tell me what functionality I can achieve after adding these two fields?

First field:
// Resolved by CMake Tools:
"program": "${command:cmake.launchTargetPath}",
Second field:
"environment": [
{
// add the directory where our target was built to the PATHs
// it gets resolved by CMake Tools:
"name": "PATH",
"value": "${env:PATH}:${command:cmake.getLaunchTargetDirectory}"
},

from vscode-cmake-tools.

H-G-Hristov avatar H-G-Hristov commented on June 14, 2024

Yes, then you don't need to manually fill out these fields with the compiled executable. Let's say:

"program": "C:\Projects\HelloWorld\out\my_build\HelloWorld.exe"

You need to fill the above to run your "HelloWorld.exe". If you use "program": "${command:cmake.launchTargetPath}",, this executable path will be resolved automatically for you. Please check the docs:

https://github.com/microsoft/vscode-cmake-tools/blob/main/docs/debug-launch.md

As is now you need to replace the default string in launch.json with either option above.

Currently if you add a new configuration you'll get this:

      {
        "name": "(gdb) Attach",
        "type": "cppdbg",
        "request": "attach",
        "program": "enter program name, for example ${workspaceFolder}/a.out",
        "MIMode": "gdb",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            },
            {
                "description": "Set Disassembly Flavor to Intel",
                "text": "-gdb-set disassembly-flavor intel",
                "ignoreFailures": true
            }
        ]
      },

I propose if the user is using this CMake extension the following to be generated instead:

      {
        "name": "(gdb) Attach",
        "type": "cppdbg",
        "request": "attach",
        // Resolved by CMake Tools:
        "program": "${command:cmake.launchTargetPath}",
        "MIMode": "gdb",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            },
            {
                "description": "Set Disassembly Flavor to Intel",
                "text": "-gdb-set disassembly-flavor intel",
                "ignoreFailures": true
            }
        ]
      },

It's a small QoL feature.

from vscode-cmake-tools.

v-frankwang avatar v-frankwang commented on June 14, 2024

@gcampbell-msft
An improvement suggested by users is that the following two fields are automatically (semi-automatically) populated when adding a launch.json file, which automatically finds the compiled executable. Can you give some suggestions?

First field:
// Resolved by CMake Tools:
"program": "${command:cmake.launchTargetPath}",

Second field:
"environment": [
{
// add the directory where our target was built to the PATHs
// it gets resolved by CMake Tools:
"name": "PATH",
"value": "${env:PATH}:${command:cmake.getLaunchTargetDirectory}"
},

from vscode-cmake-tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.