[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: remote debugger and upvalues with LUA 5.0a
- From: "Nick Trout" <ntrout@...>
- Date: Wed, 11 Dec 2002 12:45:10 -0800
> I currently have a remote debugger up and running. My problem
> is that in
> some cases I can't properly evaluate expressions.
>
> For example, lets have this script:
>
> --- BEGIN
> local tmp = 3
>
> function f ( n )
> return n + tmp
> end
>
> --END
>
> Then I load this script in memory, lua_dobuffer() it, with a
> breakpoint in
> the body of f(). Then, lets say I want to evaluate tmp. My
> problem is that
> tmp is an upvalue, therefore, when the interface sends a
> query to evaluate
> the expression "return tmp", the debugger stub has no
> information about the
> upvalue name. It only knows that f() has 1 upvalue, that's all.
Could you use luac output? Perhaps when you compile the code you could
keep the output handy in the client/PC side.
Perhaps my VmMerge script may be useful to you:
http://lua-users.org/wiki/VmMerge
From: http://doris.sourceforge.net/lua/weblua.php
instructions/20 bytes at 0x8052af0)
0 params, 2 stacks, 1 local, 1 string, 0 numbers, 1 function, 4 lines
1 [1] PUSHINT 3
2 [5] GETLOCAL 0 ; tmp
3 [5] CLOSURE 0 1 ; 0x8052c70
4 [5] SETGLOBAL 0 ; f
5 [5] END
function <3:@/tmp/wlkeVHJJ> (5 instructions/20 bytes at 0x8052c70)
1 param, 3 stacks, 1 local, 0 strings, 0 numbers, 0 functions, 4 lines
1 [4] GETLOCAL 0 ; n
2 [4] PUSHUPVALUE 0 **** Upvalue ****
3 [4] ADD
4 [4] RETURN 1
5 [5] END
I'm interested in this because I'll be writing a target debugger soon. I
was hoping I might be able to develop the wxWindows one I've been trying
to get going for ages (http://lua-users.org/wiki/VisLua) but it looks
like we're going the MFC route and there may be a lot of project
specific features. I did try and abstract the client and server
functionality so that it could be reused, see
http://lua-users.org/wiki/VisLuaImplementation Code sample allows you to
connect to remote Lua session (but no debugging yet). I got held up with
some bugs in wxWindows though, now they're on 2.3.4, maybe I'll give it
another go when I have some time.
Nick