feat: pause on exception caused by 'error' function call
This commit is contained in:
parent
ddc56b46ce
commit
972181022a
@ -8,6 +8,7 @@ local current_func_stack_size
|
||||
local _debug_getinfo = debug.getinfo
|
||||
local _debug_getlocal = debug.getlocal
|
||||
local __pause = debug.pause
|
||||
local __error = error
|
||||
|
||||
-- 'return' hook not called for some functions
|
||||
-- todo: speedup
|
||||
@ -120,6 +121,11 @@ function debug.remove_breakpoint(source, line)
|
||||
bps[source] = nil
|
||||
end
|
||||
|
||||
function error(message, level)
|
||||
__pause("paused on exception: " .. message)
|
||||
__error(message, level)
|
||||
end
|
||||
|
||||
-- Lua has no parallelizm, also _set_data does not call any lua functions so
|
||||
-- may be reused one global ffi buffer per lua_State
|
||||
local canvas_ffi_buffer
|
||||
|
||||
@ -188,22 +188,26 @@ static std::string get_short_value(lua::State* L, int idx, int type) {
|
||||
return "{...}";
|
||||
case LUA_TFUNCTION: {
|
||||
std::stringstream ss;
|
||||
ss << "function: 0x" << std::hex << lua::topointer(L, idx);
|
||||
ss << "function: 0x" << std::hex
|
||||
<< reinterpret_cast<ptrdiff_t>(lua::topointer(L, idx));
|
||||
return ss.str();
|
||||
}
|
||||
case LUA_TUSERDATA: {
|
||||
std::stringstream ss;
|
||||
ss << "userdata: 0x" << std::hex << lua::topointer(L, idx);
|
||||
ss << "userdata: 0x" << std::hex
|
||||
<< reinterpret_cast<ptrdiff_t>(lua::topointer(L, idx));
|
||||
return ss.str();
|
||||
}
|
||||
case LUA_TTHREAD: {
|
||||
std::stringstream ss;
|
||||
ss << "thread: 0x" << std::hex << lua::topointer(L, idx);
|
||||
ss << "thread: 0x" << std::hex
|
||||
<< reinterpret_cast<ptrdiff_t>(lua::topointer(L, idx));
|
||||
return ss.str();
|
||||
}
|
||||
default: {
|
||||
std::stringstream ss;
|
||||
ss << "cdata: 0x" << std::hex << lua::topointer(L, idx);
|
||||
ss << "cdata: 0x" << std::hex
|
||||
<< reinterpret_cast<ptrdiff_t>(lua::topointer(L, idx));
|
||||
return ss.str();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user