microsoft / microsoft/vscode-cpptools
Breakpoint get ignored since a Cproject trans into a C++ project
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Type: Debugger
my debugger:GNU gdb (GDB) 8.1
Describe the bug:
-
OS and Version: Windows 10 x64 10.0.18363
-
VS Code Version: 1.47.3
-
C/C++ Extension Version: v0.30.0-insiders
-
Other extensions you installed (and if the issue persists after disabling them):
Bracket Pair Colorizer 2
C/C++ Project Generator(I use its to create makefile for project)
Code Runner
Debug Visualizer -
A clear and concise description of what the bug is.
The debugging can see the yellow director normally when I debug my C projects(2 c files,1 head files),for some reasons I need get my c files change into cpp files and make and debug again,then I find the director is disappeared and the red break dot become grey,I try to change my compiler from gcc to g++ to solve its but it's not work.
To Reproduce
Please include a code sample and launch.json configuration.
Steps to reproduce the behavior:
- rename all c files as cpp files,and change complier command in makefile from gcc to g++.
- Click on Ctrl+F5 for debugging.
- Termiral:'.
Executing task: powershell -c mingw32-make <
g++ -std=c++17 -Wall -Wextra -g -Iinclude -Llib src/tree.o src/petclub.o -o bin/main.exe
Terminal will be reused by tasks, press any key to close it....'
- the director is disappeared and the red break dot become grey.
my C++ project structure:
D:.
│ Makefile
│
├─.vscode
│ launch.json
│ tasks.json
│
├─bin
│ main.exe
│
├─include
├─lib
└─src
petclub.cpp
petclub.o
tree.cpp
tree.h
tree.o
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "cppdbg",
"request": "launch",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"linux": {
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"program": "${workspaceFolder}/bin/main"
},
"osx": {
"MIMode": "lldb",
"miDebuggerPath": "lldb-mi",
"program": "${workspaceFolder}/bin/main"
},
"windows": {
"MIMode": "gdb",
"miDebuggerPath": "gdb.exe",
"program": "${workspaceFolder}/bin/main.exe"
},
"preLaunchTask": "build"
}
]
}
makefile
`CC := g++
CFLAGS := -std=c++17 -Wall -Wextra -g
BIN := bin
SRC := src
INCLUDE := include
LIB := lib
LIBRARIES :=
ifeq ($(OS),Windows_NT)
EXECUTABLE := main.exe
SOURCEDIRS := $(SRC)
INCLUDEDIRS := $(INCLUDE)
LIBDIRS := $(LIB)
else
EXECUTABLE := main
SOURCEDIRS := $(shell find $(SRC) -type d)
INCLUDEDIRS := $(shell find $(INCLUDE) -type d)
LIBDIRS := $(shell find $(LIB) -type d)
endif
CINCLUDES := $(patsubst %,-I%, $(INCLUDEDIRS:%/=%))
CLIBS := $(patsubst %,-L%, $(LIBDIRS:%/=%))
SOURCES := $(wildcard $(patsubst %,%/*.cpp, $(SOURCEDIRS)))
OBJECTS := $(SOURCES:.cpp=.o)
all: $(BIN)/$(EXECUTABLE)
.PHONY: clean
clean:
-$(RM) $(BIN)/$(EXECUTABLE)
-$(RM) $(OBJECTS)
run: all
./$(BIN)/$(EXECUTABLE)
$(BIN)/$(EXECUTABLE): $(OBJECTS)
$(CC) $(CFLAGS) $(CINCLUDES) $(CLIBS) $^ -o $@ $(LIBRARIES)`
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reported .vscode/launch.json and Makefile, then reproduce the breakpoint behavior using the listed Windows, GDB, VS Code, and C/C++ extension versions. Confirm whether breakpoints remain active after the sources are renamed to .cpp and the executable is rebuilt; a fix should preserve breakpoint binding for the C++ project.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, vscode
- Domain
- build-system, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100