Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 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 05:28 Go to next message
Nitesh R is currently offline Nitesh RFriend
Messages: 4
Registered: October 2013
Junior Member
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 17:03 Go to previous messageGo to next message
Simon Bernard is currently offline Simon BernardFriend
Messages: 288
Registered: July 2009
Senior Member
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 08:18 Go to previous messageGo to next message
Nitesh R is currently offline Nitesh RFriend
Messages: 4
Registered: October 2013
Junior Member
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 14:42 Go to previous message
Simon Bernard is currently offline Simon BernardFriend
Messages: 288
Registered: July 2009
Senior Member
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 Nov 24 12:28:51 GMT 2014

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

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