diff options
author | zeertzjq <zeertzjq@outlook.com> | 2025-01-07 09:42:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-07 09:42:17 +0800 |
commit | e27f7125d66f6026adacbbad00bbf6e66a6ba883 (patch) | |
tree | eb2a65a2b975f9fcc56e41ee1db6fde66b58d3dd /src/nvim/ex_eval.c | |
parent | 06ff5480ce274daf3b7ad9950a587099200dc8ff (diff) | |
parent | 8fa4306eb910028ee8df8685ae9b1649608c2608 (diff) | |
download | rneovim-e27f7125d66f6026adacbbad00bbf6e66a6ba883.tar.gz rneovim-e27f7125d66f6026adacbbad00bbf6e66a6ba883.tar.bz2 rneovim-e27f7125d66f6026adacbbad00bbf6e66a6ba883.zip |
Merge pull request #31893 from zeertzjq/vim-9.1.0984
vim-patch:9.1.{0984,0991}: getstacktrace(), v:stacktrace
Diffstat (limited to 'src/nvim/ex_eval.c')
-rw-r--r-- | src/nvim/ex_eval.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c index f9936dd88e..18c691d076 100644 --- a/src/nvim/ex_eval.c +++ b/src/nvim/ex_eval.c @@ -479,6 +479,9 @@ static int throw_exception(void *value, except_type_T type, char *cmdname) excp->throw_lnum = SOURCING_LNUM; } + excp->stacktrace = stacktrace_create(); + tv_list_ref(excp->stacktrace); + if (p_verbose >= 13 || debug_break_level > 0) { int save_msg_silent = msg_silent; @@ -563,6 +566,7 @@ static void discard_exception(except_T *excp, bool was_finished) free_msglist(excp->messages); } xfree(excp->throw_name); + tv_list_unref(excp->stacktrace); xfree(excp); } @@ -584,6 +588,7 @@ static void catch_exception(except_T *excp) excp->caught = caught_stack; caught_stack = excp; set_vim_var_string(VV_EXCEPTION, excp->value, -1); + set_vim_var_list(VV_STACKTRACE, excp->stacktrace); if (*excp->throw_name != NUL) { if (excp->throw_lnum != 0) { vim_snprintf(IObuff, IOSIZE, _("%s, line %" PRId64), @@ -633,6 +638,7 @@ static void finish_exception(except_T *excp) caught_stack = caught_stack->caught; if (caught_stack != NULL) { set_vim_var_string(VV_EXCEPTION, caught_stack->value, -1); + set_vim_var_list(VV_STACKTRACE, caught_stack->stacktrace); if (*caught_stack->throw_name != NUL) { if (caught_stack->throw_lnum != 0) { vim_snprintf(IObuff, IOSIZE, @@ -651,6 +657,7 @@ static void finish_exception(except_T *excp) } else { set_vim_var_string(VV_EXCEPTION, NULL, -1); set_vim_var_string(VV_THROWPOINT, NULL, -1); + set_vim_var_list(VV_STACKTRACE, NULL); } // Discard the exception, but use the finish message for 'verbose'. |