Script debugging problem

If the path to a script is too long, the position of the step is not visible during debugging. I attach an example project and screenshots of the problem.

Normally, the position is indicated by a frame at a breakpoint:

If the path is too long, the frame is not visible at the breakpoint, it can only be debugged blindly in the given script:

ScriptPathTooLong.zip (2.7 KB)

Please add it to the github issues

It’s a known issue dating back to 2019: https://github.com/defold/defold/issues/3835

2 Likes

I’ve been investigating what’s causing the problem. There is a limit to the length of Lua source paths in the bob and editor source. In both places, the paths are limited to 59 characters during the build.

There is also a note in the bob source code about this:

// We will also limit the chunkname (the identifying part of a script/source chunk) to 59 chars.
// Lua has a maximum length of chunknames, by default defined to 60 chars.

It seems to me that something misunderstood may have happened here. During debugging, the editor uses mobdebug to retrieve current debug status information. Mobdebug uses the debug.getinfo(i, “Snl”) function call to determine the current source, line number, and so on. If you read the lua_getinfo function and its lua_Debug structure in the Lua documentation (Lua 5.1 Reference Manual), you can see that the 60 character limit (LUA_IDSIZE) only applies to printable source names (short_src). Since the editor does not use the short_src attribute (but the content of the source attribute that has no character constraint), I don’t think the 59 long character constraint above makes sense. Developers could say more about that.

I removed this restriction in the bob and editor source and then build the engine and editor as well. During testing, the long path was no longer a problem.

I’d love to do PR for this, but my bad English and the fact that I’ve never done PR prevents me from doing so. Anyway, if anyone feels the urge to fix this problem based on the information above, I would thank you!

I apologize if my reasoning is not correct on the forum. :slight_smile:

3 Likes

Interesting find @coderm4ster ! We should take a closer look at this. Could you please add this info to the GitHub issue?

1 Like

Of course I will add the information. This feature is very important to me because I use the debugger built into the editor intensively and it is very inconvenient if this problem occurs. Maybe something else is like that.
Thank you @britzl if this problem is officially resolved in a relatively short time! I really like Defold and the community whose reaction time is unbeatable :slight_smile:

1 Like