Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant add BreakPoints via Debug Adapter Protocol, if the script is not open in Godot Editor #89039

Closed
dekaravanhoc opened this issue Mar 1, 2024 · 4 comments

Comments

@dekaravanhoc
Copy link

Tested versions

  • Reproducable in: 4.2.1

System information

Godot v4.2.1.stable - Windows 10.0.22631 - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 4070 (NVIDIA; 31.0.15.3640) - AMD Ryzen 7 3700X 8-Core Processor (16 Threads)

Issue description

I am using nvim and the nvim-dap plugin.
It connects correctly, requesting and getting responses.

When I add a breakpoint it sends:

[ DEBUG ] 2024-03-01T13:14:59Z+0100 ] ...ppData/Local/nvim-data/lazy/nvim-dap/lua/dap/session.lua:1677 ]	"request"	{
  arguments = {
    breakpoints = { {
        line = 44
      } },
    lines = { 44 },
    source = {
      name = "shield.gd",
      path = "D:\\GameDev\\games\\mobile_casual_rougelite\\game\\animations\\shield.gd"
    },
    sourceModified = false
  },
  command = "setBreakpoints",
  seq = 4,
  type = "request"
}

If the script is open in the editor the response looks like that:

[ DEBUG ] 2024-03-01T13:22:40Z+0100 ] ...ppData/Local/nvim-data/lazy/nvim-dap/lua/dap/session.lua:951 ]	1	{
  body = {
    breakpoints = { {
        id = 3,
        line = 44,
        source = {
          checksums = { {
              algorithm = "MD5",
              checksum = "fa1f2928ce3427874da1ef820bfe481a"
            }, {
              algorithm = "SHA256",
              checksum = "723f8353babdd9e962c59c45219435d6eb99f6d0f6e36b2373ddf6588c2b0f53"
            } },
          name = "",
          path = "D:/GameDev/games/mobile_casual_rougelite/game/animations/shield.gd"
        },
        verified = true
      } }
  },
  command = "setBreakpoints",
  request_seq = 6,
  seq = 24,
  success = true,
  type = "response"
}

If it is not open, it looks like that:

[ DEBUG ] 2024-03-01T13:22:39Z+0100 ] ...ppData/Local/nvim-data/lazy/nvim-dap/lua/dap/session.lua:951 ]	1	{
  body = {
    breakpoints = {}
  },
  command = "setBreakpoints",
  request_seq = 5,
  seq = 23,
  success = true,
  type = "response"
}

There is also an error in the Godot console:

editor/debugger/debug_adapter/debug_adapter_protocol.cpp:800 - Condition "!breakpoint_list.find(breakpoint)" is true. Returning: Array()

I am not really into c++ but I narrowed it (propably) down to:
https://github.com/godotengine/godot/blob/master/editor/debugger/editor_debugger_node.cpp#L578

Steps to reproduce

  1. Setup nvim with nvim-dap for godot:
  1. Start the editor with a project - no scripts open.
  2. Start the nvim debugger.
  3. Add a breakpoint.

Minimal reproduction project (MRP)

N/A

@akien-mga akien-mga changed the title Cant add BreakPoints via Debug Adapter Protokoll, if there script is not open in Godot Editor Cant add BreakPoints via Debug Adapter Protocol, if there script is not open in Godot Editor Mar 1, 2024
@akien-mga
Copy link
Member

CC @rsubtil

@dekaravanhoc dekaravanhoc changed the title Cant add BreakPoints via Debug Adapter Protocol, if there script is not open in Godot Editor Cant add BreakPoints via Debug Adapter Protocol, if the script is not open in Godot Editor Mar 1, 2024
@rsubtil
Copy link
Contributor

rsubtil commented Mar 1, 2024

There is also an error in the Godot console:

editor/debugger/debug_adapter/debug_adapter_protocol.cpp:800 - Condition "!breakpoint_list.find(breakpoint)" is true. Returning: Array()

This error should be fixed by #84898. It was cherry-picked for 4.2.2; can you try the 4.2.2-rc1 build and check if that error still occurs?

As for the issue with closed scripts, I can reproduce it indeed, so will have a look in fixing it 👍

@dekaravanhoc
Copy link
Author

Hey, Yeah the issue is completely resolved in the RC. Obviously someone already put the same issue in - linked to the fix. Did not find it in the search.
Therefor this can be closed due to duplication of #83614

Thanks. 🙃

@rsubtil
Copy link
Contributor

rsubtil commented Mar 1, 2024

I've tested in v4.2.1-stable, and indeed the closed file bug is also fixed in the RC build. I didn't expect that PR to resolve this too considering the highlighted code you noticed, but it does seem to be the case.

You can manually close the issue then 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants