Closed rafmudaf closed 6 years ago
lol that looks like no other language, can you enable showDevDebugOutput
and printCalls
and give the output when you hit pause?
This is the output when it hits a breakpoint:
1-gdb-set target-async on
2-environment-directory "/Users/rmudafor/Development/openfast/build/reg_tests/modules-local/beamdyn/bd_curved_beam/"
3-file-exec-and-symbols "/Users/rmudafor/Development/openfast/build/modules-local/beamdyn/beamdyn_driver"
4-exec-arguments /Users/rmudafor/Development/openfast/build/reg_tests/modules-local/beamdyn/bd_curved_beam/bd_driver.inp
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"thread-group-added","output":[["id","i1"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"cmd-param-changed","output":[["param","args"],["value","bd_driver.inp"]]}]}
GDB -> App: {"token":1,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"token":2,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["source-path","/Users/rmudafor/Development/openfast/build/reg_tests/modules-local/beamdyn/bd_curved_beam:$cdir:$cwd"]]}}
GDB -> App: {"token":3,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"token":4,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
5-break-delete
GDB -> App: {"token":5,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
6-break-insert -f "/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/BeamDyn.f90:546"
GDB -> App: {"token":6,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["bkpt",[["number","1"],["type","breakpoint"],["disp","keep"],["enabled","y"],["addr","0x000000010003f1af"],["func","bd_initshpderjaco"],["file","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/BeamDyn.f90"],["fullname","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/BeamDyn.f90"],["line","546"],["thread-groups",["i1"]],["times","0"],["original-location","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/BeamDyn.f90:546"]]]]}}
7-break-insert -f "BD_InitShpDerJaco"
GDB -> App: {"token":7,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["bkpt",[["number","2"],["type","breakpoint"],["disp","keep"],["enabled","y"],["addr","0x000000010003f151"],["func","bd_initshpderjaco"],["file","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/BeamDyn.f90"],["fullname","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/BeamDyn.f90"],["line","530"],["thread-groups",["i1"]],["times","0"],["original-location","BD_InitShpDerJaco"]]]]}}
8-thread-info
GDB -> App: {"token":8,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["threads",[]]]}}
Running executable
9-exec-run
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"thread-group-started","output":[["id","i1"],["pid","91776"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"thread-created","output":[["id","1"],["group-id","i1"]]}]}
10-thread-info
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"thread-exited","output":[["id","1"],["group-id","i1"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"thread-created","output":[["id","2"],["group-id","i1"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"[New Thread 0x1403 of process 91776]\n"}]}
[New Thread 0x1403 of process 91776]
11-thread-info
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"log","content":"warning: unhandled dyld version (15)\n"}]}
warning: unhandled dyld version (15)
GDB -> App: {"token":9,"outOfBandRecord":[],"resultRecords":{"resultClass":"running","results":[]}}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"exec","asyncClass":"running","output":[["thread-id","all"]]}]}
**************************************************************************************************
BeamDyn Driver
Copyright (C) National Renewable Energy Laboratory
This program is licensed under Apache License Version 2.0 and comes with ABSOLUTELY NO WARRANTY.
See the "LICENSE" file distributed with this software for details.
**************************************************************************************************
Running BeamDyn Driver
a part of OpenFAST - v1.0.0-60-g57b9d649-dirty
linked with NWTC Subroutine Library
Running BeamDyn.
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"breakpoint-modified","output":[["bkpt",[["number","2"],["type","breakpoint"],["disp","keep"],["enabled","y"],["addr","0x000000010003f151"],["func","bd_initshpderjaco"],["file","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/BeamDyn.f90"],["fullname","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/BeamDyn.f90"],["line","530"],["thread-groups",["i1"]],["times","1"],["original-location","BD_InitShpDerJaco"]]]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"\n"}]}
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"Thread 2 hit Breakpoint 2, bd_initshpderjaco (gll_nodes=..., p=...) at /Users/rmudafor/Development/openfast/modules-local/beamdyn/src/BeamDyn.f90:530\n"}]}
Thread 2 hit Breakpoint 2, bd_initshpderjaco (gll_nodes=..., p=...) at /Users/rmudafor/Development/openfast/modules-local/beamdyn/src/BeamDyn.f90:530
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"530\tSUBROUTINE BD_InitShpDerJaco( GLL_Nodes, p )\n"}]}
530 SUBROUTINE BD_InitShpDerJaco( GLL_Nodes, p )
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"exec","asyncClass":"stopped","output":[["reason","breakpoint-hit"],["disp","keep"],["bkptno","2"],["frame",[["addr","0x000000010003f151"],["func","bd_initshpderjaco"],["args",[[["name","gll_nodes"],["value","..."]],[["name","p"],["value","..."]]]],["file","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/BeamDyn.f90"],["fullname","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/BeamDyn.f90"],["line","530"]]],["thread-id","2"],["stopped-threads","all"]]}]}
GDB -> App: {"token":10,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["threads",[[["id","2"],["target-id","Thread 0x1403 of process 91776"],["frame",[["level","0"],["addr","0x000000010003f151"],["func","bd_initshpderjaco"],["args",[[["name","gll_nodes"],["value","..."]],[["name","p"],["value","..."]]]],["file","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/BeamDyn.f90"],["fullname","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/BeamDyn.f90"],["line","530"]]],["state","stopped"]]]],["current-thread-id","2"]]}}
GDB -> App: {"token":11,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["threads",[[["id","2"],["target-id","Thread 0x1403 of process 91776"],["frame",[["level","0"],["addr","0x000000010003f151"],["func","bd_initshpderjaco"],["args",[[["name","gll_nodes"],["value","..."]],[["name","p"],["value","..."]]]],["file","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/BeamDyn.f90"],["fullname","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/BeamDyn.f90"],["line","530"]]],["state","stopped"]]]],["current-thread-id","2"]]}}
12-thread-info
GDB -> App: {"token":12,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["threads",[[["id","2"],["target-id","Thread 0x1403 of process 91776"],["frame",[["level","0"],["addr","0x000000010003f151"],["func","bd_initshpderjaco"],["args",[[["name","gll_nodes"],["value","..."]],[["name","p"],["value","..."]]]],["file","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/BeamDyn.f90"],["fullname","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/BeamDyn.f90"],["line","530"]]],["state","stopped"]]]],["current-thread-id","2"]]}}
13-stack-list-frames --thread 2 0 20
GDB -> App: {"token":13,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["stack",[["frame",[["level","0"],["addr","0x000000010003f151"],["func","bd_initshpderjaco"],["file","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/BeamDyn.f90"],["fullname","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/BeamDyn.f90"],["line","530"]]],["frame",[["level","1"],["addr","0x000000010004654b"],["func","bd_init"],["file","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/BeamDyn.f90"],["fullname","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/BeamDyn.f90"],["line","162"]]],["frame",[["level","2"],["addr","0x0000000100006252"],["func","beamdyn_driver_program"],["file","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/Driver_Beam.f90"],["fullname","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/Driver_Beam.f90"],["line","121"]]],["frame",[["level","3"],["addr","0x0000000100007f6d"],["func","main"],["file","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/Driver_Beam.f90"],["fullname","/Users/rmudafor/Development/openfast/modules-local/beamdyn/src/Driver_Beam.f90"],["line","23"]]]]]]}}
14-stack-list-variables --thread 2 --frame 0 --simple-values
GDB -> App: {"token":14,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["variables",[[["name","gll_nodes"],["arg","1"],["type","real(kind=8) (*)"]],[["name","p"],["arg","1"],["type","Type bd_parametertype"]],[["name","gup0"],["type","real(kind=8) (3)"]],[["name","i"],["type","integer(kind=4)"],["value","1"]],[["name","inode"],["type","integer(kind=4)"],["value","8411136"]],[["name","j"],["type","integer(kind=4)"],["value","-1"]]]]]}}
15-var-update --all-values var_2_gll_nodes
GDB -> App: {"token":15,"outOfBandRecord":[],"resultRecords":{"resultClass":"error","results":[["msg","Variable object not found"]]}}
16-var-create var_2_gll_nodes @ "gll_nodes"
GDB -> App: {"token":16,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["name","var_2_gll_nodes"],["numchild","0"],["value","[0]"],["type","real(kind=8) (*)"],["thread-id","2"],["has_more","0"]]}}
17-var-update --all-values var_2_p
GDB -> App: {"token":17,"outOfBandRecord":[],"resultRecords":{"resultClass":"error","results":[["msg","Variable object not found"]]}}
18-var-create var_2_p @ "p"
GDB -> App: {"token":18,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["name","var_2_p"],["numchild","58"],["value","{...}"],["type","Type bd_parametertype"],["thread-id","2"],["has_more","0"]]}}
19-var-update --all-values var_2_gup0
GDB -> App: {"token":19,"outOfBandRecord":[],"resultRecords":{"resultClass":"error","results":[["msg","Variable object not found"]]}}
20-var-create var_2_gup0 @ "gup0"
GDB -> App: {"token":20,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["name","var_2_gup0"],["numchild","3"],["value","[3]"],["type","real(kind=8) (3)"],["thread-id","2"],["has_more","0"]]}}
21-var-update --all-values var_2_i
GDB -> App: {"token":21,"outOfBandRecord":[],"resultRecords":{"resultClass":"error","results":[["msg","Variable object not found"]]}}
22-var-create var_2_i @ "i"
GDB -> App: {"token":22,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["name","var_2_i"],["numchild","0"],["value","1"],["type","integer(kind=4)"],["thread-id","2"],["has_more","0"]]}}
23-var-update --all-values var_2_inode
GDB -> App: {"token":23,"outOfBandRecord":[],"resultRecords":{"resultClass":"error","results":[["msg","Variable object not found"]]}}
24-var-create var_2_inode @ "inode"
GDB -> App: {"token":24,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["name","var_2_inode"],["numchild","0"],["value","8411136"],["type","integer(kind=4)"],["thread-id","2"],["has_more","0"]]}}
25-var-update --all-values var_2_j
GDB -> App: {"token":25,"outOfBandRecord":[],"resultRecords":{"resultClass":"error","results":[["msg","Variable object not found"]]}}
26-var-create var_2_j @ "j"
GDB -> App: {"token":26,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["name","var_2_j"],["numchild","0"],["value","-1"],["type","integer(kind=4)"],["thread-id","2"],["has_more","0"]]}}
try tweaking the valuesFormatting
setting and try out all 3 different ones if one works better than the others.
"valuesFormatting": "prettyPrinters",
is the winner here
I thought I read somewhere that prettyPrinters weren't implemented in this plugin... maybe that was outdated? In any case, this is perfect. Thanks a lot for your help!
for reference, this is how it looks with prettyPrinters:
nice, in the languages I tried pretty printers were less functional compared to default gdb output though (especially strings/pointers/arrays), so I am keeping that the default.
@rafmudaf May I ask how do you set up debugging for Fortran? I'm unable to set breakpoints for Fortran.
On Mac, the regular gdb does not work well. I got the gdb distributed with Intel tools, gdb-ia
, and it seems to work better. To set breakpoints in fortran files, change the code-debug setting Allow breakpoints everywhere
to True.
On Mac, the regular gdb does not work well. I got the gdb distributed with Intel tools,
gdb-ia
, and it seems to work better. To set breakpoints in fortran files, change the code-debug settingAllow breakpoints everywhere
to True.
Thanks Rafmudaf. I will take a look at gdb-ia. Does it work with intel compiler or intel also provides a gfortran-ia?
BTW, currently I'm using gdb/cygwin with c/cpp ext by Microsoft. It's working pretty well.
gdb-ia
is distributed with intel parallel studio. You can get one month for free and after that the compilers expire. However, gdb-ia is not licensed so I've continued to use it even though I no longer use the other intel tools.
I also use gdb on linux (haven't had to use Cygwin) and it works well. For some reason the Mac support is lacking.
Intel has new open source C++ and Fortran compilers -- on Linux, Mac, and Windows -- their oneAPI Base Toolkit (for C++) and oneAPI HPC Toolkit (adds Fortran).
Their debugger is gdb-oneapi.exe, and I played around with trying to get it to work in Windows with the Native Debug extension for VS Code. No luck.
FWIW, this is the section of launch.json that I tried:
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/hello.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "\\Program Files (x86)\\Intel\\oneAPI\\debugger\\2023.0.0\\gdb\\intel64\\bin\\gdb-oneapi.exe",
"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
}
]
},
You may try to add the logging options and share the output, along with specifying what does not work. For starters is suggest to set stopAtEntry to true.
@warrenstephens, it looks like you're using settings for the Microsoft C/C++ extension, not those for the Native Debug extension. Most of those configuration settings are not interchangeable between the two. Firstly, you need to use "gdb" (instead of "cppdbg") for the type
or it will use the Microsoft extension.
setupCommands
, as that is specific to the Microsoft extension. Native Debug has its own version of this called autorun
(which is an array of commands to run after startup before execution).valuesFormatting
with a setting of "prettyPrinters" to enable pretty printing.target
instead of program
to specify the executablegdbpath
instead of miDebuggerPath
for the debugger pathCheck the package.json for the full list of available options. The README contains some examples but does not contain a complete list of the available options.
@brownts Thanks! I just halfway figured that out myself! Ha ha! With this:
{
"type": "gdb",
"request": "launch",
"name": "Launch Program",
"target": "${workspaceFolder}/hello.exe",
"cwd": "${workspaceRoot}",
"valuesFormatting": "parseText",
"gdbpath": "\\Program Files (x86)\\Intel\\oneAPI\\debugger\\2023.0.0\\gdb\\intel64\\bin\\gdb-oneapi.exe",
"showDevDebugOutput": true,
"printCalls": true
},
Only to see in the debug console: No symbol table is loaded. Use the "file" command.
If I start debugging that same .exe with "type": "cppvsdbg"
(another section of the launch.json) then I do get breakpoints and some variables.
Not sure what to try next.
Hi @warrenstephens, can you attach the log output? It would help to see what is being output by the extension.
@brownts Ok. Here is the log output.
I'm confused as a later post seems to have been deleted. In any case I suggest to move this "using intel gdb" to a new issue.
@brownts Ok. Here is the log output.
Is it possible this wasn't compiled with debugging enabled?
Sorry about the confusion, thought I had found something, posted it, and then figured out that I was myself confused -- using the cppvsdbg configuration by mistake.
The basic issue, as suggested, is that the current Intel Fortran compiler 2023.0.0 probably does not provide gdb debugging info for Windows executables. The Intel gdb-oneapi.exe
debugger is (at this point) only for use with remote debugging Linux and, say, code running on FPGA devices? -- despite that this is the "Add Configuration..." popup:
scrolling further...
Or maybe the Intel C++ compiler can produce gdb debug info, but the Fortran compiler will not?
Dunno.
In debugging a fortran project, I've noticed that any complex data types do not display effectively in the Variables debug window.
It would be much better if in the example image above
p
could have a series of attributesdt
,coef
,rhoinf
, ...Does this have anything to do with the debug extension or is it the responsibility of another component of VSCode?