microsoft / microsoft/vscode-cpptools

Breakpoint get ignored since a Cproject trans into a C++ project

Offen
#5,926 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

debugger
Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
14 Std. 46 Min.
Gemergte PRs (30 T.)
61

Beschreibung

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:

  1. rename all c files as cpp files,and change complier command in makefile from gcc to g++.
  2. Click on Ctrl+F5 for debugging.
  3. 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....'

  1. 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)`

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginnen Sie mit der gemeldeten .vscode/launch.json und Makefile und reproduzieren Sie das Breakpoint-Verhalten unter Verwendung der aufgeführten Versionen von Windows, GDB, VS Code und der C/C++-Erweiterung. Bestätigen Sie, ob Breakpoints aktiv bleiben, nachdem die Quelldateien in .cpp umbenannt und die ausführbare Datei neu erstellt wurde; ein Fix sollte die Bindung von Breakpoints für das C++-Projekt beibehalten.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp, vscode
Bereich
build-system, devtools
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.