improve debugger event

This commit is contained in:
lixianjing 2024-04-01 11:12:42 +08:00
parent eac8b173e4
commit c549de6ee1
5 changed files with 20 additions and 4 deletions

View File

@ -1,4 +1,9 @@
# 最新动态
2024/04/01
* 增加 debugger 的中断事件对象的函数名字属性(感谢智明提供补丁)
* 完善 debugger_lldb 的timeout支持从配置文件读取。
2024/03/28
* object array vtable增加clone函数(感谢兆坤提供补丁)
* 修改鼠标滚动事件通知逻辑以及修改滚动条的滚动事件逻辑(感谢智明提供补丁)

View File

@ -72,7 +72,7 @@ static ret_t debugger_client_dispatch_message(debugger_t* debugger, debugger_res
line = tk_object_get_prop_int(obj, STR_DEBUGGER_EVENT_PROP_LINE, 0);
file_path = tk_object_get_prop_str(obj, STR_DEBUGGER_EVENT_PROP_FILE_PATH);
debugger_set_state(debugger, DEBUGGER_PROGRAM_STATE_PAUSED);
emitter_dispatch(EMITTER(debugger), debugger_breaked_event_init_ex(&event, line, file_path));
emitter_dispatch(EMITTER(debugger), debugger_breaked_event_init_ex(&event, line, file_path, NULL));
TK_OBJECT_UNREF(obj);
break;
}

View File

@ -280,18 +280,20 @@ static ret_t debugger_lldb_emit(debugger_t* debugger, tk_object_t* resp) {
int32_t line = 0;
int64_t stop_thread_id = 0;
const char* file_path = NULL;
const char* frame_name = NULL;
debugger_breaked_event_t event;
TK_OBJECT_UNREF(lldb->callstack);
stop_thread_id = tk_object_get_prop_int64(resp, "body.threadId", 0);
debugger_lldb_set_current_thread_id(debugger, stop_thread_id);
lldb->callstack = debugger_lldb_get_callstack_impl(debugger, 0, 100);
frame_name = debugger_lldb_get_frame_name(debugger, debugger->current_frame_index);
file_path = debugger_lldb_get_source_path(debugger, debugger->current_frame_index);
debugger_set_state(debugger, DEBUGGER_PROGRAM_STATE_PAUSED);
debugger_set_current_frame(debugger, 0);
/*LLDB 行号从1开始*/
line = lldb->current_frame_line - 1;
emitter_dispatch(EMITTER(debugger), debugger_breaked_event_init_ex(&event, line, file_path));
emitter_dispatch(EMITTER(debugger), debugger_breaked_event_init_ex(&event, line, file_path, frame_name));
log_debug("threadId = %"PRIu64" stopped\n", (uint64_t)stop_thread_id);
} else if (tk_str_eq(event, LLDB_EVENT_OUTPUT)) {

View File

@ -72,7 +72,7 @@ event_t* debugger_breaked_event_init(debugger_breaked_event_t* event, uint32_t l
}
event_t* debugger_breaked_event_init_ex(debugger_breaked_event_t* event, uint32_t line,
const char* file_path) {
const char* file_path, const char* frame_name) {
return_value_if_fail(event != NULL, NULL);
memset(event, 0x00, sizeof(*event));
@ -80,6 +80,7 @@ event_t* debugger_breaked_event_init_ex(debugger_breaked_event_t* event, uint32_
event->e.size = sizeof(*event);
event->line = line;
event->file_path = file_path;
event->frame_name = frame_name;
return (event_t*)event;
}

View File

@ -465,6 +465,13 @@ typedef struct _debugger_breaked_event_t {
*
*/
const char* file_path;
/**
* @property {const char*} frame_name
* @annotation ["readable"]
*
*/
const char* frame_name;
} debugger_breaked_event_t;
/**
@ -485,11 +492,12 @@ event_t* debugger_breaked_event_init(debugger_breaked_event_t* event, uint32_t l
* @param {debugger_breaked_event_t*} event event对象
* @param {uint32_t} line
* @param {const char*} file_path
* @param {const char*} frame_name
*
* @return {event_t*} event对象
*/
event_t* debugger_breaked_event_init_ex(debugger_breaked_event_t* event, uint32_t line,
const char* file_path);
const char* file_path, const char* frame_name);
/**
* @method debugger_breaked_event_cast