clementfarabet / lua---debugger

Debugger for Lua
1 stars 1 forks source link

Do I miss something? #1

Open Atcold opened 11 years ago

Atcold commented 11 years ago
atcold@Alf ~/Work/Vision/eex/test [stereo*]$ torch
Try the IDE: torch -ide
Type help() for more info
Torch 7.0  Copyright (C) 2001-2011 Idiap, NEC Labs, NYU
Lua 5.1  Copyright (C) 1994-2008 Lua.org, PUC-Rio
t7> require 'debugger'
/Users/atcold/torch/share/torch/lua/debugger/debugger.lua:561: invalid escape sequence near '"[:/'
stack traceback:
    [C]: in function 'dofile'
    /Users/atcold/torch/share/torch/lua/torch/init.lua:34: in function 'include'
    /Users/atcold/torch/share/torch/lua/debugger/init.lua:4: in main chunk
    [C]: in function 'require'
    [string "require 'debugger'"]:1: in main chunk
    [C]: at 0x0102257ef0
t7> 
Atcold commented 11 years ago

Bug found and corrected. I changed the pattern:

"[:/\](.+)$"

in lines 561 and 565 of ~/torch/share/torch/lua/debugger/debugger.lua with:

"[:/\\](.+)$"
Atcold commented 11 years ago

Right... So I required the debugger:

require 'debugger'

and placed the snippet somewhere in my code:

if _DEBUG_ then pause() end 

and this is the outcome ):

torch-qlua: /Users/atcold/torch/share/torch/lua/debugger/debugger.lua:481: bad argument #1 to '(for generator)' (level out of range)
stack traceback:
    /Users/atcold/torch/share/torch/lua/debugger/debugger.lua:1350: in function </Users/atcold/torch/share/torch/lua/debugger/debugger.lua:1349>
    [C]: at 0x01092fee40
    [C]: in function '(for generator)'
    /Users/atcold/torch/share/torch/lua/debugger/debugger.lua:481: in function 'tracestack'
    /Users/atcold/torch/share/torch/lua/debugger/debugger.lua:784: in function '__index'
    test-edgeDetector.lua:64: in main chunk

I am not really understanding what is going on...

jtbates commented 11 years ago

This issue appears to occur only when Torch is compiled with Lua-JIT

clementfarabet commented 11 years ago

Ah thanks for looking into these bugs. LuaJIT doesn't support the \ escaper, for some reason. % must be used instead. So instead of [ , use %[. But it seems you're past this bug.

Atcold commented 11 years ago

Moreover, I am not able of running commands with the < code here > syntax. Also

show line file X Y

seams to have problems... Finally, I am not able to print the local variables... it just shows me:

[debug]> locs
upvalues = {  -- table: 0x7f908db94b70
};

Am I just that unlucky? :/

clementfarabet commented 11 years ago

OK, this debugger has never been tested correctly, and I've never really used it, so I guess it might be quite buggy. It was originally written for Lua 5.0, I think, and then adapted for 5.1. Some has to be done to make sure it does the right thing :-(