replace 'debug.breakpoint' with 'debug.pause'
This commit is contained in:
parent
8f56969997
commit
4f6a443fa3
@ -39,7 +39,7 @@ debug.sethook(function (e, line)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
current_func = func
|
current_func = func
|
||||||
debug.breakpoint()
|
debug.pause()
|
||||||
debug.pull_events()
|
debug.pull_events()
|
||||||
end
|
end
|
||||||
hook_lock = false
|
hook_lock = false
|
||||||
@ -53,7 +53,7 @@ debug.sethook(function (e, line)
|
|||||||
end
|
end
|
||||||
current_func = _debug_getinfo(2).func
|
current_func = _debug_getinfo(2).func
|
||||||
current_func_stack_size = calc_stack_size()
|
current_func_stack_size = calc_stack_size()
|
||||||
debug.breakpoint()
|
debug.pause()
|
||||||
debug.pull_events()
|
debug.pull_events()
|
||||||
end, "lr")
|
end, "lr")
|
||||||
|
|
||||||
@ -65,6 +65,7 @@ local DBG_EVENT_RESUME = 5
|
|||||||
local DBG_EVENT_GET_VALUE = 6
|
local DBG_EVENT_GET_VALUE = 6
|
||||||
local __pull_events = debug.__pull_events
|
local __pull_events = debug.__pull_events
|
||||||
local __sendvalue = debug.__sendvalue
|
local __sendvalue = debug.__sendvalue
|
||||||
|
local __pause = debug.pause
|
||||||
debug.__pull_events = nil
|
debug.__pull_events = nil
|
||||||
debug.__sendvalue = nil
|
debug.__sendvalue = nil
|
||||||
|
|
||||||
@ -97,6 +98,7 @@ function debug.pull_events()
|
|||||||
value = value[key]
|
value = value[key]
|
||||||
end
|
end
|
||||||
__sendvalue(value, event[2], event[3], event[4])
|
__sendvalue(value, event[2], event[3], event[4])
|
||||||
|
__pause()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -213,15 +213,17 @@ bool DebuggingServer::performCommand(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggingServer::onHitBreakpoint(dv::value&& stackTrace) {
|
void DebuggingServer::pause(std::string&& message, dv::value&& stackTrace) {
|
||||||
if (connection == nullptr) {
|
if (connection == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
connection->send(dv::object({
|
if (stackTrace != nullptr) {
|
||||||
{"type", std::string("hit-breakpoint")},
|
connection->send(dv::object({
|
||||||
{"stack", std::move(stackTrace)}
|
{"type", std::string("hit-breakpoint")},
|
||||||
}));
|
{"message", std::move(message)},
|
||||||
|
{"stack", std::move(stackTrace)}
|
||||||
|
}));
|
||||||
|
}
|
||||||
engine.startPauseLoop();
|
engine.startPauseLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,10 +247,6 @@ void DebuggingServer::sendValue(
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggingServer::pause() {
|
|
||||||
engine.startPauseLoop();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggingServer::setClient(u64id_t client) {
|
void DebuggingServer::setClient(u64id_t client) {
|
||||||
this->connection =
|
this->connection =
|
||||||
std::make_unique<ClientConnection>(engine.getNetwork(), client);
|
std::make_unique<ClientConnection>(engine.getNetwork(), client);
|
||||||
|
|||||||
@ -73,8 +73,7 @@ namespace devtools {
|
|||||||
~DebuggingServer();
|
~DebuggingServer();
|
||||||
|
|
||||||
bool update();
|
bool update();
|
||||||
void onHitBreakpoint(dv::value&& stackTrace);
|
void pause(std::string&& message, dv::value&& stackTrace);
|
||||||
void pause();
|
|
||||||
|
|
||||||
void sendValue(dv::value&& value, int frame, int local, ValuePath&& path);
|
void sendValue(dv::value&& value, int frame, int local, ValuePath&& path);
|
||||||
|
|
||||||
|
|||||||
@ -262,9 +262,13 @@ static dv::value create_stack_trace(lua::State* L, int initFrame = 2) {
|
|||||||
return entriesList;
|
return entriesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int l_debug_breakpoint(lua::State* L) {
|
static int l_debug_pause(lua::State* L) {
|
||||||
if (auto server = engine->getDebuggingServer()) {
|
if (auto server = engine->getDebuggingServer()) {
|
||||||
server->onHitBreakpoint(create_stack_trace(L));
|
std::string message;
|
||||||
|
if (lua::isstring(L, 1)) {
|
||||||
|
message = lua::tolstring(L, 1);
|
||||||
|
}
|
||||||
|
server->pause(std::move(message), create_stack_trace(L));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -376,8 +380,8 @@ void initialize_libs_extends(lua::State* L) {
|
|||||||
lua::pushcfunction(L, lua::wrap<l_debug_print>);
|
lua::pushcfunction(L, lua::wrap<l_debug_print>);
|
||||||
lua::setfield(L, "print");
|
lua::setfield(L, "print");
|
||||||
|
|
||||||
lua::pushcfunction(L, lua::wrap<l_debug_breakpoint>);
|
lua::pushcfunction(L, lua::wrap<l_debug_pause>);
|
||||||
lua::setfield(L, "breakpoint");
|
lua::setfield(L, "pause");
|
||||||
|
|
||||||
lua::pushcfunction(L, lua::wrap<l_debug_pull_events>);
|
lua::pushcfunction(L, lua::wrap<l_debug_pull_events>);
|
||||||
lua::setfield(L, "__pull_events");
|
lua::setfield(L, "__pull_events");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user