Environment
- OS and version: Windows 11
- VS Code: 1.120.0
- C/C++ extension: 1.32.2
- OS and version of remote machine (if applicable): Ubuntu Server 25.10 on Virtual Box (7.2.6)
- GDB / LLDB version: GDB Version 16.3
Bug Summary and Steps to Reproduce
Bug Summary:
I was debugging a C program on Ubuntu Server virtual machine from my Windows 11 host with VSCode and GDB. To work around this issue i need to disable debuginfo within launch.json , but when i’ve done that, vscode stopped running command which specifies the executable file and now debugger fails with such error:
ERROR: Unable to start debugging. Unexpected GDB output from command "-exec-run". No executable file specified.
Use the "file" or "exec-file" command.
Here is screenshot with comparisson of VsCode debug console output with debuginfo enabled and disabled. As you can see the file-exec-and-symbols command is present to the left, but absent to the right.
To fix this, i need to manually add file-exec-and-symbols command into launch.json (customLaunchSetupCommands) , with specifying path to my executable.
{
"description": "Specify exec file",
"text": "-file-exec-and-symbols /home/alex/shared/stack/pidm",
"ignoreFailures": true
}
Kinda strange behaviour, since i already have field program specifying path to the executable.
P.S. One more thing i’ve noticed, is that after main funcion finishes it transfers me to libc_start_call_main.h file. That wasn’t so, before i’ve specified settings above.
Debugger Configurations
# launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "GDB Launch",
"type": "cppdbg",
"request": "launch",
"program": "/home/alex/shared/stack/pidm",
"targetArchitecture": "x64",
"args": [
"/path/to/your/argv[1]",
"/path/to/your/argv[2]"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"externalConsole": false,
"internalConsoleOptions": "neverOpen",
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for GDB",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"customLaunchSetupCommands": [
{
"description": "Disable debuginfod",
"text": "set debuginfod enabled off",
"ignoreFailures": true
},
{
"description": "Specify exec file",
"text": "-file-exec-and-symbols /home/alex/shared/stack/pidm",
"ignoreFailures": true
}
],
"preLaunchTask": "Compile",
"logging": {
"engineLogging": true,
"trace": true
}
},
]
}
# tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "Compile",
"command": "/usr/bin/gcc",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"type": "shell",
"group": {
"kind": "build",
"isDefault": false
},
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"detail": "Compile the project."
}
]
}
Debugger Logs
1: (126) LaunchOptions{"name":"GDB Launch","type":"cppdbg","request":"launch","program":"/home/alex/shared/stack/pidm","targetArchitecture":"x64","args":["/path/to/your/argv[1]","/path/to/your/argv[2]"],"stopAtEntry":false,"cwd":"/home/alex/shared","externalConsole":false,"internalConsoleOptions":"neverOpen","MIMode":"gdb","miDebuggerPath":"/usr/bin/gdb","setupCommands":[{"description":"Enable pretty-printing for GDB","text":"-enable-pretty-printing","ignoreFailures":true}],"customLaunchSetupCommands":[{"description":"Disable debuginfod","text":"set debuginfod enabled off","ignoreFailures":true}],"preLaunchTask":"Compile","logging":{"engineLogging":true,"trace":true},"__configurationTarget":6,"configSource":"workspaceFolder","debugType":"debug","__sessionId":"5c3dc7be-f334-44df-b8c5-ba9fc1869708"}
1: (193) DbgCmd:echo $$ > /tmp/Microsoft-MIEngine-Pid-ybadnfcv.ex4 ; cd "/home/alex/shared/stack" ; DbgTerm=`tty` ; set -o monitor ; trap 'rm "/tmp/Microsoft-MIEngine-In-symzkoes.gwg" "/tmp/Microsoft-MIEngine-Out-afek3q54.tfg" "/tmp/Microsoft-MIEngine-Pid-ybadnfcv.ex4" "/tmp/Microsoft-MIEngine-Cmd-z00grbi5.wyo"' EXIT ; "/usr/bin/gdb" --interpreter=mi --tty=$DbgTerm < "/tmp/Microsoft-MIEngine-In-symzkoes.gwg" > "/tmp/Microsoft-MIEngine-Out-afek3q54.tfg" & clear; pid=$! ; echo $pid > "/tmp/Microsoft-MIEngine-Pid-ybadnfcv.ex4" ; wait $pid;
1: (229) Wait for connection completion.
1: (491) ->=thread-group-added,id="i1"
1: (503) ->~"GNU gdb (Ubuntu 16.3-1ubuntu2) 16.3\n"
1: (505) ->~"Copyright (C) 2024 Free Software Foundation, Inc.\n"
1: (506) ->~"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: (506) ->~"\nType \""
1: (508) ->~"show copying\" and \"show warranty\" for details.\n"
1: (509) ->~"This GDB was configured as \"x86_64-linux-gnu\".\n"
1: (509) ->~"Type \"show configuration\" for configuration details.\n"
1: (509) ->~"For bug reporting instructions, please see:\n"
1: (509) ->~"<https://www.gnu.org/software/gdb/bugs/>.\n"
1: (510) ->~"Find the GDB manual and other documentation resources online at:\n <"
1: (510) ->~"http://www.gnu.org/software/gdb/documentation/>.\n\n"
1: (510) ->~"For help, type \"help\".\n"
1: (510) ->~"Type \"apropos word\" to search for commands related to \"word\".\n"
1: (510) ->=cmd-param-changed,param="debuginfod enabled",value="off"
1: (511) ->(gdb)
1: (518) <-1001-gdb-set mi-async on
1: (523) ->1001^done
1: (523) ->(gdb)
1: (529) 1001: elapsed time 12
1: (542) <-1002-enable-pretty-printing
1: (543) ->1002^done
1: (544) ->(gdb)
1: (544) 1002: elapsed time 1
1: (544) <-1003-interpreter-exec console "set pagination off"
1: (545) ->=cmd-param-changed,param="pagination",value="off"
1: (547) ->1003^done
1: (547) 1003: elapsed time 3
1: (547) ->(gdb)
1: (551) <-1004-interpreter-exec console "set debuginfod enabled on"
1: (553) ->=cmd-param-changed,param="debuginfod enabled",value="on"
1: (555) ->1004^done
1: (556) ->(gdb)
1: (556) 1004: elapsed time 4
1: (560) <-1005-gdb-set auto-solib-add on
1: (561) ->1005^done
1: (561) ->(gdb)
1: (562) 1005: elapsed time 1
1: (562) <-1006-gdb-set solib-search-path /home/alex/shared/stack:
1: (563) ->1006^done
1: (565) ->(gdb)
1: (565) 1006: elapsed time 2
1: (565) <-1007-gdb-set stop-on-solib-events 1
1: (567) ->1007^done
1: (567) ->(gdb)
1: (567) 1007: elapsed time 1
1: (568) <-1008-interpreter-exec console "set debuginfod enabled off"
1: (570) ->=cmd-param-changed,param="debuginfod enabled",value="off"
1: (571) ->1008^done
1: (572) 1008: elapsed time 3
1: (574) ->(gdb)
1: (582) Send Event AD7EngineCreateEvent
1: (587) Send Event AD7ProgramCreateEvent
<-- R (runInTerminal-4) [427 ms]: {"type":"response","seq":3,"command":"runInTerminal","request_seq":4,"success":true,"body":{"shellProcessId":1649}}
1: (653) ShellPid=1785
1: (656) DebuggerPid=1787
<-- C (setBreakpoints-4): {"command":"setBreakpoints","arguments":{"source":{"name":"pidm.c","path":"/home/alex/shared/stack/pidm.c"},"lines":[98],"breakpoints":[{"line":98}],"sourceModified":false},"type":"request","seq":4}
1: (699) <-1009-break-insert -f pidm.c:98
1: (701) ->&"No symbol table is loaded. Use the \"file\" command.\n"
1: (703) ->1009^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="pidm.c:98",times="0",original-location="pidm.c:98"}
1: (703) ->(gdb)
1: (711) 1009: elapsed time 12
1: (721) Send Event AD7BreakpointErrorEvent
<-- C (setFunctionBreakpoints-5): {"command":"setFunctionBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":5}
<-- C (setInstructionBreakpoints-6): {"command":"setInstructionBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":6}
<-- C (setExceptionBreakpoints-7): {"command":"setExceptionBreakpoints","arguments":{"filters":[],"filterOptions":[]},"type":"request","seq":7}
<-- C (setDataBreakpoints-8): {"command":"setDataBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":8}
<-- C (configurationDone-9): {"command":"configurationDone","type":"request","seq":9}
1: (833) Send Event AD7LoadCompleteEvent
=thread-group-added,id="i1"
GNU gdb (Ubuntu 16.3-1ubuntu2) 16.3
Copyright (C) 2024 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-linux-gnu".
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".
=cmd-param-changed,param="debuginfod enabled",value="off"
=cmd-param-changed,param="pagination",value="off"
<-- C (threads-10): {"command":"threads","type":"request","seq":10}
1: (861) <-1010-exec-run
1: (864) ->1010^error,msg="No executable file specified.\nUse the \"file\" or \"exec-file\" command."
1: (864) ->(gdb)
1: (865) 1010: elapsed time 4
1: (869) Send Event AD7MessageEvent
ERROR: Unable to start debugging. Unexpected GDB output from command "-exec-run". No executable file specified.
Use the "file" or "exec-file" command.
1: (873) <--gdb-exit
1: (874) ->^exit
1: (880) Send Event AD7ProgramDestroyEvent
The program '/home/alex/shared/stack/pidm' has exited with code 42 (0x0000002a).
<-- C (disconnect-11): {"command":"disconnect","arguments":{"restart":false},"type":"request","seq":11}
Other Extensions
No response
Additional Information
No response
Environment
Bug Summary and Steps to Reproduce
Bug Summary:
I was debugging a C program on Ubuntu Server virtual machine from my Windows 11 host with VSCode and GDB. To work around this issue i need to disable debuginfo within
launch.json, but when i’ve done that, vscode stopped running command which specifies the executable file and now debugger fails with such error:Here is screenshot with comparisson of VsCode debug console output with debuginfo enabled and disabled. As you can see the
file-exec-and-symbolscommand is present to the left, but absent to the right.To fix this, i need to manually add
file-exec-and-symbolscommand intolaunch.json(customLaunchSetupCommands) , with specifying path to my executable.{ "description": "Specify exec file", "text": "-file-exec-and-symbols /home/alex/shared/stack/pidm", "ignoreFailures": true }Kinda strange behaviour, since i already have field
programspecifying path to the executable.P.S. One more thing i’ve noticed, is that after
mainfuncion finishes it transfers me tolibc_start_call_main.hfile. That wasn’t so, before i’ve specified settings above.Debugger Configurations
Debugger Logs
1: (126) LaunchOptions{"name":"GDB Launch","type":"cppdbg","request":"launch","program":"/home/alex/shared/stack/pidm","targetArchitecture":"x64","args":["/path/to/your/argv[1]","/path/to/your/argv[2]"],"stopAtEntry":false,"cwd":"/home/alex/shared","externalConsole":false,"internalConsoleOptions":"neverOpen","MIMode":"gdb","miDebuggerPath":"/usr/bin/gdb","setupCommands":[{"description":"Enable pretty-printing for GDB","text":"-enable-pretty-printing","ignoreFailures":true}],"customLaunchSetupCommands":[{"description":"Disable debuginfod","text":"set debuginfod enabled off","ignoreFailures":true}],"preLaunchTask":"Compile","logging":{"engineLogging":true,"trace":true},"__configurationTarget":6,"configSource":"workspaceFolder","debugType":"debug","__sessionId":"5c3dc7be-f334-44df-b8c5-ba9fc1869708"} 1: (193) DbgCmd:echo $$ > /tmp/Microsoft-MIEngine-Pid-ybadnfcv.ex4 ; cd "/home/alex/shared/stack" ; DbgTerm=`tty` ; set -o monitor ; trap 'rm "/tmp/Microsoft-MIEngine-In-symzkoes.gwg" "/tmp/Microsoft-MIEngine-Out-afek3q54.tfg" "/tmp/Microsoft-MIEngine-Pid-ybadnfcv.ex4" "/tmp/Microsoft-MIEngine-Cmd-z00grbi5.wyo"' EXIT ; "/usr/bin/gdb" --interpreter=mi --tty=$DbgTerm < "/tmp/Microsoft-MIEngine-In-symzkoes.gwg" > "/tmp/Microsoft-MIEngine-Out-afek3q54.tfg" & clear; pid=$! ; echo $pid > "/tmp/Microsoft-MIEngine-Pid-ybadnfcv.ex4" ; wait $pid; 1: (229) Wait for connection completion. 1: (491) ->=thread-group-added,id="i1" 1: (503) ->~"GNU gdb (Ubuntu 16.3-1ubuntu2) 16.3\n" 1: (505) ->~"Copyright (C) 2024 Free Software Foundation, Inc.\n" 1: (506) ->~"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: (506) ->~"\nType \"" 1: (508) ->~"show copying\" and \"show warranty\" for details.\n" 1: (509) ->~"This GDB was configured as \"x86_64-linux-gnu\".\n" 1: (509) ->~"Type \"show configuration\" for configuration details.\n" 1: (509) ->~"For bug reporting instructions, please see:\n" 1: (509) ->~"<https://www.gnu.org/software/gdb/bugs/>.\n" 1: (510) ->~"Find the GDB manual and other documentation resources online at:\n <" 1: (510) ->~"http://www.gnu.org/software/gdb/documentation/>.\n\n" 1: (510) ->~"For help, type \"help\".\n" 1: (510) ->~"Type \"apropos word\" to search for commands related to \"word\".\n" 1: (510) ->=cmd-param-changed,param="debuginfod enabled",value="off" 1: (511) ->(gdb) 1: (518) <-1001-gdb-set mi-async on 1: (523) ->1001^done 1: (523) ->(gdb) 1: (529) 1001: elapsed time 12 1: (542) <-1002-enable-pretty-printing 1: (543) ->1002^done 1: (544) ->(gdb) 1: (544) 1002: elapsed time 1 1: (544) <-1003-interpreter-exec console "set pagination off" 1: (545) ->=cmd-param-changed,param="pagination",value="off" 1: (547) ->1003^done 1: (547) 1003: elapsed time 3 1: (547) ->(gdb) 1: (551) <-1004-interpreter-exec console "set debuginfod enabled on" 1: (553) ->=cmd-param-changed,param="debuginfod enabled",value="on" 1: (555) ->1004^done 1: (556) ->(gdb) 1: (556) 1004: elapsed time 4 1: (560) <-1005-gdb-set auto-solib-add on 1: (561) ->1005^done 1: (561) ->(gdb) 1: (562) 1005: elapsed time 1 1: (562) <-1006-gdb-set solib-search-path /home/alex/shared/stack: 1: (563) ->1006^done 1: (565) ->(gdb) 1: (565) 1006: elapsed time 2 1: (565) <-1007-gdb-set stop-on-solib-events 1 1: (567) ->1007^done 1: (567) ->(gdb) 1: (567) 1007: elapsed time 1 1: (568) <-1008-interpreter-exec console "set debuginfod enabled off" 1: (570) ->=cmd-param-changed,param="debuginfod enabled",value="off" 1: (571) ->1008^done 1: (572) 1008: elapsed time 3 1: (574) ->(gdb) 1: (582) Send Event AD7EngineCreateEvent 1: (587) Send Event AD7ProgramCreateEvent <-- R (runInTerminal-4) [427 ms]: {"type":"response","seq":3,"command":"runInTerminal","request_seq":4,"success":true,"body":{"shellProcessId":1649}} 1: (653) ShellPid=1785 1: (656) DebuggerPid=1787 <-- C (setBreakpoints-4): {"command":"setBreakpoints","arguments":{"source":{"name":"pidm.c","path":"/home/alex/shared/stack/pidm.c"},"lines":[98],"breakpoints":[{"line":98}],"sourceModified":false},"type":"request","seq":4} 1: (699) <-1009-break-insert -f pidm.c:98 1: (701) ->&"No symbol table is loaded. Use the \"file\" command.\n" 1: (703) ->1009^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="pidm.c:98",times="0",original-location="pidm.c:98"} 1: (703) ->(gdb) 1: (711) 1009: elapsed time 12 1: (721) Send Event AD7BreakpointErrorEvent <-- C (setFunctionBreakpoints-5): {"command":"setFunctionBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":5} <-- C (setInstructionBreakpoints-6): {"command":"setInstructionBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":6} <-- C (setExceptionBreakpoints-7): {"command":"setExceptionBreakpoints","arguments":{"filters":[],"filterOptions":[]},"type":"request","seq":7} <-- C (setDataBreakpoints-8): {"command":"setDataBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":8} <-- C (configurationDone-9): {"command":"configurationDone","type":"request","seq":9} 1: (833) Send Event AD7LoadCompleteEvent =thread-group-added,id="i1" GNU gdb (Ubuntu 16.3-1ubuntu2) 16.3 Copyright (C) 2024 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-linux-gnu". 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". =cmd-param-changed,param="debuginfod enabled",value="off" =cmd-param-changed,param="pagination",value="off" <-- C (threads-10): {"command":"threads","type":"request","seq":10} 1: (861) <-1010-exec-run 1: (864) ->1010^error,msg="No executable file specified.\nUse the \"file\" or \"exec-file\" command." 1: (864) ->(gdb) 1: (865) 1010: elapsed time 4 1: (869) Send Event AD7MessageEvent ERROR: Unable to start debugging. Unexpected GDB output from command "-exec-run". No executable file specified. Use the "file" or "exec-file" command. 1: (873) <--gdb-exit 1: (874) ->^exit 1: (880) Send Event AD7ProgramDestroyEvent The program '/home/alex/shared/stack/pidm' has exited with code 42 (0x0000002a). <-- C (disconnect-11): {"command":"disconnect","arguments":{"restart":false},"type":"request","seq":11}Other Extensions
No response
Additional Information
No response