Subversion Repositories HelenOS

Rev

Rev 4132 | Rev 4148 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4132 Rev 4137
Line 51... Line 51...
51
#include <func.h>
51
#include <func.h>
52
#include <string.h>
52
#include <string.h>
53
#include <macros.h>
53
#include <macros.h>
54
#include <sysinfo/sysinfo.h>
54
#include <sysinfo/sysinfo.h>
55
#include <ddi/device.h>
55
#include <ddi/device.h>
56
 
-
 
57
#ifdef CONFIG_SYMTAB
-
 
58
#include <symtab.h>
56
#include <symtab.h>
59
#endif
57
#include <errno.h>
60
 
58
 
61
/** Simple kernel console.
59
/** Simple kernel console.
62
 *
60
 *
63
 * The console is realized by kernel thread kconsole.
61
 * The console is realized by kernel thread kconsole.
64
 * It doesn't understand any useful command on its own,
62
 * It doesn't understand any useful command on its own,
Line 347... Line 345...
347
            strncpy(tmp, current + i, position - i + 1);
345
            strncpy(tmp, current + i, position - i + 1);
348
 
346
 
349
            if (i == 0) { /* Command completion */
347
            if (i == 0) { /* Command completion */
350
                found = cmdtab_compl(tmp);
348
                found = cmdtab_compl(tmp);
351
            } else { /* Symtab completion */
349
            } else { /* Symtab completion */
352
#ifdef CONFIG_SYMTAB
-
 
353
                found = symtab_compl(tmp);
350
                found = symtab_compl(tmp);
354
#else
-
 
355
                found = 0;
-
 
356
#endif
-
 
357
            }
351
            }
358
 
352
 
359
            if (found == 0)
353
            if (found == 0)
360
                continue;
354
                continue;
361
            for (i = 0; tmp[i] && curlen < MAX_CMDLINE;
355
            for (i = 0; tmp[i] && curlen < MAX_CMDLINE;
Line 522... Line 516...
522
static int parse_int_arg(char *text, size_t len, unative_t *result)
516
static int parse_int_arg(char *text, size_t len, unative_t *result)
523
{
517
{
524
    uintptr_t symaddr;
518
    uintptr_t symaddr;
525
    bool isaddr = false;
519
    bool isaddr = false;
526
    bool isptr = false;
520
    bool isptr = false;
-
 
521
    int rc;
527
 
522
 
528
#ifdef CONFIG_SYMTAB
-
 
529
    static char symname[MAX_SYMBOL_NAME];
523
    static char symname[MAX_SYMBOL_NAME];
530
#endif
-
 
531
   
524
   
532
    /* If we get a name, try to find it in symbol table */
525
    /* If we get a name, try to find it in symbol table */
533
    if (text[0] == '&') {
526
    if (text[0] == '&') {
534
        isaddr = true;
527
        isaddr = true;
535
        text++;
528
        text++;
Line 538... Line 531...
538
        isptr = true;
531
        isptr = true;
539
        text++;
532
        text++;
540
        len--;
533
        len--;
541
    }
534
    }
542
    if (text[0] < '0' || text[0] > '9') {
535
    if (text[0] < '0' || text[0] > '9') {
543
#ifdef CONFIG_SYMTAB
-
 
544
        strncpy(symname, text, min(len + 1, MAX_SYMBOL_NAME));
536
        strncpy(symname, text, min(len + 1, MAX_SYMBOL_NAME));
545
        symaddr = get_symbol_addr(symname);
537
        rc = symtab_addr_lookup(symname, &symaddr);
546
        if (!symaddr) {
538
        switch (rc) {
-
 
539
        case ENOENT:
547
            printf("Symbol %s not found.\n", symname);
540
            printf("Symbol %s not found.\n", symname);
548
            return -1;
541
            return -1;
549
        }
-
 
550
        if (symaddr == (uintptr_t) -1) {
542
        case EOVERFLOW:
551
            printf("Duplicate symbol %s.\n", symname);
543
            printf("Duplicate symbol %s.\n", symname);
552
            symtab_print_search(symname);
544
            symtab_print_search(symname);
553
            return -1;
545
            return -1;
-
 
546
        default:
-
 
547
            printf("No symbol information available.\n");
-
 
548
            return -1;
554
        }
549
        }
555
#else
550
 
556
        symaddr = 0;
-
 
557
#endif
-
 
558
        if (isaddr)
551
        if (isaddr)
559
            *result = (unative_t)symaddr;
552
            *result = (unative_t)symaddr;
560
        else if (isptr)
553
        else if (isptr)
561
            *result = **((unative_t **)symaddr);
554
            *result = **((unative_t **)symaddr);
562
        else
555
        else