vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

1.1.0-insiders3: Setup commands do not work when attaching

Open ryanpholt opened this issue 6 years ago • 5 comments

See launch config:

    "configurations": [
        {
            "name": "attach to main",
            "type": "cppdbg",
            "processId":"${command:pickProcess}",
            "request": "attach",
            "program": "${workspaceFolder}/main",
            "MIMode": "gdb",
            "logging": {
                "engineLogging": true
            },
            "setupCommands": [
                {
                    "description": "add dir",
                    "text": "directory /home/ryanholt/debug_test/add_this_folder",
                    "ignoreFailures": true
                }
            ],
            "miDebuggerPath": "/usr/bin/gdb"
        }

    ]

In 1.1.0-insiders3, the "setupCommands" do not execute (only when attaching?). However, in previous versions they do. In 1.0.1, for example, if I enable engineLogging, I see:

1: (2525) <-1002-interpreter-exec console "directory /home/ryanholt/debug_test/add_this_folder"
1: (2526) ->~"Source directories searched: /home/ryanholt/debug_test/add_this_folder:$cdir:$cwd\n"

However, in 1.1.0-insiders3, I do not see this in the logs. Running -exec show directories confirms that the setup command did not run.

This is a problem for me because we build with -fdebug-prefix-map which means I need to manually set the source path directory.

This repros on any project. However, I attached my very small repro. Use the debug config above and observe that the setupCommands do not work.

ryanpholt avatar Oct 30 '20 16:10 ryanpholt

Looks like in JSON we only set it for the launch case. https://github.com/microsoft/MIEngine/blob/1b5b5e87d767e1feacebf690ad3bd6fefd2924ae/src/MICore/LaunchOptions.cs#L1889

However this is a common option between launch and attach.

@ryan-holt-1 Thank you for using insiders and filing this issue!

To workaround this issue, you can install VS Code Cpptools 1.0.1 image

WardenGnaw avatar Oct 30 '20 18:10 WardenGnaw

Hi WardenGnaw,

I met the same issue. When I tried to downgrade C/C++ to 1.01, it always automatically upgrade it after reloading. Anyway, hope you can fix this issue soon.

Regards, Wei

Looks like in JSON we only set it for the launch case. https://github.com/microsoft/MIEngine/blob/1b5b5e87d767e1feacebf690ad3bd6fefd2924ae/src/MICore/LaunchOptions.cs#L1889

However this is a common option between launch and attach.

@ryan-holt-1 Thank you for using insiders and filing this issue!

To workaround this issue, you can install VS Code Cpptools 1.0.1 image

weisun76 avatar Nov 02 '20 19:11 weisun76

You need to set the extensions.autoUpdate to false or C_Cpp.updateChannel to "Default".

sean-mcmanus avatar Nov 02 '20 20:11 sean-mcmanus

Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/1.1.0-insiders4

sean-mcmanus avatar Nov 04 '20 02:11 sean-mcmanus

Hi Sean,

Thank you so much!

I tested and confirmed it works. VSCode is really a great software and it helps us a lot.

Best regards, Wei

On Tue, Nov 3, 2020 at 8:29 PM Sean McManus [email protected] wrote:

Closed #6417 https://github.com/microsoft/vscode-cpptools/issues/6417.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode-cpptools/issues/6417#event-3955549830, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADSGMS6YL627GAP4C27RZUDSOC4CLANCNFSM4TFGBUQQ .

weisun76 avatar Nov 05 '20 03:11 weisun76