Unable to debug in vscode with gcc/cgo

TLDR:Currently I can run and build the go code normally. But I cannot debug in vscode.

So far I’ve tried using msys2 and tdm-gcc on windows to use c libraries. After setting up msys2 I don’t get any errors but after starting debugging dlv-dap doesn’t stop at breakpoints. But hovering on breakpoints shows something along the lines __debug_bin2735482890.exe not found. And using tdm-gcc actually shows an error
[Content] Failed to launch: could not launch process: fork/exec C:\Users\User\AppData\Local\Temp\__debug_bin2735482890.exe: %1 is not a valid Win32 application.

So how to set up working cgo for windows? If someone has working setup similar to me can you show the steps you followed?

>go env

set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\User\AppData\Local\go-build
set GOENV=C:\Users\User\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\User\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\User\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.17.3
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\User\AppData\Local\Temp\go-build3886944430=/tmp/go-build -gno-record-gcc-switches```

>gcc  --version
gcc (tdm64-1) 10.3.0                                           [tdm-gcc setup]``