This commit is contained in:
blueloveTH 2025-10-07 21:48:34 +08:00
parent bd3ace340a
commit 4a62244352
3 changed files with 5 additions and 5 deletions

View File

@ -664,7 +664,7 @@ PK_API void py_debugger_exceptionbreakpoint(py_Ref exc);
PK_API void py_debugger_exit(int code); PK_API void py_debugger_exit(int code);
#else #else
#define py_debugger_waitforattach(hostname, port) #define py_debugger_waitforattach(hostname, port)
#define py_debugger_isattached() (false) #define py_debugger_status() 0
#define py_debugger_exceptionbreakpoint(exc) #define py_debugger_exceptionbreakpoint(exc)
#define py_debugger_exit(code) #define py_debugger_exit(code)
#endif #endif

View File

@ -116,7 +116,7 @@ __NEXT_STEP:
#if PK_ENABLE_WATCHDOG #if PK_ENABLE_WATCHDOG
if(self->watchdog_info.max_reset_time > 0) { if(self->watchdog_info.max_reset_time > 0) {
if(!py_debugger_isattached() && clock() > self->watchdog_info.max_reset_time) { if(py_debugger_status() != 0 && clock() > self->watchdog_info.max_reset_time) {
self->watchdog_info.max_reset_time = 0; self->watchdog_info.max_reset_time = 0;
TimeoutError("watchdog timeout"); TimeoutError("watchdog timeout");
goto __ERROR; goto __ERROR;

View File

@ -12,7 +12,7 @@ void py_BaseException__stpush(py_Frame* frame,
int lineno, int lineno,
const char* func_name) { const char* func_name) {
BaseException* ud = py_touserdata(self); BaseException* ud = py_touserdata(self);
int max_frame_dumps = py_debugger_isattached() ? 31 : 7; int max_frame_dumps = py_debugger_status() == 1 ? 31 : 7;
if(ud->stacktrace.length >= max_frame_dumps) return; if(ud->stacktrace.length >= max_frame_dumps) return;
BaseExceptionFrame* frame_dump = c11_vector__emplace(&ud->stacktrace); BaseExceptionFrame* frame_dump = c11_vector__emplace(&ud->stacktrace);
PK_INCREF(src); PK_INCREF(src);
@ -20,7 +20,7 @@ void py_BaseException__stpush(py_Frame* frame,
frame_dump->lineno = lineno; frame_dump->lineno = lineno;
frame_dump->name = func_name ? c11_string__new(func_name) : NULL; frame_dump->name = func_name ? c11_string__new(func_name) : NULL;
if(py_debugger_isattached()) { if(py_debugger_status() == 1) {
if(frame != NULL) { if(frame != NULL) {
py_Frame_newlocals(frame, &frame_dump->locals); py_Frame_newlocals(frame, &frame_dump->locals);
py_Frame_newglobals(frame, &frame_dump->globals); py_Frame_newglobals(frame, &frame_dump->globals);
@ -225,7 +225,7 @@ char* py_formatexc() {
VM* vm = pk_current_vm; VM* vm = pk_current_vm;
if(py_isnil(&vm->unhandled_exc)) return NULL; if(py_isnil(&vm->unhandled_exc)) return NULL;
char* res = formatexc_internal(&vm->unhandled_exc); char* res = formatexc_internal(&vm->unhandled_exc);
if(py_debugger_isattached()) py_debugger_exceptionbreakpoint(&vm->unhandled_exc); if(py_debugger_status() == 1) py_debugger_exceptionbreakpoint(&vm->unhandled_exc);
return res; return res;
} }