Debugging lua with c++ simultanously

lualualualua Join Date: 2008-08-22 Member: 64870Members
In my project i am calling lua scripts from c++ code. I want to debug lua and c++ simultanously. Can anybody help me?

For example this is my c++ code

#include <stdio.h>

extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}

/* the Lua interpreter */
lua_State* L;

int main ( int argc, char *argv[] )
{
/* initialize Lua */
L = lua_open();

/* load Lua base libraries */
luaL_openlibs(L);

/* run the script */
luaL_dofile(L, "test.lua");

/* cleanup Lua */
lua_close(L);


/* pause */
printf( "Press enter to exit..." );
getchar();

return 0;
}

And this is my lua code meta.lua
x=5
y=4
function add(x,y)
return x+y
end
k=add(x,y)
print (k.." sonuc")

Comments

  • MaxMax Technical Director, Unknown Worlds Entertainment Join Date: 2002-03-15 Member: 318Super Administrators, Retired Developer, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, Subnautica Developer, Pistachionauts, Future Perfect Developer
    Under the Debug menu there is an option "Attach System Debugger". If you select that, it will automatically launch your C++ debugger (most likely MSVC) when you run your application from Decoda. You can then use the C++ debugger to debug the C++ code and Decoda to debug the Lua code simultaneously.
  • lualualualua Join Date: 2008-08-22 Member: 64870Members
    Thank you for your answer.
    But my problem is that; when ı start to debug from decoda side, it starts to run until where ı called lua file then it says :
    "This application requested the Runtime to terminate it unusual way. Please contact with application's support team for more information"

    And Visual Studio gives an error:Unable to attach to the crashing process. The requested operation is not supported.

    How can I solve the problem
  • lualualualua Join Date: 2008-08-22 Member: 64870Members
    I solve the problem. My lua files were not at the same directory with exe file. moving them to same directory with exe solved the problem.

    I want to debug lua and c++ at the same time. is it possible???
    For example ı wanna put breakpoint into c++ and lua.
    when i debug from decoda ı want it to stop at the breakpoint where ı put in c++.
Sign In or Register to comment.