Changeset 1bebadee in mainline for kernel/generic/src/debug/symtab.c


Ignore:
Timestamp:
2012-07-18T11:11:29Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c5cbc1b7
Parents:
1f7da3b (diff), 730dce77 (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.
Message:

Merge mainline changes.

Conflict in uspace/lib/drv/generic/dev_iface.c:

Resolved by using c99 method for array initialization for ahci too.

AHCI drivers
kernel console tab completion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/debug/symtab.c

    r1f7da3b r1bebadee  
    4343#include <typedefs.h>
    4444#include <errno.h>
     45#include <console/prompt.h>
    4546
    4647/** Get name of a symbol that seems most likely to correspond to address.
     
    209210 *
    210211 */
    211 int symtab_compl(char *input, size_t size)
     212int symtab_compl(char *input, size_t size, indev_t *indev)
    212213{
    213214#ifdef CONFIG_SYMTAB
     
    227228        char output[MAX_SYMBOL_NAME];
    228229       
     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       
    229242        output[0] = 0;
     243       
     244        while ((hint = symtab_search_one(name, &pos)))
     245                pos++;
     246       
     247        pos = 0;
    230248       
    231249        while ((hint = symtab_search_one(name, &pos))) {
     
    235253                pos++;
    236254                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);
    237265        }
    238266       
     
    241269                pos = 0;
    242270                while (symtab_search_one(name, &pos)) {
    243                         printf("%s\n", symbol_table[pos].symbol_name);
     271                        sym_name = symbol_table[pos].symbol_name;
    244272                        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;
    245293                }
     294               
     295                /* Keep only the characters common in all completions */
     296                output[max_match_len] = 0;
    246297        }
    247298       
Note: See TracChangeset for help on using the changeset viewer.