Creating a debug elf-file for marlin firmware from VSCode

Hello,
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
#
[env:mks_robin_nano_v3_usb_flash_drive_msc]
build_type = debug
debug_build_flags = -O0 -ggdb3 -g3 -DUSBCON -DUSE_USBHOST_HS -DUSBD_IRQ_PRIO=5 -DUSBD_IRQ_SUBPRIO=6 -DUSE_USB_HS_IN_FS -DUSBD_USE_CDC_MSC
extends           = env:mks_robin_nano_v3
platform_packages = framework-arduinoststm32@https://github.com/rhapsodyv/Arduino_Core_STM32/archive/usb-host-msc-cdc-msc.zip
build_unflags     = ${common_stm32.build_unflags} -DUSBD_USE_CDC
build_flags       = ${stm32_flash_drive.build_flags}
  -DUSBCON
  -DUSE_USBHOST_HS
  -DUSBD_IRQ_PRIO=5
  -DUSBD_IRQ_SUBPRIO=6
  -DUSE_USB_HS_IN_FS
  -DUSBD_USE_CDC_MSC

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.