Mercurial > vim
comparison src/eval.c @ 7605:8fc60af6dbf5 v7.4.1102
commit https://github.com/vim/vim/commit/f1f60f859cdbb2638b3662ccf7b1d179865fe7dc
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 16 15:40:53 2016 +0100
patch 7.4.1102
Problem: Debugger has no stack backtrace support.
Solution: Add "backtrace", "frame", "up" and "down" commands. (Alberto
Fanjul, closes https://github.com/vim/vim/issues/433)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 16 Jan 2016 15:45:04 +0100 |
parents | fa59fafb6a94 |
children | 9c420b8db435 |
comparison
equal
deleted
inserted
replaced
7604:09a1aca8d980 | 7605:8fc60af6dbf5 |
---|---|
810 static char_u *get_tv_string_buf __ARGS((typval_T *varp, char_u *buf)); | 810 static char_u *get_tv_string_buf __ARGS((typval_T *varp, char_u *buf)); |
811 static char_u *get_tv_string_buf_chk __ARGS((typval_T *varp, char_u *buf)); | 811 static char_u *get_tv_string_buf_chk __ARGS((typval_T *varp, char_u *buf)); |
812 static dictitem_T *find_var __ARGS((char_u *name, hashtab_T **htp, int no_autoload)); | 812 static dictitem_T *find_var __ARGS((char_u *name, hashtab_T **htp, int no_autoload)); |
813 static dictitem_T *find_var_in_ht __ARGS((hashtab_T *ht, int htname, char_u *varname, int no_autoload)); | 813 static dictitem_T *find_var_in_ht __ARGS((hashtab_T *ht, int htname, char_u *varname, int no_autoload)); |
814 static hashtab_T *find_var_ht __ARGS((char_u *name, char_u **varname)); | 814 static hashtab_T *find_var_ht __ARGS((char_u *name, char_u **varname)); |
815 static funccall_T *get_funccal __ARGS((void)); | |
815 static void vars_clear_ext __ARGS((hashtab_T *ht, int free_val)); | 816 static void vars_clear_ext __ARGS((hashtab_T *ht, int free_val)); |
816 static void delete_var __ARGS((hashtab_T *ht, hashitem_T *hi)); | 817 static void delete_var __ARGS((hashtab_T *ht, hashitem_T *hi)); |
817 static void list_one_var __ARGS((dictitem_T *v, char_u *prefix, int *first)); | 818 static void list_one_var __ARGS((dictitem_T *v, char_u *prefix, int *first)); |
818 static void list_one_var_a __ARGS((char_u *prefix, char_u *name, int type, char_u *string, int *first)); | 819 static void list_one_var_a __ARGS((char_u *prefix, char_u *name, int type, char_u *string, int *first)); |
819 static void set_var __ARGS((char_u *name, typval_T *varp, int copy)); | 820 static void set_var __ARGS((char_u *name, typval_T *varp, int copy)); |
21733 if (!HASHITEM_EMPTY(hi)) | 21734 if (!HASHITEM_EMPTY(hi)) |
21734 return &compat_hashtab; | 21735 return &compat_hashtab; |
21735 | 21736 |
21736 if (current_funccal == NULL) | 21737 if (current_funccal == NULL) |
21737 return &globvarht; /* global variable */ | 21738 return &globvarht; /* global variable */ |
21738 return ¤t_funccal->l_vars.dv_hashtab; /* l: variable */ | 21739 return &get_funccal()->l_vars.dv_hashtab; /* l: variable */ |
21739 } | 21740 } |
21740 *varname = name + 2; | 21741 *varname = name + 2; |
21741 if (*name == 'g') /* global variable */ | 21742 if (*name == 'g') /* global variable */ |
21742 return &globvarht; | 21743 return &globvarht; |
21743 /* There must be no ':' or '#' in the rest of the name, unless g: is used | 21744 /* There must be no ':' or '#' in the rest of the name, unless g: is used |
21754 return &curtab->tp_vars->dv_hashtab; | 21755 return &curtab->tp_vars->dv_hashtab; |
21755 #endif | 21756 #endif |
21756 if (*name == 'v') /* v: variable */ | 21757 if (*name == 'v') /* v: variable */ |
21757 return &vimvarht; | 21758 return &vimvarht; |
21758 if (*name == 'a' && current_funccal != NULL) /* function argument */ | 21759 if (*name == 'a' && current_funccal != NULL) /* function argument */ |
21759 return ¤t_funccal->l_avars.dv_hashtab; | 21760 return &get_funccal()->l_avars.dv_hashtab; |
21760 if (*name == 'l' && current_funccal != NULL) /* local function variable */ | 21761 if (*name == 'l' && current_funccal != NULL) /* local function variable */ |
21761 return ¤t_funccal->l_vars.dv_hashtab; | 21762 return &get_funccal()->l_vars.dv_hashtab; |
21762 if (*name == 's' /* script variable */ | 21763 if (*name == 's' /* script variable */ |
21763 && current_SID > 0 && current_SID <= ga_scripts.ga_len) | 21764 && current_SID > 0 && current_SID <= ga_scripts.ga_len) |
21764 return &SCRIPT_VARS(current_SID); | 21765 return &SCRIPT_VARS(current_SID); |
21765 return NULL; | 21766 return NULL; |
21767 } | |
21768 | |
21769 /* | |
21770 * Get function call environment based on bactrace debug level | |
21771 */ | |
21772 static funccall_T * | |
21773 get_funccal() | |
21774 { | |
21775 int i; | |
21776 funccall_T *funccal; | |
21777 funccall_T *temp_funccal; | |
21778 | |
21779 funccal = current_funccal; | |
21780 if (debug_backtrace_level > 0) | |
21781 { | |
21782 for (i = 0; i < debug_backtrace_level; i++) | |
21783 { | |
21784 temp_funccal = funccal->caller; | |
21785 if (temp_funccal) | |
21786 funccal = temp_funccal; | |
21787 else | |
21788 /* backtrace level overflow. reset to max */ | |
21789 debug_backtrace_level = i; | |
21790 } | |
21791 } | |
21792 return funccal; | |
21766 } | 21793 } |
21767 | 21794 |
21768 /* | 21795 /* |
21769 * Get the string value of a (global/local) variable. | 21796 * Get the string value of a (global/local) variable. |
21770 * Note: see get_tv_string() for how long the pointer remains valid. | 21797 * Note: see get_tv_string() for how long the pointer remains valid. |