Skip to content

Unable to start debugging: Program path is missing or invalid. #907

@thndrwrks

Description

@thndrwrks

I am having difficulty debugging C code with vs-code. I previously had it working but maybe an update has killed it. I am at a loss for how to fix the issue and any guidance would be appreciated. The specific error I get when trying to start debugging is: "Unable to start debugging. Program path [${workspaceRoot}\Debug\bin\main.exe] is missing or invalid."

My folder is a simple helloworld program with a main.c and a makefile. Here is a snapshot of the folder:
helloworld.zip

I am trying to debug on a Windows 10 machine. I have MinGW and LLVM installed (because clang is awesome). MinGW is installed using the MinGW Installation Manager. mingw32-base is version 2013072200. msys-base is version 2013072300.

Running clang --version in a PowerShell instance returns:

clang version 4.0.1 (tags/RELEASE_401/final)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\llvm\bin

Here is the listing of the relevant files in the folder:

main.c

#include <stdio.h>

int main(void)
{
	printf("Hello world!\n");

	printf("Press enter to quit...\n");
	getchar();

	return 0;
}

makefile

SOURCES = main.c

.PHONY: debug

debug: Debug/bin/main.exe

Debug/bin/main.exe: $(SOURCES:%.c=Debug/obj/%.o)
	clang -Wall $^ -o $@

Debug/obj/%.o: %.c | Debug
	clang -c -g $< -MMD -MP -o $@ -Wall -pedantic -MF Debug/depends/$(@F:.o=.d)

main.o: main.c

Debug:
	-mkdir Debug
	-mkdir Debug/bin
	-mkdir Debug/depends
	-mkdir Debug/obj

clean:
	rm -rf Debug
	rm -rf Release

.vscode/launch.json

{
	"version": "0.2.0",
	"configurations": [
		{
			"name": "(gdb) Launch",
			"type": "cppdbg",
			"request": "launch",
			"program": "${workspaceRoot}/Debug/bin/main.exe",
			"args": [],
			"stopAtEntry": false,
			"cwd": "${workspaceRoot}",
			"environment": [],
			"externalConsole": true,
			"MIMode": "gdb",
			"miDebuggerPath": "C:/MinGW/bin/gdb.exe",
			"setupCommands": [
			    {
			        "description": "Enable pretty-printing for gdb",
			        "text": "-enable-pretty-printing",
			        "ignoreFailures": true
			    }
			]
		}
	]
}

.vscode/tasks.json

{
	// See https://go.microsoft.com/fwlink/?LinkId=733558
	// for the documentation about the tasks.json format
	"version": "2.0.0",
	"tasks": [
		{
			"taskName": "Build",
			"command": "make",
			"group": {
				"kind": "build",
				"isDefault": true
			},
			"type": "shell"
		}
	]
}

Metadata

Metadata

Assignees

Labels

debuggermore info neededThe issue report is not actionable in its current state

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions