add debugger_get_current_frame

This commit is contained in:
lixianjing 2023-10-30 17:22:10 +08:00
parent ebb20037b2
commit 0b5f107cf4
4 changed files with 18 additions and 2 deletions

View File

@ -1,6 +1,7 @@
# 最新动态
2023/10/28
* 修复conf\_doc\_dup\_node复制数组的问题(感谢俊杰提供补丁)。
* 增加debugger\_get\_curr\_frame\_index函数(感谢智明提供补丁)
2023/10/28
* 完善edit带格式输入。

View File

@ -310,6 +310,11 @@ tk_object_t* debugger_get_var(debugger_t* debugger, const char* path) {
return debugger->vt->get_var(debugger, path);
}
int32_t debugger_get_current_frame(debugger_t* debugger) {
return_value_if_fail(debugger != NULL && debugger->vt != NULL, -1);
return debugger->current_frame_index;
}
ret_t debugger_set_current_frame(debugger_t* debugger, uint32_t frame_index) {
return_value_if_fail(debugger != NULL && debugger->vt != NULL, RET_BAD_PARAMS);

View File

@ -507,6 +507,16 @@ ret_t debugger_remove_break_point_ex(debugger_t* debugger, const char* position)
*/
tk_object_t* debugger_get_var(debugger_t* debugger, const char* path);
/**
* @method debugger_get_current_frame
*callstack的frame
* >
* @param {debugger_t*} debugger debugger对象
*
* @return {uint32_t} frame序数(0)-1
*/
int32_t debugger_get_current_frame(debugger_t* debugger);
/**
* @method debugger_set_current_frame
* callstack中选择当前的frame

View File

@ -344,7 +344,7 @@ static ret_t func_local(app_info_t* app, tokenizer_t* tokenizer) {
int32_t index = tokenizer_next_int(tokenizer, -1);
if (index < 0) {
index = app->debugger->current_frame_index;
index = debugger_get_current_frame(app->debugger);
}
obj = debugger_get_local(app->debugger, index);
fdb_show_variables("local vars", obj);
@ -458,7 +458,7 @@ static ret_t fdb_show_callstack(app_info_t* app) {
log_debug("callstack:\n---------------------------\n");
while (tokenizer_has_more(&t)) {
const char* func = tokenizer_next(&t);
if (i == app->debugger->current_frame_index) {
if (i == debugger_get_current_frame(app->debugger)) {
log_debug(KGRN "=> [%d] %s\n" KNRM, i, func);
} else {
log_debug(" [%d] %s\n", i, func);