From 897bc0be81740f1048736f414a1d855784f64049 Mon Sep 17 00:00:00 2001 From: lightovernight <119399319+lightovernight@users.noreply.github.com> Date: Sun, 31 Aug 2025 18:52:05 +0800 Subject: [PATCH] Fix bug : reference invalid (#393) * fix an fatal error * fix bug : rerefrence invaild * implement better exception support --- src/debugger/core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/debugger/core.c b/src/debugger/core.c index 56432400..d4aeb485 100644 --- a/src/debugger/core.c +++ b/src/debugger/core.c @@ -114,6 +114,8 @@ void c11_debugger_exception_on_trace(py_Ref exc) { debugger.current_excname = name; debugger.current_excmessage = message; clear_structures(); + py_assign(py_list_getitem(python_vars, 0), exc); + py_clearexc(NULL); } const char* c11_debugger_excinfo(const char** message) { @@ -178,6 +180,8 @@ bool c11_debugger_path_equal(const char* path1, const char* path2) { C11_STOP_REASON c11_debugger_should_pause() { if(debugger.current_event == TRACE_EVENT_POP && !debugger.isexceptionmode) return C11_DEBUGGER_NOSTOP; + if(py_checkexc() && debugger.isexceptionmode == false) + return C11_DEBUGGER_NOSTOP; C11_STOP_REASON pause_resaon = C11_DEBUGGER_NOSTOP; int is_out = debugger.curr_stack_depth <= debugger.pause_allowed_depth; int is_new_line = debugger.current_line != debugger.step_line; @@ -282,8 +286,8 @@ inline static c11_debugger_scope_index append_new_scope(int frameid) { py_Frame* requested_frame = c11__getitem(py_Frame*, &debugger.py_frames, frameid); int base_index = py_list_len(python_vars); py_Ref new_locals = py_list_emplace(python_vars); - py_Ref new_globals = py_list_emplace(python_vars); py_Frame_newlocals(requested_frame, new_locals); + py_Ref new_globals = py_list_emplace(python_vars); py_Frame_newglobals(requested_frame, new_globals); c11_debugger_scope_index result = {.locals_ref = base_index, .globals_ref = base_index + 1}; return result;