lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


The lua version used is lua5.1.4
 
 
2016-06-05

cx0cx2001

发件人: cx0cx2001
发送时间: 2016-06-05  22:04:41
收件人: lua-l
抄送:
主题: cannot receive LUA_HOOKTAILRET event of tail call afterdebug.sethook
<code>
function hook(event)
    print(event);
end
 
function test1()
end
 
function test()
    return test1();
end
 
debug.sethook(hook, "cr");         
test();
</code>
 
The output of the above code is following:
call
call
return
 
The count of return hook is not same as the count of call hook.
I found that the return or tailretun event is missing when there is tail call.
Because of this bug, it's impossible to collect the function's execute time(between call hook and return hook) of lua code.
 
2016-06-05

cx0cx2001