microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.53k stars 1.56k forks source link

Editor cannot find source files when debugging under windows #9609

Closed ChrisIdema closed 2 years ago

ChrisIdema commented 2 years ago

Environment

Bug Summary and Steps to Reproduce

Bug Summary:

I'm experimenting with cmake in combination with vscode. I now have a project that builds and runs, but when debugging I can only see the source files under linux. The project has an external build folder and I think this is where the problem lies. It does work when I build with mingw32, but not when I build it with msys2, but I don't see how the compiler should affect the ability of the editor to find a source file.

Here is my simple project: https://github.com/ChrisIdema/cmake_vscode_experiments/tree/5b2a93b8b00aa145a2f04e42d8b95faca396a479/subfolders .

Steps to reproduce:

  1. download the project "subfolders" from here: https://github.com/ChrisIdema/cmake_vscode_experiments/tree/5b2a93b8b00aa145a2f04e42d8b95faca396a479/subfolders
  2. cmake configure, select MSYS2 as kit
  3. cmake build
  4. set breakpoints in all functions
  5. hit F5 (or run cmake debug)
  6. see the following error in the editor: the editor could not be opened because the file could not be found

Debugger Configurations

See project

Debugger Logs

1: (83) LaunchOptions{"name":"C/C++: gcc.exe build and debug active file","type":"cppdbg","request":"launch","args":[],"stopAtEntry":false,"cwd":"C:\\git\\cmake_vscode_experiments\\subfolders","environment":[],"externalConsole":false,"MIMode":"gdb","logging":{"engineLogging":true},"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}],"preLaunchTask":"cmake","__configurationTarget":5,"configSource":"workspaceFolder","debugType":"debug","miDebuggerPath":"C:\\msys64\\usr\\bin\\gdb.exe","program":"C:\\git\\cmake_vscode_experiments\\subfolders/../build/build-subfolders/subfolders.exe","__sessionId":"e100f60e-7673-49fc-92a6-c1cc6eafbbb4"}
1: (150) Wait for connection completion.
1: (587) ->=thread-group-added,id="i1"
1: (588) ->~"GNU gdb (GDB) 10.2\n"
1: (588) ->~"Copyright (C) 2021 Free Software Foundation, Inc.\n"
1: (588) ->~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law."
1: (588) ->~"\nType \"show copying\" and \"show warranty\" for details.\n"
1: (588) ->~"This GDB was configured as \"x86_64-pc-msys\".\n"
1: (589) ->~"Type \"show configuration\" for configuration details.\n"
1: (589) ->~"For bug reporting instructions, please see:\n"
1: (589) ->~"<https://www.gnu.org/software/gdb/bugs/>.\n"
1: (589) ->~"Find the GDB manual and other documentation resources online at:\n    <http://www.gnu.org/software/gdb/documentation/>."
1: (589) ->~"\n\n"
1: (589) ->~"For help, type \"help\".\n"
1: (589) ->~"Type \"apropos word\" to search for commands related to \"word\".\n"
1: (598) ->(gdb)
1: (601) <-1001-gdb-set mi-async on
1: (608) ->1001^done
1: (609) ->(gdb)
1: (609) ->&"\n"
1: (609) ->^done
1: (609) ->(gdb)
1: (611) 1001: elapsed time 10
1: (613) <-1002-interpreter-exec console "show configuration"
1: (623) ->~"This GDB was configured as follows:\n   configure --host="
1: (624) ->~"x86_64-pc-msys --target=x86_64-pc-msys\n"
1: (624) ->~"             --with-auto-load-dir=$debugdir:$datadir/auto-load\n             --with-auto-load-safe-path="
1: (624) ->~"$debugdir:$datadir/auto-load\n"
1: (624) ->~"             --with-expat\n"
1: (624) ->~"             --with-gdb-datadir=/usr/share/gdb (relocatable)\n"
1: (624) ->~"             --with-jit-reader-dir=/usr/lib/gdb (relocatable)\n"
1: (624) ->~"             --without-libunwind-ia64\n"
1: (624) ->~"             --with-lzma\n"
1: (624) ->~"             --without-babeltrace\n"
1: (624) ->~"             --without-intel-pt\n"
1: (625) ->~"             --with-mpfr\n"
1: (625) ->~"             --without-xxhash\n"
1: (625) ->~"             --with-python=/usr (relocatable)\n"
1: (625) ->~"             --with-python-libdir=/usr/lib (relocatable)\n"
1: (625) ->~"             --without-debuginfod\n"
1: (625) ->~"             --without-guile\n"
1: (625) ->~"             --disable-source-highlight\n"
1: (625) ->~"             --with-separate-debug-dir=/usr/lib/debug (relocatable)\n"
1: (625) ->~"             --with-system-gdbinit=/etc/gdbinit\n"
1: (625) ->~"\n(\"Relocatable\" means the directory can be moved with the GDB installation\ntree, and GDB will still find it.)\n"
1: (625) ->1002^done
1: (625) 1002: elapsed time 12
1: (625) ->(gdb)
1: (626) ->&"\n"
1: (626) ->^done
1: (626) ->(gdb)
1: (734) <-1003-enable-pretty-printing
1: (747) ->1003^done
1: (747) 1003: elapsed time 13
1: (747) ->(gdb)
1: (747) <-1004-gdb-set disassembly-flavor intel
1: (747) ->&"\n"
1: (747) ->^done
1: (748) ->(gdb)
1: (763) ->1004^done
1: (763) 1004: elapsed time 15
1: (763) ->(gdb)
1: (763) <-1005-interpreter-exec console "set pagination off"
1: (763) ->&"\n"
1: (764) ->^done
1: (764) ->(gdb)
1: (779) ->=cmd-param-changed,param="pagination",value="off"
1: (779) ->1005^done
1: (779) 1005: elapsed time 15
1: (779) ->(gdb)
1: (779) <-1006-gdb-set auto-solib-add on
1: (779) ->&"\n"
1: (779) ->^done
1: (779) ->(gdb)
1: (794) ->1006^done
1: (794) 1006: elapsed time 15
1: (794) ->(gdb)
1: (794) <-1007-gdb-set solib-search-path /c/git/cmake_vscode_experiments/build/build-subfolders:
1: (795) ->&"\n"
1: (795) ->^done
1: (795) ->(gdb)
1: (809) ->1007^done
1: (809) 1007: elapsed time 14
1: (809) <-1008-environment-cd /c/git/cmake_vscode_experiments/subfolders
1: (809) ->(gdb)
1: (810) ->&"\n"
1: (810) ->^done
1: (810) ->(gdb)
1: (825) ->1008^done
1: (825) 1008: elapsed time 15
1: (825) ->(gdb)
1: (825) <-1009-file-exec-and-symbols /c/git/cmake_vscode_experiments/build/build-subfolders/subfolders.exe
1: (825) ->&"\n"
1: (825) ->^done
1: (826) ->(gdb)
1: (849) ->1009^done
1: (850) 1009: elapsed time 24
1: (850) ->(gdb)
1: (850) <-1010-interpreter-exec console "show architecture"
1: (850) ->&"\n"
1: (850) ->^done
1: (850) ->(gdb)
1: (856) ->~"The target architecture is set to \"auto\" (currently \"i386:x86-64\").\n"
1: (856) ->1010^done
1: (857) 1010: elapsed time 6
1: (857) ->(gdb)
1: (857) ->&"\n"
1: (857) ->^done
1: (857) ->(gdb)
1: (858) <-1011-exec-arguments 2>CON 1>CON <CON
1: (872) ->1011^done
1: (873) 1011: elapsed time 14
1: (873) ->(gdb)
1: (873) <-1012-break-insert -f main
1: (873) ->&"\n"
1: (873) ->^done
1: (873) ->(gdb)
1: (890) ->1012^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x000000010040108d",func="main()",file="C:/git/cmake_vscode_experiments/subfolders/main/main.cpp",fullname="/c/git/cmake_vscode_experiments/build/build-subfolders/C:/git/cmake_vscode_experiments/subfolders/main/main.cpp",line="21",thread-groups=["i1"],times="0",original-location="main"}
1: (890) ->(gdb)
1: (890) ->&"\n"
1: (890) ->^done
1: (890) ->(gdb)
1: (896) 1012: elapsed time 23
1: (901) Send Event AD7EngineCreateEvent
1: (902) Send Event AD7ProgramCreateEvent
1: (923) ShellPid=18692
1: (927) DebuggerPid=23148
1: (947) <-1013-break-insert -f driver_c.c:6
1: (952) ->1013^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x00000001004010e8",func="driver",file="C:/git/cmake_vscode_experiments/subfolders/drivers/driver_c.c",fullname="/c/git/cmake_vscode_experiments/build/build-subfolders/drivers/C:/git/cmake_vscode_experiments/subfolders/drivers/driver_c.c",line="6",thread-groups=["i1"],times="0",original-location="driver_c.c:6"}
1: (952) 1013: elapsed time 5
1: (952) ->(gdb)
1: (952) ->&"\n"
1: (952) ->^done
1: (952) ->(gdb)
1: (1013) <-1014-symbol-list-lines /c/c/git/cmake_vscode_experiments/build/build-subfolders/drivers/C:/git/cmake_vscode_experiments/subfolders/drivers/driver_c.c
1: (1030) ->1014^error,msg="-symbol-list-lines: Unknown source file name."
1: (1030) 1014: elapsed time 16
1: (1030) ->(gdb)
1: (1030) ->&"\n"
1: (1030) ->^done
1: (1030) ->(gdb)
1: (1061) <-1015-symbol-list-lines driver_c.c
1: (1076) ->1015^done,lines=[{pc="0x00000001004010e0",line="5"},{pc="0x00000001004010e8",line="6"},{pc="0x00000001004010ed",line="8"},{pc="0x00000001004010f4",line="0"}]
1: (1076) ->(gdb)
1: (1076) ->&"\n"
1: (1076) ->^done
1: (1076) ->(gdb)
1: (1076) 1015: elapsed time 15
1: (1082) Send Event AD7BreakpointBoundEvent
1: (1101) <-1016-break-insert -f main.cpp:21
1: (1108) ->1016^done,bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="0x000000010040108d",func="main()",file="C:/git/cmake_vscode_experiments/subfolders/main/main.cpp",fullname="/c/git/cmake_vscode_experiments/build/build-subfolders/C:/git/cmake_vscode_experiments/subfolders/main/main.cpp",line="21",thread-groups=["i1"],times="0",original-location="main.cpp:21"}
1: (1108) 1016: elapsed time 6
1: (1108) ->(gdb)
1: (1108) ->&"\n"
1: (1108) ->^done
1: (1108) ->(gdb)
1: (1173) <-1017-symbol-list-lines /c/c/git/cmake_vscode_experiments/build/build-subfolders/C:/git/cmake_vscode_experiments/subfolders/main/main.cpp
1: (1190) ->1017^error,msg="-symbol-list-lines: Unknown source file name."
1: (1190) 1017: elapsed time 16
1: (1190) ->(gdb)
1: (1190) ->&"\n"
1: (1190) ->^done
1: (1190) ->(gdb)
1: (1205) <-1018-symbol-list-lines main.cpp
1: (1219) ->1018^done,lines=[{pc="0x0000000100401080",line="20"},{pc="0x0000000100401088",line="20"},{pc="0x000000010040108d",line="21"},{pc="0x0000000100401099",line="22"},{pc="0x00000001004010a5",line="23"},{pc="0x00000001004010b6",line="24"},{pc="0x00000001004010c2",line="27"},{pc="0x00000001004010c7",line="28"},{pc="0x00000001004010cc",line="29"},{pc="0x00000001004010d2",line="0"}]
1: (1219) ->(gdb)
1: (1219) 1018: elapsed time 14
1: (1219) ->&"\n"
1: (1219) Send Event AD7BreakpointBoundEvent
1: (1219) ->^done
1: (1219) ->(gdb)
1: (1219) <-1019-break-insert -f main.cpp:27
1: (1234) ->1019^done,bkpt={number="4",type="breakpoint",disp="keep",enabled="y",addr="0x00000001004010c2",func="main()",file="C:/git/cmake_vscode_experiments/subfolders/main/main.cpp",fullname="/c/git/cmake_vscode_experiments/build/build-subfolders/C:/git/cmake_vscode_experiments/subfolders/main/main.cpp",line="27",thread-groups=["i1"],times="0",original-location="main.cpp:27"}
1: (1234) 1019: elapsed time 14
1: (1234) ->(gdb)
1: (1234) ->&"\n"
1: (1234) ->^done
1: (1235) ->(gdb)
1: (1235) Send Event AD7BreakpointBoundEvent
1: (1235) <-1020-break-insert -f util.cpp:5
1: (1252) ->1020^done,bkpt={number="5",type="breakpoint",disp="keep",enabled="y",addr="0x0000000100401104",func="util()",file="C:/git/cmake_vscode_experiments/subfolders/drivers/util/util.cpp",fullname="/c/git/cmake_vscode_experiments/build/build-subfolders/drivers/C:/git/cmake_vscode_experiments/subfolders/drivers/util/util.cpp",line="6",thread-groups=["i1"],times="0",original-location="util.cpp:5"}
1: (1252) 1020: elapsed time 16
1: (1252) ->(gdb)
1: (1252) ->&"\n"
1: (1252) ->^done
1: (1252) ->(gdb)
1: (1297) <-1021-symbol-list-lines /c/c/git/cmake_vscode_experiments/build/build-subfolders/drivers/C:/git/cmake_vscode_experiments/subfolders/drivers/util/util.cpp
1: (1313) ->1021^error,msg="-symbol-list-lines: Unknown source file name."
1: (1313) 1021: elapsed time 16
1: (1313) ->(gdb)
1: (1313) ->&"\n"
1: (1313) ->^done
1: (1313) ->(gdb)
1: (1349) <-1022-symbol-list-lines util.cpp
1: (1364) ->1022^done,lines=[{pc="0x0000000100401100",line="4"},{pc="0x0000000100401104",line="6"},{pc="0x0000000100401107",line="0"}]
1: (1364) ->(gdb)
1: (1364) ->&"\n"
1: (1365) ->^done
1: (1365) ->(gdb)
1: (1365) 1022: elapsed time 16
1: (1366) Send Event AD7BreakpointBoundEvent
1: (1509) Send Event AD7LoadCompleteEvent
=thread-group-added,id="i1"
GNU gdb (GDB) 10.2
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-msys".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param="pagination",value="off"
1: (1521) <-1023-exec-run
1: (1539) ->=thread-group-started,id="i1",pid="14316"
1: (1539) ->=thread-created,id="1",group-id="i1"
1: (1541) ->=thread-created,id="2",group-id="i1"
1: (1541) ->~"[New Thread 14316.0x222c]\n"
1: (1542) <-1024-thread-info 1
1: (1544) <-1025-thread-info 2
[New Thread 14316.0x222c]
1: (1545) ->=library-loaded,id="/c/Windows/SYSTEM32/ntdll.dll",target-name="/c/Windows/SYSTEM32/ntdll.dll",host-name="/c/Windows/SYSTEM32/ntdll.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffc0f1d1000",to="0x00007ffc0f3c654c"}]
1: (1545) ->=library-loaded,id="/c/Windows/System32/KERNEL32.DLL",target-name="/c/Windows/System32/KERNEL32.DLL",host-name="/c/Windows/System32/KERNEL32.DLL",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffc0dde1000",to="0x00007ffc0de9c300"}]
1: (1547) ->=library-loaded,id="/c/Windows/System32/KERNELBASE.dll",target-name="/c/Windows/System32/KERNELBASE.dll",host-name="/c/Windows/System32/KERNELBASE.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffc0c8f1000",to="0x00007ffc0cbbcb48"}]
1: (1547) ->=library-loaded,id="/usr/bin/msys-2.0.dll",target-name="/usr/bin/msys-2.0.dll",host-name="/usr/bin/msys-2.0.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x0000000180041000",to="0x0000000180660000"}]
1: (2853) ->1023^running
1: (2853) 1023: elapsed time 1332
1: (2853) ->*running,thread-id="all"
1: (2853) ->(gdb)
1: (2854) ->=library-loaded,id="/c/Windows/System32/advapi32.dll",target-name="/c/Windows/System32/advapi32.dll",host-name="/c/Windows/System32/advapi32.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffc0d351000",to="0x00007ffc0d3fd8f4"}]
1: (2981) ->=library-loaded,id="/c/Windows/System32/msvcrt.dll",target-name="/c/Windows/System32/msvcrt.dll",host-name="/c/Windows/System32/msvcrt.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffc0d8e1000",to="0x00007ffc0d97d4a8"}]
1: (3120) ->=library-loaded,id="/c/Windows/System32/sechost.dll",target-name="/c/Windows/System32/sechost.dll",host-name="/c/Windows/System32/sechost.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffc0d401000",to="0x00007ffc0d49b464"}]
1: (3191) ->=library-loaded,id="/c/Windows/System32/RPCRT4.dll",target-name="/c/Windows/System32/RPCRT4.dll",host-name="/c/Windows/System32/RPCRT4.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffc0df31000",to="0x00007ffc0e0547bc"}]
1: (3290) ->=thread-created,id="3",group-id="i1"
1: (3290) ->~"[New Thread 14316.0x4afc]\n"
1: (3290) <-1026-thread-info 3
[New Thread 14316.0x4afc]
1: (3292) ->=library-loaded,id="/c/Windows/SYSTEM32/CRYPTBASE.DLL",target-name="/c/Windows/SYSTEM32/CRYPTBASE.DLL",host-name="/c/Windows/SYSTEM32/CRYPTBASE.DLL",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffc0c1d1000",to="0x00007ffc0c1db038"}]
1: (3343) ->=library-loaded,id="/c/Windows/System32/bcryptPrimitives.dll",target-name="/c/Windows/System32/bcryptPrimitives.dll",host-name="/c/Windows/System32/bcryptPrimitives.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffc0d151000",to="0x00007ffc0d1d1498"}]
1: (3393) ->=thread-created,id="4",group-id="i1"
1: (3393) ->~"[New Thread 14316.0x224]\n"
1: (3394) <-1027-thread-info 4
[New Thread 14316.0x224]
1: (3396) ->=library-loaded,id="/c/Windows/system32/netapi32.dll",target-name="/c/Windows/system32/netapi32.dll",host-name="/c/Windows/system32/netapi32.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffbf3e21000",to="0x00007ffbf3e3905c"}]
1: (3454) ->=library-loaded,id="/c/Windows/SYSTEM32/SAMCLI.DLL",target-name="/c/Windows/SYSTEM32/SAMCLI.DLL",host-name="/c/Windows/SYSTEM32/SAMCLI.DLL",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffbfaad1000",to="0x00007ffbfaae80ac"}]
1: (3508) ->=library-loaded,id="/c/Windows/System32/ucrtbase.dll",target-name="/c/Windows/System32/ucrtbase.dll",host-name="/c/Windows/System32/ucrtbase.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffc0ce31000",to="0x00007ffc0cf2faf8"}]
1: (3721) ->=library-loaded,id="/c/Windows/SYSTEM32/SAMLIB.dll",target-name="/c/Windows/SYSTEM32/SAMLIB.dll",host-name="/c/Windows/SYSTEM32/SAMLIB.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffc085e1000",to="0x00007ffc08606680"}]
1: (3782) ->=library-loaded,id="/c/Windows/SYSTEM32/NETUTILS.DLL",target-name="/c/Windows/SYSTEM32/NETUTILS.DLL",host-name="/c/Windows/SYSTEM32/NETUTILS.DLL",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffc0bde1000",to="0x00007ffc0bdeb02c"}]
1: (3839) ->=library-loaded,id="/c/Windows/System32/ws2_32.dll",target-name="/c/Windows/System32/ws2_32.dll",host-name="/c/Windows/System32/ws2_32.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffc0e061000",to="0x00007ffc0e0ca150"}]
1: (3910) ->=library-loaded,id="/c/Windows/system32/mswsock.dll",target-name="/c/Windows/system32/mswsock.dll",host-name="/c/Windows/system32/mswsock.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffc0bfe1000",to="0x00007ffc0c049100"}]
1: (3963) ->=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x000000010040108d",func="main()",file="C:/git/cmake_vscode_experiments/subfolders/main/main.cpp",fullname="/c/git/cmake_vscode_experiments/build/build-subfolders/C:/git/cmake_vscode_experiments/subfolders/main/main.cpp",line="21",thread-groups=["i1"],times="1",original-location="main"}
1: (3963) ->=breakpoint-modified,bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="0x000000010040108d",func="main()",file="C:/git/cmake_vscode_experiments/subfolders/main/main.cpp",fullname="/c/git/cmake_vscode_experiments/build/build-subfolders/C:/git/cmake_vscode_experiments/subfolders/main/main.cpp",line="21",thread-groups=["i1"],times="1",original-location="main.cpp:21"}
1: (3971) ->~"\n"
1: (3971) ->~"Thread 1 \"subfolders\" hit Breakpoint 1, main () at C:/git/cmake_vscode_experiments/subfolders/main/main.cpp:21\n"
1: (3973) ->&"21\tC:/git/cmake_vscode_experiments/subfolders/main/main.cpp: No such file or directory.\n"
1: (3973) ->*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x000000010040108d",func="main",args=[],file="C:/git/cmake_vscode_experiments/subfolders/main/main.cpp",fullname="/c/git/cmake_vscode_experiments/build/build-subfolders/C:/git/cmake_vscode_experiments/subfolders/main/main.cpp",line="21",arch="i386:x86-64"},thread-id="1",stopped-threads="all"
1: (3973) ->(gdb)
1: (3973) ->&"\n"
1: (3973) ->^done
1: (3973) ->(gdb)
1: (3975) ->1024^done,threads=[{id="1",target-id="Thread 14316.0x5044",name="subfolders",frame={level="0",addr="0x000000010040108d",func="main",args=[],file="C:/git/cmake_vscode_experiments/subfolders/main/main.cpp",fullname="/c/git/cmake_vscode_experiments/build/build-subfolders/C:/git/cmake_vscode_experiments/subfolders/main/main.cpp",line="21",arch="i386:x86-64"},state="stopped"}]
1: (3975) ->(gdb)
1: (3975) ->&"\n"
1: (3975) ->^done
1: (3975) ->(gdb)
1: (3976) ->1025^done,threads=[{id="2",target-id="Thread 14316.0x222c",frame={level="0",addr="0x00007ffc0f270794",func="ntdll!ZwWaitForWorkViaWorkerFactory",args=[],from="/c/Windows/SYSTEM32/ntdll.dll",arch="i386:x86-64"},state="stopped"}]
1: (3976) ->(gdb)
1: (3976) ->&"\n"
1: (3976) ->^done
1: (3976) ->(gdb)
1: (3977) ->1026^done,threads=[{id="3",target-id="Thread 14316.0x4afc",frame={level="0",addr="0x00007ffc0f270794",func="ntdll!ZwWaitForWorkViaWorkerFactory",args=[],from="/c/Windows/SYSTEM32/ntdll.dll",arch="i386:x86-64"},state="stopped"}]
1: (3977) ->(gdb)
1: (3977) ->&"\n"
1: (3977) ->^done
1: (3977) ->(gdb)
1: (3977) ->1027^done,threads=[{id="4",target-id="Thread 14316.0x224",name="sig",frame={level="0",addr="0x00007ffc0f26ce04",func="ntdll!ZwReadFile",args=[],from="/c/Windows/SYSTEM32/ntdll.dll",arch="i386:x86-64"},state="stopped"}]
1: (3977) ->(gdb)
1: (3977) ->&"\n"
1: (3977) ->^done
1: (3977) ->(gdb)
1: (3999) <-1028-symbol-list-lines /c/c/git/cmake_vscode_experiments/build/build-subfolders/C:/git/cmake_vscode_experiments/subfolders/main/main.cpp

