1

I have a following setup: LuaJIT 64bit in .NET managed, 64bit LuaSocket dll ZeroBrane 1.80; MobDebug 0.705 Then I have several Lua scripts that are to be launched on specific events and I m trying to debug it. First script - scripts/OnCreateInstance.lua also starts the MobDebug.

Debugging is working fine in this first script - debugger gets connected on require('mobdebug').start() and also following breakpoints work as expected, but breakpoints in other scripts are never hit.

I've went through the https://studio.zerobrane.com/doc-faq#why-breakpoints-are-not-triggered and haven't found anything suspicious. debug.getinfo(1,"S").source returns scripts/onstartinstance.lua and scripts/onpushbutton.lua for the second script, which is correct. I am on Windows, so case sensitivity should not apply, and when I've switched the debugger verbose, I've still never seen any info about hitting the breakpoint.

I've also tried listing all the breakpoints in the second script, and all the breakpoints are listed, they just don't hit.

Do someone have any idea, what could be the problem? My only idea is, that it could be because of the second script is run from a different thread that the first script, but that is a thing I cannot avoid and have no idea how to work it around...

Thanks for any help

chucky-w
  • 53
  • 2
  • What's the project directory set to in the IDE? Is it set to the parent of `scripts` folder? – Paul Kulchenko Oct 24 '18 at 16:20
  • When you say "different thread", do you mean a different Lua state instance or do you mean started from a coroutine? – Paul Kulchenko Oct 24 '18 at 16:21
  • Yes, project directory is set to a parent of the `scripts` folder. And by different thread I mean really a different thread - Lua instance is started by one thread and the action that starts `onpushbutton.lua` is invoked by different thread - ie. Lua instance is started by MainThread and `onpushbutton.lua` is invoked by GUI event. But the Lua instance is the same. – chucky-w Oct 24 '18 at 20:06
  • Did you try running `require('mobdebug').on()` since it's in a different coroutine (as suggested in the first bullet point in the documentation)? – Paul Kulchenko Oct 24 '18 at 22:30
  • Yes, did not help... – chucky-w Oct 25 '18 at 08:21
  • OK, apparently I was doing something wrong. I've tried to reset my environment again from the scratch and it works... Thank you for help – chucky-w Oct 25 '18 at 11:07
  • Converted the discussion into the answer to help others. – Paul Kulchenko Oct 25 '18 at 17:44

1 Answers1

0

If the project directory is set correctly and the breakpoints are not triggered from other threads (not individual Lua states), then try adding require('mobdebug').on() calls to those threads/coroutines to enable breakpoints (as described in the first option in the documentation).

Paul Kulchenko
  • 25,884
  • 3
  • 38
  • 56