air-verse / air

☁️ Live reload for Go apps
GNU General Public License v3.0
17.4k stars 798 forks source link

Air with Dlv and breakpoints does not work #628

Open hamidrabedi opened 2 months ago

hamidrabedi commented 2 months ago

I added this config to my air.toml:

root = "."
testdata_dir = "testdata"
tmp_dir = "tmp"

[build]
  bin = "app"
  cmd = "go build -o ./tmp/app.exe ."
  exclude_dir = ["vendor", "tmp", "node_modules"]
  include_ext = ["go", "tmpl", "html"]
  exclude_file = []
  full_bin = "dlv exec --continue --accept-multiclient --listen=:2345 --headless=true --api-version=2 --log ./tmp/app"
  log = "air.log"

and ran the project with command air, now I added a runtime.Breakpoint() in the middle of code. so when I run the code with dlv debug and gets to the breakpoints, it stops and gives me an interactive shell so I can write some commands and stuff. how can I achieve that with air and dlv together?

these are the logs if it helps

2024-07-20T16:24:20+03:30 debug layer=debugger callInjection protocol on:
2024-07-20T16:24:20+03:30 debug layer=debugger  12032 PC=0x7ffd0960d5e4
2024-07-20T16:24:20+03:30 debug layer=debugger  12500 PC=0x7ffd09610ff4
2024-07-20T16:24:20+03:30 debug layer=debugger  46868 PC=0x7ffd0960d5e4
2024-07-20T16:24:20+03:30 debug layer=debugger  37032 PC=0x7ffd0960d5e4
2024-07-20T16:24:20+03:30 debug layer=debugger  50296 PC=0x7ffd0960d5e4
2024-07-20T16:24:20+03:30 debug layer=debugger  8656 PC=0x7ffd0960d5e4
2024-07-20T16:24:20+03:30 debug layer=debugger  47012 PC=0x4f3461
2024-07-20T16:24:20+03:30 debug layer=debugger  49668 PC=0x7ffd09610ff4
2024-07-20T16:24:20+03:30 debug layer=debugger  42716 PC=0x7ffd0960d5e4
2024-07-20T16:24:20+03:30 debug layer=debugger  50024 PC=0x7ffd0960d5e4
2024-07-20T16:24:20+03:30 debug layer=debugger  46540 PC=0x7ffd0960d5e4
2024-07-20T16:24:20+03:30 debug layer=debugger  47768 PC=0x7ffd09610ff4
2024-07-20T16:24:20+03:30 debug layer=debugger  51760 PC=0x7ffd09610394
2024-07-20T16:24:20+03:30 debug layer=debugger  52148 PC=0x7ffd0960d5e4
2024-07-20T16:24:20+03:30 debug layer=debugger  1896 PC=0x7ffd0960d5e4
2024-07-20T16:24:20+03:30 debug layer=debugger  37844 PC=0x7ffd0960d5e4
2024-07-20T16:24:20+03:30 debug layer=debugger  51264 PC=0x7ffd0960d5e4
2024-07-20T16:24:20+03:30 error layer=rpc writing response:write tcp 127.0.0.1:2345->127.0.0.1:63696: use of closed network connection
RokeAlvo commented 2 weeks ago

same issue