October 15, 2017 Re: debugging in vs code on Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to piotrklos | On Saturday, 14 October 2017 at 19:01:52 UTC, piotrklos wrote:
> On Saturday, 14 October 2017 at 13:12:51 UTC, Jerry wrote:
>> On Friday, 13 October 2017 at 12:55:09 UTC, piotrklos wrote:
>>> (...)
>>
>> If you use generate a 32-bit binary using DMD, it generates it in a format that the C/C++ extension doesn't understand. You need to compile -m32mscoff or -m64, and you need to make sure the /DEBUG is passed to the linker, as I don't think dmd passes it that. You can do that by passing "-L/DEBUG" to DMD (when using -m32mscoff or -m64). There should be a .pdb file that gets generated, when you start the debugger it should say that symbols were loaded for the exe.
>>
>> I also can't say for certain if debug information is even generated for the unittests, so that might be something worth looking into to make sure it does.
>
> I have added this to dub.json:
> "dmd-flags":[
> "-g", "-m64", "-L/DEBUG"
> ]
> but I don't see a pdb file generated when I build. What am I doing wrong?
It's not necessary to set "dmd-flags". You need to run dub with "--arch=x86_64 --build=debug". Then, the .pdb file is under the folder .dub.
To start a debug session, you would add a config file called launch.json, set the "program" and press F5.
By the way, don't foret to add a breakpoint.
|
October 15, 2017 Re: debugging in vs code on Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to piotrklos | On Friday, 13 October 2017 at 12:55:09 UTC, piotrklos wrote:
> Has anyone been able to debug in VS code on Windows? What am I doing wrong?
Yep, it work for me.
How do you start debugging?
I noticed that the bottom button (small bug) at status bar doesn't work for me. But when I use Debug → Start Debugging (F5), it works.
|
October 17, 2017 Re: debugging in vs code on Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry | On Sunday, 15 October 2017 at 13:54:49 UTC, Dmitry wrote:
> On Friday, 13 October 2017 at 12:55:09 UTC, piotrklos wrote:
>> Has anyone been able to debug in VS code on Windows? What am I doing wrong?
>
> Yep, it work for me.
> How do you start debugging?
> I noticed that the bottom button (small bug) at status bar doesn't work for me. But when I use Debug → Start Debugging (F5), it works.
Can you share your tasks.json and launch.json?
|
October 17, 2017 Re: debugging in vs code on Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Domain | On Tuesday, 17 October 2017 at 02:32:49 UTC, Domain wrote: > Can you share your tasks.json and launch.json? tasks.json - I don't have this file. launch.json: { "version": "0.2.0", "configurations": [ { "name": "(Windows) Launch", "type": "cppvsdbg", "request": "launch", "program": "${workspaceRoot}\\parser.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceRoot}", "environment": [], "externalConsole": true } ] } Also I have changed preferences: "debug.allowBreakpointsEverywhere": true, Status bar: x86_64 debug dmd |
October 17, 2017 Re: debugging in vs code on Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry | On Tuesday, 17 October 2017 at 03:10:52 UTC, Dmitry wrote:
> On Tuesday, 17 October 2017 at 02:32:49 UTC, Domain wrote:
>> Can you share your tasks.json and launch.json?
>
> tasks.json - I don't have this file.
> launch.json:
> {
> "version": "0.2.0",
> "configurations": [
>
> {
> "name": "(Windows) Launch",
> "type": "cppvsdbg",
> "request": "launch",
> "program": "${workspaceRoot}\\parser.exe",
> "args": [],
> "stopAtEntry": false,
> "cwd": "${workspaceRoot}",
> "environment": [],
> "externalConsole": true
> }
> ]
> }
>
> Also I have changed preferences:
> "debug.allowBreakpointsEverywhere": true,
>
> Status bar:
> x86_64 debug dmd
Before this will work, one must install the Microsoft C/C++ Addin i.e. ms-vscode.cpptools.
Start debugging and select the C++ debugger.
|
October 17, 2017 Re: debugging in vs code on Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry | On Tuesday, 17 October 2017 at 03:10:52 UTC, Dmitry wrote:
> On Tuesday, 17 October 2017 at 02:32:49 UTC, Domain wrote:
>> Can you share your tasks.json and launch.json?
>
> tasks.json - I don't have this file.
> launch.json:
> {
> "version": "0.2.0",
> "configurations": [
>
> {
> "name": "(Windows) Launch",
> "type": "cppvsdbg",
> "request": "launch",
> "program": "${workspaceRoot}\\parser.exe",
> "args": [],
> "stopAtEntry": false,
> "cwd": "${workspaceRoot}",
> "environment": [],
> "externalConsole": true
> }
> ]
> }
>
> Also I have changed preferences:
> "debug.allowBreakpointsEverywhere": true,
>
> Status bar:
> x86_64 debug dmd
Thank you very much! I used to use "mago-mi" type configuration, and never succeed.
|
October 17, 2017 Re: debugging in vs code on Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Domain | On Tuesday, 17 October 2017 at 08:43:33 UTC, Domain wrote: > On Tuesday, 17 October 2017 at 03:10:52 UTC, Dmitry wrote: >> On Tuesday, 17 October 2017 at 02:32:49 UTC, Domain wrote: >>> Can you share your tasks.json and launch.json? >> >> tasks.json - I don't have this file. >> launch.json: >> { >> "version": "0.2.0", >> "configurations": [ >> >> { >> "name": "(Windows) Launch", >> "type": "cppvsdbg", >> "request": "launch", >> "program": "${workspaceRoot}\\parser.exe", >> "args": [], >> "stopAtEntry": false, >> "cwd": "${workspaceRoot}", >> "environment": [], >> "externalConsole": true >> } >> ] >> } >> >> Also I have changed preferences: >> "debug.allowBreakpointsEverywhere": true, >> >> Status bar: >> x86_64 debug dmd > > Thank you very much! I used to use "mago-mi" type configuration, and never succeed. This is my tasks.json: { // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", // Run the dub command to do a build or test "type": "shell", "command": "dub", "presentation": { "echo": true, "reveal": "always", "focus": false, "panel": "shared" }, "tasks": [ { "taskName": "build", "args": [ "--arch=x86_mscoff", "--build=debug" ], "group": { "kind": "build", "isDefault": true }, "problemMatcher": { "owner": "d", "fileLocation": [ "relative", "${workspaceRoot}" ], "pattern": { "regexp": "^([^(]*)\\((\\d+),\\s*(\\d+)\\):\\s*(Warning|Error):\\s+(.*)$", "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5 } } }, { "taskName": "test", "group": "test", "problemMatcher": { "owner": "d", "fileLocation": [ "relative", "${workspaceRoot}" ], "pattern": { "regexp": "^([^(]*)\\((\\d+),\\s*(\\d+)\\):\\s*(Warning|Error):\\s+(.*)$", "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5 } } } ] } And this is my launch.json: { // 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": "Debug", "type": "cppvsdbg", "request": "launch", "program": "${workspaceRoot}/app.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceRoot}", "environment": [], "externalConsole": true, "preLaunchTask": "build" } ] } |
October 17, 2017 Re: debugging in vs code on Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Arjan | On Tuesday, 17 October 2017 at 08:38:20 UTC, Arjan wrote: > Before this will work, one must install the Microsoft C/C++ Addin i.e. ms-vscode.cpptools. > Start debugging and select the C++ debugger. Yep https://forum.dlang.org/post/xwsvxphjtzgwjyrgdquu@forum.dlang.org |
October 18, 2017 Re: debugging in vs code on Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry | On Tuesday, 17 October 2017 at 10:09:12 UTC, Dmitry wrote:
> On Tuesday, 17 October 2017 at 08:38:20 UTC, Arjan wrote:
>> Before this will work, one must install the Microsoft C/C++ Addin i.e. ms-vscode.cpptools.
>> Start debugging and select the C++ debugger.
>
> Yep https://forum.dlang.org/post/xwsvxphjtzgwjyrgdquu@forum.dlang.org
Yesterday I found that C/C++ debugger is not very usable for D. For example, it doesn't show some structs and associative arrays (shows it just as pointer), pointer+length+chunk of memory instead of string, etc. So, I had to use VisualStudio + Mago for debugging.
|
October 18, 2017 Re: debugging in vs code on Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry | On Wednesday, 18 October 2017 at 07:57:25 UTC, Dmitry wrote:
> On Tuesday, 17 October 2017 at 10:09:12 UTC, Dmitry wrote:
>> On Tuesday, 17 October 2017 at 08:38:20 UTC, Arjan wrote:
>>> Before this will work, one must install the Microsoft C/C++ Addin i.e. ms-vscode.cpptools.
>>> Start debugging and select the C++ debugger.
>>
>> Yep https://forum.dlang.org/post/xwsvxphjtzgwjyrgdquu@forum.dlang.org
>
> Yesterday I found that C/C++ debugger is not very usable for D. For example, it doesn't show some structs and associative arrays (shows it just as pointer), pointer+length+chunk of memory instead of string, etc. So, I had to use VisualStudio + Mago for debugging.
That's because compiler doesn't (yet) generates all necessary debug info.
x86_mscoff had better support last time I checked.
And structs can be observed using watch, like if it is C++ variable (&some_struct), not sure about strings though.
|
Copyright © 1999-2021 by the D Language Foundation