Closed FancyBanana closed 6 years ago
@FancyBanana Thank you for your report.
Bonus: it break on entry is set to true, stepping with f10 or f11 won't bring you to corresponding lines in source code.
When you say that its not bringing you to the lines of code, where do you set the breakpoints and what line is it taking you to?
I had 3 breakpoints in these places:
#include <iostream>
using namespace std;
int main(int argc, char** argv){
int a = 0; // Breakpoint here
for(int i = 0; i < 10; i++)
{
a = i*i - a; // Breakpoint here
cout << a << endl; //Breakpoint here
}
}
... and what line is it taking you to?
It doesn't take me to any line at all, or any file for that matter. It's like it ignores source files completely.
@FancyBanana Ok thanks. I'll take a look, but it looks like clang
isn't putting the symbols in the right format as far as I can tell.
windows
I don't think clang is putting the pdb information in the format that the VS Debugger recognizes. Because of this, the debugger can't load it. I don't think this is a supported scenario with the VS Debugger, but @gregg-miskelly might be able to better confirm this.
<- (E) {"seq":27,"type":"event","event":"breakpoint","body":{"reason":"changed","breakpoint":{"id":1,"verified":false,"message":"No symbols have been loaded for this document.","line":8}}}
<- (E) {"seq":29,"type":"event","event":"breakpoint","body":{"reason":"changed","breakpoint":{"id":2,"verified":false,"message":"No symbols have been loaded for this document.","line":12}}}
<- (E) {"seq":31,"type":"event","event":"breakpoint","body":{"reason":"changed","breakpoint":{"id":3,"verified":false,"message":"No symbols have been loaded for this document.","line":13}}}
gdb
its showing no symbols loaded.
1: (890) <-1008-break-insert main
1: (898) ->1008^error,msg="No symbol table is loaded. Use the \"file\" command."
Could you propose a solution for that? I know that's outside of scope of your support but at this point i'm a bit frustrated because I've been fiddling couple days before addressing you.
@FancyBanana I'm trying to figure out what format clang compiles into. I'm thinking the right thing to do would be to use gdb/lldb but I am also running into what you are hitting.
Unfortunately, the lldb-mi
that ships with this package seems to be broken. I downloaded LLVM 6.0.0 from the LLVM site.
@FancyBanana We are still investigating but I wanted to give you an update. After reading the clang
documentation, I think you want to specify -g
for debug symbols. I don't know what --debug
does as it doesn't seem to be listed in the help file. Adding -v
to the compile command shows it is using the MSVC linker so it should work with the VS Debugger.
@FancyBanana It looks like the object file that is generated by clang
doesn't include the .cpp
source file information.
You can check this by running cvdump.exe against the .pdb
file with the /sf
flag. Searching inside the output, we don't see the .cpp
showing up in the object file (in this case, clang
generates it as a .o
) so we don't know where the source is located. If you compile the same app with VS Enterprise, you will see the .cpp
show up.
I've found the solution: specifying -gcodeview
flag worked, now i can use Windows debugger.
Also -g
is shorthand for --debug
oh awesome! thanks for the information.
After you mentioned it, I found this document.
Type: Debugger
Describe the bug
OS and Version: Windows 10 Education 1803
VS Code Version: 1.24.1
C/C++ Extension Version: 0.17.5
Other extensions you installed (and if the issue persists after disabling them): It fails pretty well on it's own :)
A clear and concise description of what the bug is.
I can't debug a binary compiled using clang 6.0.0 x32 with debug symbols. I tried using Windows debugger (i have VS Enterprise 15.7.4 installed). It can stop on entry, but ignores breakpoints and does not follow source code steps. Also GDB (mingw64 8.1.0 from here). Doesn't even stop on entry. LLDB also doesn't work, but i think it's mostly fault of LLVM, since in 6.0.0 lldb is build wihtout python scripting by default. (there is a corrected build, but it still does not help me).
Please include a code sample and
launch.json
configuration.main.cpp
build command
:clang --debug -Og -o main.exe -std=c++17 main.cpp
launch.json
Steps to reproduce the behavior:
main.cpp
intomain.exe
with--debug
flagtrue
, stepping withf10
orf11
won't bring you to corresponding lines in source code.logs for windows debugger
logs for gdb launch
also logging for lldb just in case
:I was really looking forward to homogenizing my cpp programming on linux and windows, and this is one little thing that spoils it...
Update: Forgot to write steps for recreating problem