{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/vscode-cpptools/issues/2745","repository_url":"https://api.github.com/repos/Microsoft/vscode-cpptools","labels_url":"https://api.github.com/repos/Microsoft/vscode-cpptools/issues/2745/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/vscode-cpptools/issues/2745/comments","events_url":"https://api.github.com/repos/Microsoft/vscode-cpptools/issues/2745/events","html_url":"https://github.com/Microsoft/vscode-cpptools/issues/2745","id":375917546,"node_id":"MDU6SXNzdWUzNzU5MTc1NDY=","number":2745,"title":"Problem passing setupCommands to gdb","user":{"login":"Stragarp","id":44639572,"node_id":"MDQ6VXNlcjQ0NjM5NTcy","avatar_url":"https://avatars3.githubusercontent.com/u/44639572?v=4","gravatar_id":"","url":"https://api.github.com/users/Stragarp","html_url":"https://github.com/Stragarp","followers_url":"https://api.github.com/users/Stragarp/followers","following_url":"https://api.github.com/users/Stragarp/following{/other_user}","gists_url":"https://api.github.com/users/Stragarp/gists{/gist_id}","starred_url":"https://api.github.com/users/Stragarp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stragarp/subscriptions","organizations_url":"https://api.github.com/users/Stragarp/orgs","repos_url":"https://api.github.com/users/Stragarp/repos","events_url":"https://api.github.com/users/Stragarp/events{/privacy}","received_events_url":"https://api.github.com/users/Stragarp/received_events","type":"User","site_admin":false},"labels":[{"id":355010938,"node_id":"MDU6TGFiZWwzNTUwMTA5Mzg=","url":"https://api.github.com/repos/Microsoft/vscode-cpptools/labels/debugger","name":"debugger","color":"c5def5","default":false}],"state":"open","locked":false,"assignee":{"login":"pieandcakes","id":17558378,"node_id":"MDQ6VXNlcjE3NTU4Mzc4","avatar_url":"https://avatars2.githubusercontent.com/u/17558378?v=4","gravatar_id":"","url":"https://api.github.com/users/pieandcakes","html_url":"https://github.com/pieandcakes","followers_url":"https://api.github.com/users/pieandcakes/followers","following_url":"https://api.github.com/users/pieandcakes/following{/other_user}","gists_url":"https://api.github.com/users/pieandcakes/gists{/gist_id}","starred_url":"https://api.github.com/users/pieandcakes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pieandcakes/subscriptions","organizations_url":"https://api.github.com/users/pieandcakes/orgs","repos_url":"https://api.github.com/users/pieandcakes/repos","events_url":"https://api.github.com/users/pieandcakes/events{/privacy}","received_events_url":"https://api.github.com/users/pieandcakes/received_events","type":"User","site_admin":false},"assignees":[{"login":"pieandcakes","id":17558378,"node_id":"MDQ6VXNlcjE3NTU4Mzc4","avatar_url":"https://avatars2.githubusercontent.com/u/17558378?v=4","gravatar_id":"","url":"https://api.github.com/users/pieandcakes","html_url":"https://github.com/pieandcakes","followers_url":"https://api.github.com/users/pieandcakes/followers","following_url":"https://api.github.com/users/pieandcakes/following{/other_user}","gists_url":"https://api.github.com/users/pieandcakes/gists{/gist_id}","starred_url":"https://api.github.com/users/pieandcakes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pieandcakes/subscriptions","organizations_url":"https://api.github.com/users/pieandcakes/orgs","repos_url":"https://api.github.com/users/pieandcakes/repos","events_url":"https://api.github.com/users/pieandcakes/events{/privacy}","received_events_url":"https://api.github.com/users/pieandcakes/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2018-10-31T11:29:45Z","updated_at":"2018-11-02T09:44:58Z","closed_at":null,"author_association":"NONE","body":"I'm trying to pass some extra commands after the launch of GDB. These commands are working if I enter them manually in the debug console of Visual Studio, prefixed with \"-exec\", after GDB started. I'd like to use setupCommands to do it automatically with the launch.json file. Here is what my file looks like : \r\n\r\n```\r\n{\r\n            //General\r\n            \"name\": \"PyraDebug\",\r\n            \"type\": \"cppdbg\",\r\n            \"request\": \"launch\",\r\n            \"program\": \"/Users/Squarp/Code/pyrapro/build/pyrapro/pyrapro.elf\",\r\n            \"targetArchitecture\": \"ARM\",\r\n            \"launchCompleteCommand\": \"None\",            \r\n            \"cwd\": \"${workspaceFolder}\",            \r\n            \"externalConsole\": false,       \r\n        \r\n            //GDB Server\r\n            \"MIMode\": \"gdb\",\r\n            \"miDebuggerServerAddress\": \"localhost:3333\",\r\n            \"miDebuggerPath\": \"/Users/Squarp/Code/opt/gcc-arm-none-eabi-6-2017-q1-update/bin/arm-none-eabi-gdb\",\r\n            \"miDebuggerArgs\": \"\",\r\n            \"stopAtEntry\": true,\r\n            \"serverLaunchTimeout\": 2000,\r\n            \"setupCommands\": [\r\n                {\"text\": \"monitor reset halt\"},\r\n                {\"text\": \"load\"},\r\n                {\"text\":\"continue\"}\r\n            ],\r\n            \"customLaunchSetupCommands\": [],\r\n            \"logging\": { \"engineLogging\": true, \"trace\": true, \"traceResponse\": true } \r\n\r\n            //Tasks\r\n            // \"preLaunchTask\": \"rebuild\"\r\n            \r\n\r\n        }\r\n```\r\nAnd the error :\r\n\r\n> Unable to start debugging. Unexpected GDB output from command \"-interpreter-exec console \"monitor reset halt\"\". \"monitor\" command not supported by this target.\r\n\r\nThose commands are pretty classic, I tried many things but I'm stuck now. Everything is working fine if I enter those in Terminal.\r\n\r\nAny help would be greatly appreciated."},"comment":{"url":"https://api.github.com/repos/Microsoft/vscode-cpptools/issues/comments/435324772","html_url":"https://github.com/Microsoft/vscode-cpptools/issues/2745#issuecomment-435324772","issue_url":"https://api.github.com/repos/Microsoft/vscode-cpptools/issues/2745","id":435324772,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNTMyNDc3Mg==","user":{"login":"Stragarp","id":44639572,"node_id":"MDQ6VXNlcjQ0NjM5NTcy","avatar_url":"https://avatars3.githubusercontent.com/u/44639572?v=4","gravatar_id":"","url":"https://api.github.com/users/Stragarp","html_url":"https://github.com/Stragarp","followers_url":"https://api.github.com/users/Stragarp/followers","following_url":"https://api.github.com/users/Stragarp/following{/other_user}","gists_url":"https://api.github.com/users/Stragarp/gists{/gist_id}","starred_url":"https://api.github.com/users/Stragarp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stragarp/subscriptions","organizations_url":"https://api.github.com/users/Stragarp/orgs","repos_url":"https://api.github.com/users/Stragarp/repos","events_url":"https://api.github.com/users/Stragarp/events{/privacy}","received_events_url":"https://api.github.com/users/Stragarp/received_events","type":"User","site_admin":false},"created_at":"2018-11-02T09:44:58Z","updated_at":"2018-11-02T09:44:58Z","author_association":"NONE","body":"Hi @pieandcakes thanks for the answer.\r\nI think it is exactly what you described, the command is unknown because gdb is not connected to the server yet when it tries to pass it.\r\n\r\nAfter several hours of wandering on the internet, I found a solution that works fine. I'll post it there in case someone faces the same problem.\r\n\r\nThe actions I want to accomplish in the right order are : \r\n-Start the server (Jlink gdb server in this case)\r\n-Start local gdb and connect to server\r\n-Pass some args (reset, load and continue)\r\n\r\nHere is my 'launch.json':\r\n`\r\n{          \r\n            //General\r\n            \"name\": \"Debug\",\r\n            \"type\": \"cppdbg\",\r\n            \"request\": \"launch\",\r\n\r\n            //GDB Client\r\n            \"MIMode\": \"gdb\",\r\n            \"miDebuggerServerAddress\": \"localhost:3333\",\r\n            \"miDebuggerPath\": \"/Users/Code/opt/gcc-arm-none-eabi-6-2017-q1-update/bin/arm-none-eabi-gdb\",\r\n            \"miDebuggerArgs\": \"-x ${workspaceFolder}/.gdbinit\",\r\n\r\n            //GDB Server\r\n            \"debugServerPath\": \"/Applications/SEGGER/JLink_V634f/JLinkGDBServer\",\r\n            \"debugServerArgs\": \"-if SWD -device STM32F769BG -port 3333\",\r\n            \"serverStarted\":\"Connected to target\",\r\n\r\n            \"program\": \"/Users/Code/strgg/build/strgg/strgg.elf\",            \r\n            \"cwd\": \"${workspaceFolder}\",            \r\n            \"externalConsole\": false,\r\n            \"stopAtEntry\": false,\r\n\r\n            //Lancement du build avant de démarrer le serveur\r\n            // \"preLaunchTask\": \"rebuild\"\r\n            //Debug\r\n            // \"logging\": { \"engineLogging\": true, \"trace\": false, \"traceResponse\": false },\r\n\r\n        }\r\n`     \r\n\r\nAnd the .gdb init specified in \"miDebuggerArgs\": \"-x ${workspaceFolder}/.gdbinit:\r\n\r\n```\r\ndefine target hookpost-remote\r\nmonitor reset\r\nload\r\nend\r\n```\r\nWhich uses a [hook](https://sourceware.org/gdb/onlinedocs/gdb/Hooks.html) to wait for the execution of the command target remote to execute the commands.\r\n\r\nThere might be a way to use setupCommands and not the .gdbinit file but I tried many things without success, so I think I'm going to go with this.\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"Stragarp"}}