Changeset da68871a in mainline for kernel/generic/src/debug/symtab.c
- Timestamp:
- 2012-08-08T08:46:22Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 30c0826
- Parents:
- bc216a0 (diff), 1d01cca (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/debug/symtab.c
rbc216a0 rda68871a 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 … … 227 228 char output[MAX_SYMBOL_NAME]; 228 229 230 /* 231 * Maximum Match Length: Length of longest matching common substring in 232 * case more than one match is found. 233 */ 234 size_t max_match_len = size; 235 size_t max_match_len_tmp = size; 236 size_t input_len = str_length(input); 237 char *sym_name; 238 size_t hints_to_show = MAX_TAB_HINTS - 1; 239 size_t total_hints_shown = 0; 240 bool continue_showing_hints = true; 241 229 242 output[0] = 0; 243 244 while ((hint = symtab_search_one(name, &pos))) 245 pos++; 246 247 pos = 0; 230 248 231 249 while ((hint = symtab_search_one(name, &pos))) { … … 235 253 pos++; 236 254 found++; 255 } 256 257 /* 258 * If the number of possible completions is more than MAX_TAB_HINTS, 259 * ask the user whether to display them or not. 260 */ 261 if (found > MAX_TAB_HINTS) { 262 printf("\n"); 263 continue_showing_hints = 264 console_prompt_display_all_hints(indev, found); 237 265 } 238 266 … … 241 269 pos = 0; 242 270 while (symtab_search_one(name, &pos)) { 243 printf("%s\n", symbol_table[pos].symbol_name);271 sym_name = symbol_table[pos].symbol_name; 244 272 pos++; 273 274 if (continue_showing_hints) { 275 /* We are still showing hints */ 276 printf("%s\n", sym_name); 277 --hints_to_show; 278 ++total_hints_shown; 279 280 if ((hints_to_show == 0) && (total_hints_shown != found)) { 281 /* Ask the user to continue */ 282 continue_showing_hints = 283 console_prompt_more_hints(indev, &hints_to_show); 284 } 285 } 286 287 for (max_match_len_tmp = 0; 288 (output[max_match_len_tmp] == 289 sym_name[input_len + max_match_len_tmp]) && 290 (max_match_len_tmp < max_match_len); ++max_match_len_tmp); 291 292 max_match_len = max_match_len_tmp; 245 293 } 294 295 /* Keep only the characters common in all completions */ 296 output[max_match_len] = 0; 246 297 } 247 298
Note:
See TracChangeset
for help on using the changeset viewer.