diff options
author | benoit-germain <bnt.germain@gmail.com> | 2011-06-24 01:31:12 -0700 |
---|---|---|
committer | benoit-germain <bnt.germain@gmail.com> | 2011-06-24 01:31:12 -0700 |
commit | 3fb12295e8f858d1052d2fb0aaf0fff092e8cb9a (patch) | |
tree | 7e1e01c36a10ca33395033cb81b3eb6c96367a03 /src/tools.c | |
parent | 513659a6facfc17bc7191c79c4e78d178a076605 (diff) | |
download | lanes-3fb12295e8f858d1052d2fb0aaf0fff092e8cb9a.tar.gz lanes-3fb12295e8f858d1052d2fb0aaf0fff092e8cb9a.tar.bz2 lanes-3fb12295e8f858d1052d2fb0aaf0fff092e8cb9a.zip |
Debug code to check why LuaJIT2-beta8 fails to load the module.
Diffstat (limited to 'src/tools.c')
-rw-r--r-- | src/tools.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/tools.c b/src/tools.c index d475fc0..f9854db 100644 --- a/src/tools.c +++ b/src/tools.c | |||
@@ -890,6 +890,8 @@ static void push_cached_func( lua_State *L2, uint_t L2_cache_i, lua_State *L, ui | |||
890 | } | 890 | } |
891 | 891 | ||
892 | 892 | ||
893 | #define LOG_FUNC_INFO 0 | ||
894 | |||
893 | /* | 895 | /* |
894 | * Copy a function over, which has not been found in the cache. | 896 | * Copy a function over, which has not been found in the cache. |
895 | */ | 897 | */ |
@@ -914,19 +916,20 @@ static void inter_copy_func( lua_State *L2, uint_t L2_cache_i, lua_State *L, uin | |||
914 | size_t sz; | 916 | size_t sz; |
915 | int tmp; | 917 | int tmp; |
916 | const char *name= NULL; | 918 | const char *name= NULL; |
919 | int linedefined = 0; | ||
917 | 920 | ||
918 | #if 0 | 921 | #if LOG_FUNC_INFO |
919 | // "To get information about a function you push it onto the | 922 | // "To get information about a function you push it onto the |
920 | // stack and start the what string with the character '>'." | 923 | // stack and start the what string with the character '>'." |
921 | // | 924 | // |
922 | { lua_Debug ar; | 925 | { lua_Debug ar; |
923 | lua_pushvalue( L, i ); | 926 | lua_pushvalue( L, i ); |
924 | lua_getinfo(L, ">n", &ar); // fills 'name' and 'namewhat', pops function | 927 | lua_getinfo(L, ">nS", &ar); // fills 'name' 'namewhat' and 'linedefined', pops function |
925 | name= ar.namewhat; | 928 | name= ar.namewhat; |
926 | 929 | linedefined = ar.linedefined; | |
927 | fprintf( stderr, "NAME: %s\n", name ); // just gives NULL | 930 | fprintf( stderr, "NAME: %s @ %d\n", ar.short_src, linedefined); // just gives NULL |
928 | } | 931 | } |
929 | #endif | 932 | #endif // LOG_FUNC_INFO |
930 | // 'lua_dump()' needs the function at top of stack | 933 | // 'lua_dump()' needs the function at top of stack |
931 | // | 934 | // |
932 | if (i!=-1) lua_pushvalue( L, i ); | 935 | if (i!=-1) lua_pushvalue( L, i ); |
@@ -960,6 +963,12 @@ static void inter_copy_func( lua_State *L2, uint_t L2_cache_i, lua_State *L, uin | |||
960 | lua_pop(L,1); // remove the dumped string | 963 | lua_pop(L,1); // remove the dumped string |
961 | STACK_MID(L,0) | 964 | STACK_MID(L,0) |
962 | } | 965 | } |
966 | #if LOG_FUNC_INFO | ||
967 | else | ||
968 | { | ||
969 | fprintf( stderr, "NAME: [C] function %p \n", cfunc); | ||
970 | } | ||
971 | #endif // LOG_FUNC_INFO | ||
963 | 972 | ||
964 | /* push over any upvalues; references to this function will come from | 973 | /* push over any upvalues; references to this function will come from |
965 | * cache so we don't end up in eternal loop. | 974 | * cache so we don't end up in eternal loop. |