Creating a debug elf-file for marlin firmware from VSCode

I am having a problem with being able to debug the marlin-firmware for my printer. Essentially, what I want to do is to create an .elf-file from VSCode, which I then use to debug the STM32F407-Controller by STM32CubeIDE. In STM32CubeIDE, I currently can not debug because variables are getting filled with values, breakpoints are just omitted etc… I suspect the .elf-file to be the problem because I can confirm that the firmware of the printer works (confirmed by performing actions via UART and reading answers form UART).
My configuration looks as follows:

# MKS Robin Nano V3 with USB Flash Drive Support and Shared Media
# Currently, using a STM32duino fork, until USB Host and USB Device MSC get merged
build_type = debug
extends           = env:mks_robin_nano_v3
platform_packages = framework-arduinoststm32@
build_unflags     = ${common_stm32.build_unflags} -DUSBD_USE_CDC
build_flags       = ${stm32_flash_drive.build_flags}

Does anyone have an idea how I can actually produce entirely unoptimized code to perform debugging?

build_type = debug

See docs.

build_type = debug

I set the build_type to debug in the very first row of the configuration.
Ok, but now, with the same settings as in the initial post, it works. I must have loaded the wrong .elf-file somehow, sorry for the inconvenience. For everyone who may stumble upon this post: Debugging the marlin-fw works fine with this configuration, EXCEPT from the USB-connection. It does not seem to work right now, but I did not need it.