Ignore:
Timestamp:
2009-03-17T20:33:18Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5eb90cb
Parents:
b1c8dc0
Message:

Make optionality of symbol information less intrusive per Jakub's request. Also, improve symtab function names and update their semantics.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/kconsole.c

    rb1c8dc0 re16e0d59  
    5454#include <sysinfo/sysinfo.h>
    5555#include <ddi/device.h>
    56 
    57 #ifdef CONFIG_SYMTAB
    5856#include <symtab.h>
    59 #endif
     57#include <errno.h>
    6058
    6159/** Simple kernel console.
     
    350348                                found = cmdtab_compl(tmp);
    351349                        } else { /* Symtab completion */
    352 #ifdef CONFIG_SYMTAB
    353350                                found = symtab_compl(tmp);
    354 #else
    355                                 found = 0;
    356 #endif
    357351                        }
    358352
     
    525519        bool isaddr = false;
    526520        bool isptr = false;
    527 
    528 #ifdef CONFIG_SYMTAB
     521        int rc;
     522
    529523        static char symname[MAX_SYMBOL_NAME];
    530 #endif
    531524       
    532525        /* If we get a name, try to find it in symbol table */
     
    541534        }
    542535        if (text[0] < '0' || text[0] > '9') {
    543 #ifdef CONFIG_SYMTAB
    544536                strncpy(symname, text, min(len + 1, MAX_SYMBOL_NAME));
    545                 symaddr = get_symbol_addr(symname);
    546                 if (!symaddr) {
     537                rc = symtab_addr_lookup(symname, &symaddr);
     538                switch (rc) {
     539                case ENOENT:
    547540                        printf("Symbol %s not found.\n", symname);
    548541                        return -1;
    549                 }
    550                 if (symaddr == (uintptr_t) -1) {
     542                case EOVERFLOW:
    551543                        printf("Duplicate symbol %s.\n", symname);
    552544                        symtab_print_search(symname);
    553545                        return -1;
    554                 }
    555 #else
    556                 symaddr = 0;
    557 #endif
     546                default:
     547                        printf("No symbol information available.\n");
     548                        return -1;
     549                }
     550
    558551                if (isaddr)
    559552                        *result = (unative_t)symaddr;
Note: See TracChangeset for help on using the changeset viewer.