Skip to main content



      Home
Home » Archived » Lua Development Tools » Debugging issue with standalone interpreter(DEBUGGER ERROR Command context_get caused: (998) ....osgi\bundles\173\1\.cp\script\external\debugger.lua:187: attempt to call field 'encode' (a nil value))
Debugging issue with standalone interpreter [message #1144886] Sat, 19 October 2013 01:28 Go to next message
Eclipse UserFriend
Hi,

I have been trying to use LDT1.0 for my lua script debugging, but facing issue with debug window. In debug window, when I step into my script, it shows following error on console.

DEBUGGER ERROR Command context_get caused: (998) ....osgi\bundles\173\1\.cp\script\external\debugger.lua:187: attempt to call field 'encode' (a nil value)
stack traceback:
....osgi\bundles\173\1\.cp\script\external\debugger.lua:187: in function 'b64'
....osgi\bundles\173\1\.cp\script\external\debugger.lua:1439: in function <....osgi\bundles\173\1\.cp\script\external\debugger.lua:1423>
(tail call): ?
....osgi\bundles\173\1\.cp\script\external\debugger.lua:636: in function <....osgi\bundles\173\1\.cp\script\external\debugger.lua:625>
(tail call): ?
[C]: in function 'xpcall'
....osgi\bundles\173\1\.cp\script\external\debugger.lua:2548: in function <....osgi\bundles\173\1\.cp\script\external\debugger.lua:2518>
[C]: in function 'pcall'
....osgi\bundles\173\1\.cp\script\external\debugger.lua:2603: in function 'line_hook'
....osgi\bundles\173\1\.cp\script\external\debugger.lua:2627: in function <....osgi\bundles\173\1\.cp\script\external\debugger.lua:2615>



Background:
I created "My custom lua interpreter" in following manner:
1. I downloaded lua 5.1.5 source code(.c/.h) from lua.org/ftp/lua-5.1.5.tar.gz to C:\Source (= SRC)
2. I added some c functions (which will be accessed from my script) in new files my_libc.c. Added necessary changes in lua source files [SRC]to include these c libraries. Then, copied these files to SRC folder
3. Then, downloaded luasocket 2.0.2 source code from
files.luaforge.net/releases/luasocket/luasocket/luasocket-2.0.2
4. Copied all .c/.h from luasocket source folder ( excluding usocket.c, unix.c) (including mime.c) to SRC folder
5. Then added
{"socket.core",luaopen_socket_core},
{"mime.core",luaopen_mime_core},
in lua init.c file in "static const luaL_Reg lualibs[]" table
6.Then build this source project in Visual Studio to generate executable ( my_lua.exe)
Please note, I needed one output file, so I built it statically.

7. Then, I added socket.lua, mime.lua , lnt12.lua from original luasocket folder to my SCRIPT folder,

8. Opened LDT1.0, in debug config, I added my_lua.exe as interpreter and started stepping through, I see stepping through going file. That is script is loaded correctly, but not able to see anything in variable window, variables values are not seen because of aforementioned Error.

Can anyone let me know, where is the issue? How can I see variables used in script.

Thanks,
A lua newbee


Re: Debugging issue with standalone interpreter [message #1148658 is a reply to message #1144886] Mon, 21 October 2013 13:03 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
I just have a look of debugger.lua code and it seems thats line 187 we try to access to the field encode on the mime module and it's a nil value.
Are your sure there are no problem with the way you integrate the mime module of lua socket ?
I don't see any obvious trouble :/
Re: Debugging issue with standalone interpreter [message #1149672 is a reply to message #1148658] Tue, 22 October 2013 04:18 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Simon Bernard,

I have solved the issue in following manner:
1. Changed to luaL_openlib(L, "socket_core", func, 0) in luasocket.c
2. Changed to luaL_openlib(L, "mime_core", func, 0) in mime.c
3. In socket.lua and mime.lua, changed require to "mime_core" and "socket_core".
It worked.

I don't know why debugger.lua couldn't point to mime.encode of mime.lua as it was still looking into interpreter (mime.c APIs) to resolve it.
Re: Debugging issue with standalone interpreter [message #1151705 is a reply to message #1149672] Wed, 23 October 2013 10:42 Go to previous message
Eclipse UserFriend
Wow, it's really weird ! oO
Happy you find a way to workaround the problem, but if you find an explanation I am interested Smile !
Previous Topic:LDT with an external library (winapi.dll)
Next Topic:LDT build failure
Goto Forum:
  


Current Time: Mon Apr 14 19:00:32 EDT 2025

Powered by FUDForum. Page generated in 0.03507 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top