mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-29 18:48:09 +08:00
improve debugger lldb
This commit is contained in:
parent
02ca43bf84
commit
f37f8592e1
@ -1,7 +1,9 @@
|
||||
# 最新动态
|
||||
|
||||
2024/05/8
|
||||
* 完善value_uint32(感谢华健提供补丁)
|
||||
* 完善fscript iformat(感谢华健提供补丁)
|
||||
* 完善debugger_lldb(感谢智明提供补丁)
|
||||
|
||||
2024/05/7
|
||||
* 修复触摸点击edit子控件button弹出软键盘问题(感谢颖健提供补丁)
|
||||
|
@ -90,6 +90,8 @@
|
||||
#define LLDB_KEY_TERMINATE_DEBUGGEE "terminateDebuggee"
|
||||
#define LLDB_KEY_VARIABLES_REFERENCE "variablesReference"
|
||||
|
||||
#define LLDB_KEY_ST_FIRST_CODE_BREAKPOINTS "stFirstCodeBreakPoints"
|
||||
|
||||
#define VARREF_LOCALS (int64_t)1
|
||||
#define VARREF_GLOBALS (int64_t)2
|
||||
#define VARREF_REGS (int64_t)3
|
||||
@ -133,6 +135,26 @@ static ret_t debugger_lldb_load_init_commands(debugger_lldb_t* lldb, conf_node_t
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t debugger_lldb_load_st_first_code_breakpoints(debugger_lldb_t* lldb, conf_node_t* node) {
|
||||
conf_node_t* iter = conf_node_get_first_child(node);
|
||||
object_array_clear_props(lldb->st_first_code_breakpoints);
|
||||
|
||||
while (iter != NULL) {
|
||||
value_t v;
|
||||
if (conf_node_get_value(iter, &v) == RET_OK) {
|
||||
const char* cmd = value_str(&v);
|
||||
if (cmd != NULL) {
|
||||
log_debug("init command: %s\n", cmd);
|
||||
object_array_push(lldb->st_first_code_breakpoints, value_set_str(&v, cmd));
|
||||
}
|
||||
}
|
||||
|
||||
iter = iter->next;
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t debugger_lldb_load_target_create_commands_commands(debugger_lldb_t* lldb,
|
||||
conf_node_t* node) {
|
||||
conf_node_t* iter = conf_node_get_first_child(node);
|
||||
@ -167,11 +189,16 @@ static ret_t debugger_lldb_load_config(debugger_t* debugger, const char* filenam
|
||||
if (doc != NULL) {
|
||||
lldb->timeout = conf_doc_get_int(doc, "timeout", 3000);
|
||||
log_debug("timeout:%d\n", lldb->timeout);
|
||||
node = conf_node_find_child(doc->root, "initCommands");
|
||||
node = conf_node_find_child(doc->root, LLDB_KEY_INIT_COMMANDS);
|
||||
if (node != NULL) {
|
||||
ret = debugger_lldb_load_init_commands(lldb, node);
|
||||
}
|
||||
|
||||
node = conf_node_find_child(doc->root, LLDB_KEY_ST_FIRST_CODE_BREAKPOINTS);
|
||||
if (node != NULL) {
|
||||
ret = debugger_lldb_load_st_first_code_breakpoints(lldb, node);
|
||||
}
|
||||
|
||||
node = conf_node_find_child(doc->root, "targetCreateCommands");
|
||||
if (node != NULL) {
|
||||
ret = debugger_lldb_load_target_create_commands_commands(lldb, node);
|
||||
@ -532,6 +559,7 @@ static ret_t debugger_lldb_init(debugger_t* debugger) {
|
||||
ret = debugger_lldb_dispatch_until_get_resp_simple(debugger, LLDB_CMD_INITIALIZE, LLDB_REQUEST_TIMEOUT);
|
||||
}
|
||||
lldb->init_commands = object_array_create();
|
||||
lldb->st_first_code_breakpoints = object_array_create();
|
||||
lldb->target_create_commands = object_array_create();
|
||||
TK_OBJECT_UNREF(req);
|
||||
|
||||
@ -612,6 +640,10 @@ static tk_object_t* debugger_lldb_create_launch_req(debugger_t* debugger, const
|
||||
tk_object_set_prop_object(arguments, LLDB_KEY_INIT_COMMANDS, lldb->init_commands);
|
||||
}
|
||||
|
||||
if (lldb->st_first_code_breakpoints != NULL) {
|
||||
tk_object_set_prop_object(arguments, LLDB_KEY_ST_FIRST_CODE_BREAKPOINTS, lldb->st_first_code_breakpoints);
|
||||
}
|
||||
|
||||
TK_OBJECT_UNREF(args);
|
||||
TK_OBJECT_UNREF(arguments);
|
||||
|
||||
@ -695,6 +727,9 @@ static tk_object_t* debugger_lldb_create_attach_req(debugger_t* debugger, const
|
||||
if (lldb->init_commands != NULL) {
|
||||
tk_object_set_prop_object(arguments, LLDB_KEY_INIT_COMMANDS, lldb->init_commands);
|
||||
}
|
||||
if (lldb->st_first_code_breakpoints != NULL) {
|
||||
tk_object_set_prop_object(arguments, LLDB_KEY_ST_FIRST_CODE_BREAKPOINTS, lldb->st_first_code_breakpoints);
|
||||
}
|
||||
|
||||
return req;
|
||||
error:
|
||||
@ -1543,6 +1578,7 @@ static ret_t debugger_lldb_on_destroy(tk_object_t* obj) {
|
||||
TK_OBJECT_UNREF(lldb->sources);
|
||||
TK_OBJECT_UNREF(lldb->callstack);
|
||||
TK_OBJECT_UNREF(lldb->init_commands);
|
||||
TK_OBJECT_UNREF(lldb->st_first_code_breakpoints);
|
||||
TK_OBJECT_UNREF(lldb->target_create_commands);
|
||||
TK_OBJECT_UNREF(lldb->source_break_points);
|
||||
TK_OBJECT_UNREF(lldb->resps);
|
||||
|
@ -71,6 +71,8 @@ typedef struct _debugger_lldb_t {
|
||||
tk_object_t* source_break_points;
|
||||
tk_object_t* init_commands;
|
||||
tk_object_t* target_create_commands;
|
||||
/* st 特有的首行代码断点 */
|
||||
tk_object_t* st_first_code_breakpoints;
|
||||
uint32_t timeout;
|
||||
} debugger_lldb_t;
|
||||
|
||||
|
@ -1,20 +1,15 @@
|
||||
import os
|
||||
import lldb
|
||||
|
||||
if not 'AWPLC_USER_FUNCTIONS' in os.environ:
|
||||
os.environ["AWPLC_USER_FUNCTIONS"] = "awplc_user_functions.txt"
|
||||
|
||||
if os.path.isfile(os.environ["AWPLC_USER_FUNCTIONS"]) == False:
|
||||
print("File awplc_user_functions.txt not found")
|
||||
|
||||
class StopHook:
|
||||
def __init__(self, target, extra_args1, extra_args2):
|
||||
self.target = target
|
||||
|
||||
def handle_stop(self, exe_ctx, stream):
|
||||
name = exe_ctx.GetFrame().GetFunctionName()
|
||||
print('stop in: ' + name);
|
||||
if name.find('AWPLC_APP::') != -1:
|
||||
return True
|
||||
if name != None :
|
||||
print('stop in: ' + name);
|
||||
if name.find('AWPLC_APP::') != -1:
|
||||
return True
|
||||
return False
|
||||
print('load awplc.py');
|
||||
print('load awplc.py');
|
@ -2,7 +2,11 @@
|
||||
"timeout": 3000,
|
||||
"initCommands": [
|
||||
"command script import \"/Users/jim/work/awtk-root/awtk/tools/fdb/awplc.py\"",
|
||||
"target stop-hook add -P awplc.StopHook"
|
||||
"target stop-hook add -P awplc.StopHook",
|
||||
"environment AWPLC_USER_FUNCTIONS:/Users/jim/work/awtk-root/awplc/wasm-rt/awplc_user_functions.txt"
|
||||
],
|
||||
"stFirstCodeBreakPoints" : [
|
||||
"/Users/jim/work/awtk-root/awplc/wasm-rt/src/main.st:5"
|
||||
],
|
||||
"targetCreateCommands": [
|
||||
"process connect -p wasm connect://192.168.31.87:1234",
|
||||
|
Loading…
Reference in New Issue
Block a user