Changes in kernel/generic/src/debug/symtab.c [7e752b2:aca4a04] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/debug/symtab.c
r7e752b2 raca4a04 43 43 #include <typedefs.h> 44 44 #include <errno.h> 45 #include <console/prompt.h> 45 46 46 47 /** Get name of a symbol that seems most likely to correspond to address. … … 209 210 * 210 211 */ 211 int symtab_compl(char *input, size_t size )212 int symtab_compl(char *input, size_t size, indev_t * indev) 212 213 { 213 214 #ifdef CONFIG_SYMTAB … … 226 227 const char *hint; 227 228 char output[MAX_SYMBOL_NAME]; 229 /* Maximum Match Length : Length of longest matching common substring in 230 case more than one match is found */ 231 size_t max_match_len = size; 232 size_t max_match_len_tmp = size; 233 size_t input_len = str_length(input); 234 char *sym_name; 235 size_t hints_to_show = MAX_TAB_HINTS - 1; 236 size_t total_hints_shown = 0; 237 bool continue_showing_hints = true; 228 238 229 239 output[0] = 0; 240 241 while ((hint = symtab_search_one(name, &pos))) { 242 ++pos; 243 } 244 245 pos = 0; 230 246 231 247 while ((hint = symtab_search_one(name, &pos))) { … … 235 251 pos++; 236 252 found++; 253 } 254 255 /* If possible completions are more than MAX_TAB_HINTS, ask user whether to display them or not. */ 256 if (found > MAX_TAB_HINTS) { 257 printf("\n"); 258 continue_showing_hints = console_prompt_display_all_hints(indev, found); 237 259 } 238 260 … … 241 263 pos = 0; 242 264 while (symtab_search_one(name, &pos)) { 243 printf("%s\n", symbol_table[pos].symbol_name);265 sym_name = symbol_table[pos].symbol_name; 244 266 pos++; 267 268 if (continue_showing_hints) { /* We are still showing hints */ 269 printf("%s\n", sym_name); 270 --hints_to_show; 271 ++total_hints_shown; 272 273 if (hints_to_show == 0 && total_hints_shown != found) { /* Time to ask user to continue */ 274 continue_showing_hints = console_prompt_more_hints(indev, &hints_to_show); 275 } 276 } 277 278 for(max_match_len_tmp = 0; output[max_match_len_tmp] == sym_name[input_len + max_match_len_tmp] 279 && max_match_len_tmp < max_match_len; ++max_match_len_tmp); 280 max_match_len = max_match_len_tmp; 245 281 } 282 /* keep only the characters common in all completions */ 283 output[max_match_len] = 0; 246 284 } 247 285
Note:
See TracChangeset
for help on using the changeset viewer.