Thread 1 "subfolders" hit Breakpoint 1, main () at C:/git/cmake_vscode_experiments/subfolders/main/main.cpp:21
1: (4020) <-1029-thread-info
1: (4021) 1024: elapsed time 2479
1: (4022) ->1028^error,msg="-symbol-list-lines: Unknown source file name."
1: (4022) ->(gdb)
1: (4022) ->&"\n"
1: (4022) ->^done
1: (4022) ->(gdb)
1: (4023) ->1029^done,threads=[{id="1",target-id="Thread 14316.0x5044",name="subfolders",frame={level="0",addr="0x000000010040108d",func="main",args=[],file="C:/git/cmake_vscode_experiments/subfolders/main/main.cpp",fullname="/c/git/cmake_vscode_experiments/build/build-subfolders/C:/git/cmake_vscode_experiments/subfolders/main/main.cpp",line="21",arch="i386:x86-64"},state="stopped"},{id="2",target-id="Thread 14316.0x222c",frame={level="0",addr="0x00007ffc0f270794",func="ntdll!ZwWaitForWorkViaWorkerFactory",args=[],from="/c/Windows/SYSTEM32/ntdll.dll",arch="i386:x86-64"},state="stopped"},{id="3",target-id="Thread 14316.0x4afc",frame={level="0",addr="0x00007ffc0f270794",func="ntdll!ZwWaitForWorkViaWorkerFactory",args=[],from="/c/Windows/SYSTEM32/ntdll.dll",arch="i386:x86-64"},state="stopped"},{id="4",target-id="Thread 14316.0x224",name="sig",frame={level="0",addr="0x00007ffc0f26ce04",func="ntdll!ZwReadFile",args=[],from="/c/Windows/SYSTEM32/ntdll.dll",arch="i386:x86-64"},state="stopped"}],current-thread-id="1"
1: (4023) ->(gdb)
1: (4023) ->&"\n"
1: (4023) ->^done
1: (4023) ->(gdb)
1: (4025) Send Event AD7ProcessInfoUpdatedEvent
1: (4031) Send Event AD7ThreadCreateEvent
1: (4035) 1025: elapsed time 2491
1: (4035) Send Event AD7ThreadCreateEvent
1: (4036) 1026: elapsed time 745
1: (4036) Send Event AD7ThreadCreateEvent
1: (4036) 1027: elapsed time 642
1: (4036) Send Event AD7ThreadCreateEvent
1: (4036) 1028: elapsed time 36
1: (4068) <-1030-symbol-list-lines main.cpp
1: (4068) 1029: elapsed time 48
1: (4082) ->1030^done,lines=[{pc="0x0000000100401080",line="20"},{pc="0x0000000100401088",line="20"},{pc="0x000000010040108d",line="21"},{pc="0x0000000100401099",line="22"},{pc="0x00000001004010a5",line="23"},{pc="0x00000001004010b6",line="24"},{pc="0x00000001004010c2",line="27"},{pc="0x00000001004010c7",line="28"},{pc="0x00000001004010cc",line="29"},{pc="0x00000001004010d2",line="0"}]
1: (4082) ->(gdb)
1: (4082) 1030: elapsed time 14
1: (4083) ->&"\n"
1: (4083) ->^done
1: (4083) ->(gdb)
1: (4083) <-1031-interpreter-exec console "info sharedlibrary"
1: (4099) ->~"From                To                  Syms Read   Shared Object Library\n"
1: (4099) ->~"0x00007ffc0f1d1000  0x00007ffc0f3c654c  Yes         /c/Windows/SYSTEM32/ntdll.dll\n"
1: (4099) ->~"0x00007ffc0dde1000  0x00007ffc0de9c300  Yes         /c/Windows/System32/KERNEL32.DLL\n"
1: (4099) ->~"0x00007ffc0c8f1000  0x00007ffc0cbbcb48  Yes         /c/Windows/System32/KERNELBASE.dll\n"
1: (4099) ->~"0x0000000180041000  0x0000000180660000  Yes         /usr/bin/msys-2.0.dll\n"
1: (4099) ->~"0x00007ffc0d351000  0x00007ffc0d3fd8f4  Yes         /c/Windows/System32/advapi32.dll\n"
1: (4099) ->~"0x00007ffc0d8e1000  0x00007ffc0d97d4a8  Yes         /c/Windows/System32/msvcrt.dll\n"
1: (4099) ->~"0x00007ffc0d401000  0x00007ffc0d49b464  Yes         /c/Windows/System32/sechost.dll\n"
1: (4099) ->~"0x00007ffc0df31000  0x00007ffc0e0547bc  Yes         /c/Windows/System32/RPCRT4.dll\n"
1: (4099) ->~"0x00007ffc0c1d1000  0x00007ffc0c1db038  Yes         /c/Windows/SYSTEM32/CRYPTBASE.DLL\n"
1: (4099) ->~"0x00007ffc0d151000  0x00007ffc0d1d1498  Yes         /c/Windows/System32/bcryptPrimitives.dll\n"
1: (4099) ->~"0x00007ffbf3e21000  0x00007ffbf3e3905c  Yes         /c/Windows/system32/netapi32.dll\n"
1: (4099) ->~"0x00007ffbfaad1000  0x00007ffbfaae80ac  Yes         /c/Windows/SYSTEM32/SAMCLI.DLL\n"
1: (4099) ->~"0x00007ffc0ce31000  0x00007ffc0cf2faf8  Yes         /c/Windows/System32/ucrtbase.dll\n"
1: (4099) ->~"0x00007ffc085e1000  0x00007ffc08606680  Yes         /c/Windows/SYSTEM32/SAMLIB.dll\n"
1: (4099) ->~"0x00007ffc0bde1000  0x00007ffc0bdeb02c  Yes         /c/Windows/SYSTEM32/NETUTILS.DLL\n"
1: (4099) ->~"0x00007ffc0e061000  0x00007ffc0e0ca150  Yes         /c/Windows/System32/ws2_32.dll\n"
1: (4100) ->~"0x00007ffc0bfe1000  0x00007ffc0c049100  Yes         /c/Windows/system32/mswsock.dll\n"
1: (4100) ->1031^done
1: (4100) 1031: elapsed time 16
1: (4100) ->(gdb)
1: (4100) ->&"\n"
1: (4100) ->^done
1: (4100) ->(gdb)
1: (4102) Send Event AD7ModuleLoadEvent
Loaded '/c/Windows/SYSTEM32/ntdll.dll'. Symbols loaded.
1: (4116) Send Event AD7ModuleLoadEvent
Loaded '/c/Windows/System32/KERNEL32.DLL'. Symbols loaded.
1: (4117) Send Event AD7ModuleLoadEvent
Loaded '/c/Windows/System32/KERNELBASE.dll'. Symbols loaded.
1: (4117) Send Event AD7ModuleLoadEvent
Loaded '/usr/bin/msys-2.0.dll'. Symbols loaded.
1: (4117) Send Event AD7ModuleLoadEvent
Loaded '/c/Windows/System32/advapi32.dll'. Symbols loaded.
1: (4117) Send Event AD7ModuleLoadEvent
Loaded '/c/Windows/System32/msvcrt.dll'. Symbols loaded.
1: (4117) Send Event AD7ModuleLoadEvent
Loaded '/c/Windows/System32/sechost.dll'. Symbols loaded.
1: (4117) Send Event AD7ModuleLoadEvent
Loaded '/c/Windows/System32/RPCRT4.dll'. Symbols loaded.
1: (4117) Send Event AD7ModuleLoadEvent
Loaded '/c/Windows/SYSTEM32/CRYPTBASE.DLL'. Symbols loaded.
1: (4117) Send Event AD7ModuleLoadEvent
Loaded '/c/Windows/System32/bcryptPrimitives.dll'. Symbols loaded.
1: (4117) Send Event AD7ModuleLoadEvent
Loaded '/c/Windows/system32/netapi32.dll'. Symbols loaded.
1: (4118) Send Event AD7ModuleLoadEvent
Loaded '/c/Windows/SYSTEM32/SAMCLI.DLL'. Symbols loaded.
1: (4118) Send Event AD7ModuleLoadEvent
Loaded '/c/Windows/System32/ucrtbase.dll'. Symbols loaded.
1: (4118) Send Event AD7ModuleLoadEvent
Loaded '/c/Windows/SYSTEM32/SAMLIB.dll'. Symbols loaded.
1: (4118) Send Event AD7ModuleLoadEvent
Loaded '/c/Windows/SYSTEM32/NETUTILS.DLL'. Symbols loaded.
1: (4118) Send Event AD7ModuleLoadEvent
Loaded '/c/Windows/System32/ws2_32.dll'. Symbols loaded.
1: (4118) Send Event AD7ModuleLoadEvent
Loaded '/c/Windows/system32/mswsock.dll'. Symbols loaded.
1: (4122) <-1032-stack-list-frames 0 1000
1: (4141) ->1032^done,stack=[frame={level="0",addr="0x000000010040108d",func="main",file="C:/git/cmake_vscode_experiments/subfolders/main/main.cpp",fullname="/c/git/cmake_vscode_experiments/build/build-subfolders/C:/git/cmake_vscode_experiments/subfolders/main/main.cpp",line="21",arch="i386:x86-64"}]
1: (4141) ->(gdb)
1: (4141) ->&"\n"
1: (4141) ->^done
1: (4141) 1032: elapsed time 19
1: (4141) ->(gdb)
1: (4153) <-1033-break-delete 1
1: (4156) ->1033^done
1: (4157) 1033: elapsed time 3
1: (4157) ->(gdb)
1: (4157) ->&"\n"
1: (4157) ->^done
1: (4157) ->(gdb)
1: (4158) Send Event AD7BreakpointEvent
Execute debugger commands using "-exec <command>", for example "-exec info registers" will list registers in use (when GDB is the debugger)
1: (4218) <-1034-stack-list-arguments 0 0 0
1: (4220) ->1034^done,stack-args=[frame={level="0",args=[]}]
1: (4220) 1034: elapsed time 2
1: (4220) ->(gdb)
1: (4220) ->&"\n"
1: (4220) ->^done
1: (4220) ->(gdb)
1: (4706) <-1035-stack-list-variables 0
1: (4720) ->1035^done,variables=[]
1: (4720) 1035: elapsed time 14
1: (4720) ->(gdb)
1: (4720) ->&"\n"
1: (4721) ->^done
1: (4721) ->(gdb)

