I am working on a project in which Lua (more specifically LuaJIT) is the scripting language but most of the heavy lifting is performed in C code. The C code is compiled into a .so file and LuaJIT's ffi capabilities are used to load the library and access the functions. Let's say I set a breakpoint in the Lua code at the point where the C function is invoked. Can I "step into" the C code at that point and continue stepping through the C code as if I were using gdb?
Asked
Active
Viewed 129 times
1 Answers
0
No; ZeroBrane Studio debugger (it's using MobDebug) only supports stepping through Lua code. I don't think there is a debugger that integrates stepping through Lua and C code. You may be able to use two debuggers though: one for Lua and one for C code.

Paul Kulchenko
- 25,884
- 3
- 38
- 56
-
Thank you for the super prompt response! If I can get get to the breakpoint in Lua, then attach gdb to the ZeroBrane process and continue my investigations in gdb, that would be perfect. Have you ever tried something like that? – Ramesh Subramonian May 06 '20 at 01:12
-
No, I was thinking about about attaching gdb to the dynamic library and using ZBS to debug the lua code. When you step into a C call, it will look like the code is "running" to the Lua debugger, but gdb can take control to allow you to step through the C code. The two debuggers wouldn't really interfere, as when you step in one, to the other looks like the process is still executing. – Paul Kulchenko May 06 '20 at 01:24
-
Makes perfect sense. Thank you. – Ramesh Subramonian May 06 '20 at 01:27
-
You may want to accept the answer if it addressed your question. – Paul Kulchenko May 06 '20 at 04:07