Hi folksss,
I’ve some (new) troubles debugging with VSCode (Windows, 1.85.2) my modules using Rack 2 (compiled, not the sdk).
Here’s my compile.mk:
ifndef RACK_DIR
$(error RACK_DIR is not defined)
endif
include $(RACK_DIR)/arch.mk
OBJCOPY ?= objcopy
STRIP ?= strip
INSTALL_NAME_TOOL ?= install_name_tool
OTOOL ?= otool
# Generate dependency files alongside the object files
FLAGS += -MMD -MP
# Debugger symbols. These are removed with `strip`.
FLAGS += -g
# Optimization
FLAGS += -O0 -funsafe-math-optimizations -fno-omit-frame-pointer
# Warnings
FLAGS += -Wall -Wextra -Wno-unused-parameter
# C++ standard
CXXFLAGS += -std=c++11
# Define compiler/linker target if cross-compiling
ifdef CROSS_COMPILE
FLAGS += --target=$(MACHINE)
LDFLAGS += --target=$(MACHINE)
endif
# Architecture-independent flags
ifdef ARCH_X64
FLAGS += -DARCH_X64
FLAGS += -march=nehalem
endif
ifdef ARCH_ARM64
FLAGS += -DARCH_ARM64
FLAGS += -march=armv8-a+fp+simd
endif
ifdef ARCH_LIN
FLAGS += -DARCH_LIN
CXXFLAGS += -Wsuggest-override
endif
ifdef ARCH_MAC
FLAGS += -DARCH_MAC
CXXFLAGS += -stdlib=libc++
LDFLAGS += -stdlib=libc++
MAC_SDK_FLAGS := -mmacosx-version-min=10.9
FLAGS += $(MAC_SDK_FLAGS)
LDFLAGS += $(MAC_SDK_FLAGS)
endif
ifdef ARCH_WIN
FLAGS += -DARCH_WIN
FLAGS += -D_USE_MATH_DEFINES
FLAGS += -municode
CXXFLAGS += -Wsuggest-override
endif
# Allow *appending* rather than prepending to common flags.
# This is useful to force-redefine compiler settings instead of merely setting defaults that may be overwritten.
FLAGS += $(EXTRA_FLAGS)
CFLAGS += $(EXTRA_CFLAGS)
CXXFLAGS += $(EXTRA_CXXFLAGS)
LDFLAGS += $(EXTRA_LDFLAGS)
# Apply FLAGS to language-specific flags
CFLAGS += $(FLAGS)
CXXFLAGS += $(FLAGS)
# Derive object files from sources and place them before user-defined objects
OBJECTS := $(patsubst %, build/%.o, $(SOURCES)) $(OBJECTS)
OBJECTS += $(patsubst %, build/%.bin.o, $(BINARIES))
DEPENDENCIES := $(patsubst %, build/%.d, $(SOURCES))
# Final targets
$(TARGET): $(OBJECTS)
$(CXX) -o $@ $^ $(LDFLAGS)
-include $(DEPENDENCIES)
build/%.c.o: %.c
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c -o $@ $<
build/%.cpp.o: %.cpp
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -c -o $@ $<
build/%.cc.o: %.cc
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -c -o $@ $<
build/%.m.o: %.m
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c -o $@ $<
build/%.bin.o: %
@mkdir -p $(@D)
ifdef ARCH_LIN
$(OBJCOPY) -I binary -O elf64-x86-64 -B i386:x86-64 --rename-section .data=.rodata,alloc,load,readonly,data,contents $< $@
endif
ifdef ARCH_WIN
$(OBJCOPY) -I binary -O pe-x86-64 -B i386:x86-64 --rename-section .data=.rodata,alloc,load,readonly,data,contents $< $@
endif
ifdef ARCH_MAC
@# Apple makes this needlessly complicated, so just generate a C file with an array.
xxd -i $< | $(CC) $(MAC_SDK_FLAGS) -c -o $@ -xc -
endif
build/%.html: %.md
markdown $< > $@
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "DEBUG (gdb)",
"type": "cppdbg",
"request": "launch",
"program": "c:/dev/Rack/Rack.exe",
"args": [
"-d"
],
"stopAtEntry": false,
"cwd": "c:/dev/Rack",
"externalConsole": false,
"avoidWindowsConsoleRedirection": true,
"internalConsoleOptions": "openOnSessionStart",
"MIMode": "gdb",
"miDebuggerPath": "C:/msys64/mingw64/bin/gdb.exe",
"miDebuggerArgs": "--silent --statistics",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Disable Thead logging",
"text": "set print thread-events off",
"ignoreFailures": true
}
],
"logging": {
"engineLogging": false,
"exceptions": true,
"trace": false,
"traceResponse": false,
"moduleLoad": false,
"programOutput": true
},
"preLaunchTask": "build+install"
}
]
}
It compile and start debug correctly (if I set stopAtEntry true, it break on main), Rack.exe is launched (I see on Task Manager), but I don’t see the GUI
Is there somethings to enable that I’m missing? This is the VSCode DEBUG CONSOLE output:
=thread-group-added,id="i1"
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param="pagination",value="off"
Thread 1 hit Breakpoint 1, main (argc=2, argv=0x14fd80) at adapters/standalone.cpp:56
56 int main(int argc, char* argv[]) {
=library-unloaded,id="C:\\Windows\\SYSTEM32\\avrt.dll",target-name="C:\\Windows\\SYSTEM32\\avrt.dll",host-name="C:\\Windows\\SYSTEM32\\avrt.dll",thread-group="i1"
=library-unloaded,id="C:\\Windows\\SYSTEM32\\dwmapi.dll",target-name="C:\\Windows\\SYSTEM32\\dwmapi.dll",host-name="C:\\Windows\\SYSTEM32\\dwmapi.dll",thread-group="i1"
=library-unloaded,id="c:\\program files\\image-line\\fl studio asio\\ILWASAPI2ASIO_x64.dll",target-name="c:\\program files\\image-line\\fl studio asio\\ILWASAPI2ASIO_x64.dll",host-name="c:\\program files\\image-line\\fl studio asio\\ILWASAPI2ASIO_x64.dll",thread-group="i1"