Other Extensions

CMake CMake Tools

Additional Information

When I have a breakpoint in main the editor shows this path:

C:\git\cmake_vscode_experiments\build\build-subfolders\C\git\cmake_vscode_experiments\subfolders\main\main.cpp

The path is absolute path of my buildfolder + the absolute path of my source file with a non-ascii character after the C. I have no idea how that ended up there.

If I check the logs and noticed something strange:

fullname="/c/git/cmake_vscode_experiments/build/build-subfolders/drivers/C:/git/cmake_vscode_experiments/subfolders/drivers/util/util.cpp",

One thing I found was that changing the cwd setting allowed me to at least see some source files, but not others:

"cwd": "${workspaceFolder}/drivers", or "cwd": "${workspaceFolder}/main",

But I cannot set cwd to both at the same time.

I checked these two issues: https://github.com/microsoft/vscode-cpptools/issues/5245 https://github.com/microsoft/vscode-cpptools/issues/257

But it didn't help (other than enabling logging)

WardenGnaw commented 2 years ago

The issue is MinGW produces PDBs with Windows styled paths, MSYS/Cywgin produce Unix styled paths and we try our best to convert it back to your windows file system.

The debug adapter should recognize that you are running under MSYS, can you regab the logs with

"logging": {
   "engineLogging": true,
   "traceResponse": true
}

and share them here?

ChrisIdema commented 2 years ago

Here is my log file with traceResponse enabled: log.txt

I now see:

/c/c/git/cmake_vscode_experiments/subfolders/main/main.cpp

Which has the drive letter twice.

ChrisIdema commented 2 years ago

@WardenGnaw Any suggestions?

ChrisIdema commented 2 years ago

Replacing C:\msys64\usr\bin\gdb.exe with C:\msys64\mingw64\bin\gdb.exe solved this issue for me.