Ignore:
File:
1 edited

Legend:

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

    r7e752b2 r98000fb  
    3838#include <symtab.h>
    3939#include <byteorder.h>
    40 #include <str.h>
     40#include <string.h>
    4141#include <print.h>
    42 #include <typedefs.h>
     42#include <arch/types.h>
    4343#include <typedefs.h>
    4444#include <errno.h>
     
    4646/** Get name of a symbol that seems most likely to correspond to address.
    4747 *
    48  * @param addr   Address.
    49  * @param name   Place to store pointer to the symbol name.
    50  * @param offset Place to store offset from the symbol address.
     48 * @param addr Address.
     49 * @param name Place to store pointer to the symbol name.
    5150 *
    5251 * @return Zero on success or negative error code, ENOENT if not found,
     
    5453 *
    5554 */
    56 int symtab_name_lookup(uintptr_t addr, const char **name, uintptr_t *offset)
     55int symtab_name_lookup(unative_t addr, char **name)
    5756{
    5857#ifdef CONFIG_SYMTAB
     
    6665        if (addr >= uint64_t_le2host(symbol_table[i - 1].address_le)) {
    6766                *name = symbol_table[i - 1].symbol_name;
    68                 if (offset)
    69                         *offset = addr -
    70                             uint64_t_le2host(symbol_table[i - 1].address_le);
    7167                return EOK;
    7268        }
     
    8379/** Lookup symbol by address and format for display.
    8480 *
    85  * Returns name of closest corresponding symbol,
    86  * "unknown" if none exists and "N/A" if no symbol
    87  * information is available.
     81 * Returns name of closest corresponding symbol, "Not found" if none exists
     82 * or "N/A" if no symbol information is available.
    8883 *
    8984 * @param addr Address.
     
    9388 *
    9489 */
    95 const char *symtab_fmt_name_lookup(uintptr_t addr)
    96 {
    97         const char *name;
    98         int rc = symtab_name_lookup(addr, &name, NULL);
     90char *symtab_fmt_name_lookup(unative_t addr)
     91{
     92        char *name;
     93        int rc = symtab_name_lookup(addr, &name);
    9994       
    10095        switch (rc) {
     
    10297                return name;
    10398        case ENOENT:
    104                 return "unknown";
     99                return "Not found";
    105100        default:
    106101                return "N/A";
     
    192187                uintptr_t addr = uint64_t_le2host(symbol_table[pos].address_le);
    193188                char *realname = symbol_table[pos].symbol_name;
    194                 printf("%p: %s\n", (void *) addr, realname);
     189                printf("%p: %s\n", addr, realname);
    195190                pos++;
    196191        }
     
    240235                printf("\n");
    241236                pos = 0;
    242                 while (symtab_search_one(name, &pos)) {
     237                while ((hint = symtab_search_one(name, &pos))) {
    243238                        printf("%s\n", symbol_table[pos].symbol_name);
    244239                        pos++;
Note: See TracChangeset for help on using the changeset viewer.