File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ #include "debugger.h"
2+
3+ #include <stdio.h>
4+ #include <lua.h>
5+
6+ #include "laco.h"
7+
8+ void laco_print_debug_info (struct LacoState * laco ,
9+ const char * function_name ) {
10+ lua_State * L = laco_get_laco_lua_state (laco );
11+ lua_Debug debug_info = {0 };
12+
13+ lua_getfield (L , LUA_GLOBALSINDEX , function_name );
14+
15+ lua_getinfo (L , ">Sl" , & debug_info );
16+
17+ printf (
18+ "What: \t%s\n"
19+ "Source file: \t%s\n"
20+ "Line defined on: \t%d\n"
21+ "Current line: \t%d\n" ,
22+ debug_info .what , debug_info .source ,
23+ debug_info .linedefined , debug_info .currentline );
24+ }
Original file line number Diff line number Diff line change 1+ #ifndef LACO_DEBUGGER_H
2+ #define LACO_DEBUGGER_H
3+
4+ struct LacoState ;
5+
6+ void laco_print_debug_info (struct LacoState * laco ,
7+ const char * function_name );
8+
9+ #endif /* LACO_DEBUGGER_H */
You can’t perform that action at this time.
0 commit comments