Open llvmbot opened 4 years ago
Thanks for the input.
Greg, when I tried the fix recommended by 46158, the problem persisted. Though vcvarsall.bat wasn't mentioned in 46158, I tried that as well and it didn't improve my situation. This was all with 10.0 LLDB, and testing on both PowerShell and CMD.
Jaroslav, linking with lld and using DWARF symbols worked, so in the mean-time there's at least a workaround.
Another issue I noticed was that the --debug flag for LLDB didn't offer any more detail into what was happening than running LLDB without --debug (output was the same). Is there a reason for that?
That said, DWARF debug info should work fine on Windows as long as you link with lld.
C:\Projects\temp>type a.cc
int main(int argc, char **argv) { printf("Hello\n"); return 0; }
C:\Projects\temp>clang -gdwarf -O0 -c a.cc -o a.o
C:\Projects\temp>clang -gdwarf -fuse-ld=lld a.o -o a.exe
C:\Projects\temp>lldb a.exe (lldb) target create "a.exe" Current executable set to 'C:\Projects\temp\a.exe' (x86_64). (lldb) b main Breakpoint 1: where = a.exe`main + 21 at a.cc:4:3, address = 0x0000000140001015 (lldb) r Process 24592 launched: 'C:\Projects\temp\a.exe' (x86_64) Process 24592 stopped
I'm working on a but in which an explicit target symbols add my.pdb
command doesn't work, but that's for reasons specific to that code path. If LLDB can find your PDB when the target is created, it should work because that's a completely different code path which doesn't have the checks that fail from when you attempt the explicit interactive command. Sigh.
Someday, we need to consolidate a bunch of code paths through LLDB. It would be really nice if the interactive commands and the corresponding SB entry points merged much sooner.
I should rephrase "not well implemented". I meant to say "it would be nice if this would work out of the box" or "LLDB should give the user feedback on why PDB symbols are not being loaded".
The current situation is not well implemented. I believe on windows you must run the Visual Studio compiler setup batch file to setup some environment variables so that LLDB can find and load the PDB DLL file so it can load symbols using the Microsoft PDB parsing DLL. See:
llvm/llvm-bugzilla-archive#46158
Let us know if any of the information in that bug helps. If it does, please mark this as a duplicate of 46158
When I execute target symbols add my_executable.pdb
, lldb (v16.0.3) shows "error: symbol file 'path\to\my_executable.pdb' does not match any existing module".
$ lldb my_executable.exe
(lldb) target create "my_executable.exe"
Current executable set to '***\cmake-build-debug\bin\my_executable.exe' (x86_64).
target symbols add my_executable.pdb
(lldb) target symbols add my_executable.pdb
error: symbol file '***\cmake-build-debug\bin\my_executable.pdb' does not match any existing module
Use the visual studio developer prompt and there set the following environment variable using
set LLDB_USE_NATIVE_PDB_READER=yes
Extended Description
Trying to explore a full LLVM toolchain for my C/C++ development on Windows, and found that LLDB cannot load debug symbols on Windows 10. LLDB is producing .PDB and .ILK files for the executable I want to debug, but when LLDB loads the executable, no debug symbols are loaded.
Issues I experienced that lead me to realize the symbols weren't being loaded:
Attempted fixes:
There is a duplicate of this bug (#42160) dating little more than year old (posted 2019-06-06) that has reported this issue but didn't receive any attention.
Questions: