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

Feature request, better debugger intergration with QT #1721

Open
lygstate opened this issue Mar 18, 2021 · 6 comments
Open

Feature request, better debugger intergration with QT #1721

lygstate opened this issue Mar 18, 2021 · 6 comments
Labels
enhancement an enhancement to the product that is either not present or an improvement to an existing feature Feature: debug/launch help wanted we currently are not planning work on this and would like help from the open source community
Milestone

Comments

@lygstate
Copy link
Contributor

Qt 6.0 are using cmake by default, and cmake have better support for qt now.
For debugging with QString and other Qt object, we need visualizerFile for debugger,
so we need automatically specify the visualizerFile automatically when the project are depends on Qt

@andreeis
Copy link
Contributor

Thank you for the feature idea. We will analyze and triage it. In the mean time, since I am not very familiar with this, just give a few more details about this visualizerFile, what should the extension do exactly.

@andreeis andreeis added enhancement an enhancement to the product that is either not present or an improvement to an existing feature Feature: debug/launch labels Mar 18, 2021
@lygstate
Copy link
Contributor Author

Thank you for the feature idea. We will analyze and triage it. In the mean time, since I am not very familiar with this, just give a few more details about this visualizerFile, what should the extension do exactly.

when launch the debugger, specify the visualizerFile properly

@andreeis andreeis added the help wanted we currently are not planning work on this and would like help from the open source community label Mar 22, 2021
@andreeis andreeis added this to the Backlog milestone Mar 22, 2021
@CComparon
Copy link

@lygstate
Kindly bumping up this issue as I'm also willing to use vscode+cmake+msvc+Qt, and types visualizers (natvis files) are a must have. This is not specific to Qt or any other library btw.
I see that the configuration item cmake.debugConfig.visualizerFile already exists in your codebase but is not implemented anywhere. Also it appears as "unknown" when trying to add it to settings files:
image
I believe this value is meant to be forwarded to the visualizerFile attribute of the launch configuration as documented here. That's also something that the Qt tools extension addresses but this extension seems incompatible with a cmake flow as it taps into launch.js directly to set the visualizerFile attribute.

Please let me know if I can provide further information.
Many thanks,
Cyril

@pktiuk
Copy link

pktiuk commented Aug 8, 2022

I think this feature could be done as a part of #1394
If this add-on would generate proper launch files, we could edit them in any way

@pktiuk
Copy link

pktiuk commented Aug 8, 2022

@CComparon
I think you made mistake in your config.

    "cmake.debugConfig": {
        "visualizerFile": "${workspaceFolder}/.vscode/qt5.natvis.xml",
        "showDisplayString": true,
    },

in my case this snippet in settings.json works (showDisplayString is true bacause of this)

@marrycake
Copy link

@CComparon I think you made mistake in your config.

    "cmake.debugConfig": {
        "visualizerFile": "${workspaceFolder}/.vscode/qt5.natvis.xml",
        "showDisplayString": true,
    },

in my case this snippet in settings.json works (showDisplayString is true bacause of this)

This approach will lead to serious performance losses. I have found a better solution.

{
    "version": "0.2.0",
    "configurations": [
        
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${command:cmake.launchTargetPath}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [
                {
                    "name": "PATH",
                    "value": "$PATH:${command:cmake.launchTargetDirectory}"
                }
            ],
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": false
                }
            ],
        }
    ]
}

setup the command enable pretty-printing for gdb, and set qt5printing, You can get the same result, and there is no longer a lag in the debug process.

@github-project-automation github-project-automation bot moved this to Triage Needed in CMake Tools Nov 29, 2023
@gcampbell-msft gcampbell-msft moved this from Triage Needed to Pending Prioritization in CMake Tools Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement an enhancement to the product that is either not present or an improvement to an existing feature Feature: debug/launch help wanted we currently are not planning work on this and would like help from the open source community
Projects
Status: Pending Prioritization
Development

No branches or pull requests

5 participants