Changeset e2b762ec in mainline


Ignore:
Timestamp:
2009-03-16T21:58:05Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f36c061
Parents:
d9167a1c
Message:

Make kernel symbol information optional.

Files:
22 edited

Legend:

Unmodified
Added
Removed
  • HelenOS.config

    rd9167a1c re2b762ec  
    318318! CONFIG_KCONSOLE (y/n)
    319319
     320% Kernel symbol information
     321! CONFIG_SYMTAB (y/n)
     322
    320323% Detailed kernel logging
    321324! CONFIG_LOG (n/y)
  • defaults/amd64/Makefile.config

    rd9167a1c re2b762ec  
    2929CONFIG_KCONSOLE = y
    3030
     31# Kernel symbol information
     32CONFIG_SYMTAB = y
     33
    3134# Detailed kernel logging
    3235CONFIG_LOG = n
  • defaults/arm32/Makefile.config

    rd9167a1c re2b762ec  
    1717CONFIG_KCONSOLE = y
    1818
     19# Kernel symbol information
     20CONFIG_SYMTAB = y
     21
    1922# Detailed kernel logging
    2023CONFIG_LOG = n
  • defaults/ia32/Makefile.config

    rd9167a1c re2b762ec  
    3535CONFIG_KCONSOLE = y
    3636
     37# Kernel symbol information
     38CONFIG_SYMTAB = y
     39
    3740# Detailed kernel logging
    3841CONFIG_LOG = n
  • defaults/ia64/Makefile.config

    rd9167a1c re2b762ec  
    2929CONFIG_KCONSOLE = y
    3030
     31# Kernel symbol information
     32CONFIG_SYMTAB = y
     33
    3134# Detailed kernel logging
    3235CONFIG_LOG = n
  • defaults/mips32/Makefile.config

    rd9167a1c re2b762ec  
    2323CONFIG_KCONSOLE = y
    2424
     25# Kernel symbol information
     26CONFIG_SYMTAB = y
     27
    2528# Detailed kernel logging
    2629CONFIG_LOG = n
  • defaults/ppc32/Makefile.config

    rd9167a1c re2b762ec  
    1717CONFIG_KCONSOLE = y
    1818
     19# Kernel symbol information
     20CONFIG_SYMTAB = y
     21
    1922# Detailed kernel logging
    2023CONFIG_LOG = n
  • defaults/sparc64/Makefile.config

    rd9167a1c re2b762ec  
    3232CONFIG_KCONSOLE = y
    3333
     34# Kernel symbol information
     35CONFIG_SYMTAB = y
     36
    3437# Detailed kernel logging
    3538CONFIG_LOG = n
  • kernel/Makefile

    rd9167a1c re2b762ec  
    196196        generic/src/printf/vsprintf.c \
    197197        generic/src/printf/vsnprintf.c \
    198         generic/src/debug/symtab.c \
    199198        generic/src/time/clock.c \
    200199        generic/src/time/timeout.c \
     
    225224        generic/src/console/kconsole.c \
    226225        generic/src/console/cmd.c
     226endif
     227
     228## Kernel symbol information
     229#
     230
     231ifeq ($(CONFIG_SYMTAB),y)
     232GENERIC_SOURCES += \
     233        generic/src/debug/symtab.c
    227234endif
    228235
     
    322329GENARCH_OBJECTS := $(addsuffix .o,$(basename $(GENARCH_SOURCES)))
    323330
     331ifeq ($(CONFIG_SYMTAB),y)
     332        SYMTAB_OBJECTS := generic/src/debug/real_map.o
     333else
     334        SYMTAB_OBJECTS :=
     335endif
     336
    324337.PHONY: all build clean archlinks depend disasm
    325338
     
    364377        echo $(SYMTAB_SECTION)" .incbin \"$<\"" | $(AS) $(AFLAGS) -o $@
    365378
    366 kernel.raw: depend arch/$(KARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/real_map.o
    367         $(LD) -T arch/$(KARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) generic/src/debug/real_map.o -o $@ -Map kernel.map
     379kernel.raw: depend arch/$(KARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(SYMTAB_OBJECTS)
     380        $(LD) -T arch/$(KARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SYMTAB_OBJECTS) -o $@ -Map kernel.map
    368381
    369382kernel.bin: kernel.raw
  • kernel/arch/amd64/src/debugger.c

    rd9167a1c re2b762ec  
    3636#include <console/kconsole.h>
    3737#include <console/cmd.h>
    38 #include <symtab.h>
    3938#include <print.h>
    4039#include <panic.h>
     
    4544#include <func.h>
    4645#include <smp/ipi.h>
     46
     47#ifdef CONFIG_SYMTAB
     48#include <symtab.h>
     49#endif
    4750
    4851typedef struct  {
     
    230233                }
    231234        }
     235
     236#ifdef CONFIG_SYMTAB
    232237        printf("Reached breakpoint %d:%lx(%s)\n", slot, getip(istate),
    233238            get_symtab_entry(getip(istate)));
     239#else
     240        printf("Reached breakpoint %d:%lx\n", slot, getip(istate));
     241#endif
    234242
    235243#ifdef CONFIG_KCONSOLE
     
    356364        for (i = 0; i < BKPOINTS_MAX; i++)
    357365                if (breakpoints[i].address) {
     366#ifdef CONFIG_SYMTAB
    358367                        symbol = get_symtab_entry(breakpoints[i].address);
     368#else
     369                        symbol = "n/a";
     370#endif
    359371
    360372#ifdef __32_BITS__
  • kernel/arch/amd64/src/interrupt.c

    rd9167a1c re2b762ec  
    4444#include <mm/as.h>
    4545#include <arch.h>
    46 #include <symtab.h>
    4746#include <arch/asm.h>
    4847#include <proc/scheduler.h>
     
    5453#include <ddi/irq.h>
    5554
     55#ifdef CONFIG_SYMTAB
     56#include <symtab.h>
     57#endif
     58
    5659/*
    5760 * Interrupt and exception dispatching.
     
    6770/*      uint64_t *x = &istate->stack[0]; */
    6871
     72#ifdef CONFIG_SYMTAB
    6973        if (!(symbol = get_symtab_entry(istate->rip)))
    7074                symbol = "";
     75#else
     76        symbol = "";
     77#endif
    7178
    7279        printf("-----EXCEPTION(%d) OCCURED----- ( %s )\n", n, __func__);
  • kernel/arch/ia32/src/interrupt.c

    rd9167a1c re2b762ec  
    4545#include <mm/as.h>
    4646#include <arch.h>
    47 #include <symtab.h>
    4847#include <proc/thread.h>
    4948#include <proc/task.h>
     
    5453#include <ddi/irq.h>
    5554
     55#ifdef CONFIG_SYMTAB
     56#include <symtab.h>
     57#endif
     58
    5659/*
    5760 * Interrupt and exception dispatching.
     
    6467void decode_istate(istate_t *istate)
    6568{
    66         char *symbol = get_symtab_entry(istate->eip);
    67 
     69        char *symbol;
     70
     71#ifdef CONFIG_SYMTAB
     72        symbol = get_symtab_entry(istate->eip);
    6873        if (!symbol)
    6974                symbol = "";
     75#else
     76        symbol = "";
     77#endif
    7078
    7179        if (CPU)
  • kernel/arch/ia64/src/interrupt.c

    rd9167a1c re2b762ec  
    3939#include <panic.h>
    4040#include <print.h>
    41 #include <symtab.h>
    4241#include <debug.h>
    4342#include <console/console.h>
     
    5655#include <mm/tlb.h>
    5756
     57#ifdef CONFIG_SYMTAB
     58#include <symtab.h>
     59#endif
     60
    5861#define VECTORS_64_BUNDLE       20
    5962#define VECTORS_16_BUNDLE       48
     
    138141        char *ifa, *iipa, *iip;
    139142
     143#ifdef CONFIG_SYMTAB
    140144        ifa = get_symtab_entry(istate->cr_ifa);
    141145        iipa = get_symtab_entry(istate->cr_iipa);
    142146        iip = get_symtab_entry(istate->cr_iip);
     147#else
     148        ifa = iipa = iip = "n/a";
     149#endif
    143150
    144151        putchar('\n');
  • kernel/arch/mips32/src/debugger.c

    rd9167a1c re2b762ec  
    3838#include <console/kconsole.h>
    3939#include <console/cmd.h>
    40 #include <symtab.h>
    4140#include <print.h>
    4241#include <panic.h>
     
    4443#include <arch/cp0.h>
    4544#include <func.h>
     45
     46#ifdef CONFIG_SYMTAB
     47#include <symtab.h>
     48#endif
    4649
    4750bpinfo_t breakpoints[BKPOINTS_MAX];
     
    260263        for (i = 0; i < BKPOINTS_MAX; i++)
    261264                if (breakpoints[i].address) {
     265#ifdef CONFIG_SYMTAB
    262266                        symbol = get_symtab_entry(breakpoints[i].address);
     267#else
     268                        symbol = "n/a";
     269#endif
    263270                       
    264271                        printf("%-2u %-5d %#10zx %-6s %-7s %-8s %s\n", i,
     
    349356                        printf("Warning: breakpoint recursion\n");
    350357               
    351                 if (!(cur->flags & BKPOINT_FUNCCALL))
     358                if (!(cur->flags & BKPOINT_FUNCCALL)) {
     359#ifdef CONFIG_SYMTAB
    352360                        printf("***Breakpoint %d: %p in %s.\n", i, fireaddr,
    353361                            get_symtab_entry(istate->epc));
     362#else
     363                        printf("***Breakpoint %d: %p.\n", i, fireaddr);
     364#endif
     365                }
    354366
    355367                /* Return first instruction back */
     
    364376                cur->flags |= BKPOINT_INPROG;
    365377        } else {
    366                 printf("***Breakpoint %p in %s.\n", fireaddr,
     378#ifdef CONFIG_SYMTAB
     379                printf("***Breakpoint %p in %s.\n", fireaddr,
    367380                       get_symtab_entry(fireaddr));
     381#else
     382                printf("***Breakpoint %p.\n", fireaddr);       
     383#endif
    368384                /* Move on to next instruction */
    369385                istate->epc += 4;
  • kernel/arch/mips32/src/exception.c

    rd9167a1c re2b762ec  
    4242#include <debug.h>
    4343#include <proc/thread.h>
    44 #include <symtab.h>
    4544#include <print.h>
    4645#include <interrupt.h>
     
    4847#include <ddi/irq.h>
    4948#include <arch/debugger.h>
     49
     50#ifdef CONFIG_SYMTAB
     51#include <symtab.h>
     52#endif
    5053
    5154static char * exctable[] = {
     
    7780        char *rasymbol = "";
    7881
     82#ifdef CONFIG_SYMTAB
    7983        char *s = get_symtab_entry(istate->epc);
    8084        if (s)
     
    8387        if (s)
    8488                rasymbol = s;
     89#endif
    8590       
    8691        printf("PC: %#x(%s) RA: %#x(%s), SP(%p)\n", istate->epc, pcsymbol, istate->ra, rasymbol, istate->sp);
  • kernel/arch/mips32/src/mm/tlb.c

    rd9167a1c re2b762ec  
    4141#include <panic.h>
    4242#include <arch.h>
    43 #include <symtab.h>
    4443#include <synch/mutex.h>
    4544#include <print.h>
     
    4746#include <align.h>
    4847#include <interrupt.h>
     48
     49#ifdef CONFIG_SYMTAB
     50#include <symtab.h>
     51#endif
    4952
    5053static void tlb_refill_fail(istate_t *);
     
    324327        char *sym2 = "";
    325328
     329#ifdef CONFIG_SYMTAB
    326330        char *s = get_symtab_entry(istate->epc);
    327331        if (s)
     
    330334        if (s)
    331335                sym2 = s;
     336#endif
    332337
    333338        fault_if_from_uspace(istate, "TLB Refill Exception on %p.",
     
    342347        char *symbol = "";
    343348
     349#ifdef CONFIG_SYMTAB
    344350        char *s = get_symtab_entry(istate->epc);
    345351        if (s)
    346352                symbol = s;
     353#endif
     354
    347355        fault_if_from_uspace(istate, "TLB Invalid Exception on %p.",
    348356            cp0_badvaddr_read());
     
    355363        char *symbol = "";
    356364
     365#ifdef CONFIG_SYMTAB
    357366        char *s = get_symtab_entry(istate->epc);
    358367        if (s)
    359368                symbol = s;
     369#endif
     370
    360371        fault_if_from_uspace(istate, "TLB Modified Exception on %p.",
    361372            cp0_badvaddr_read());
  • kernel/arch/ppc32/src/mm/tlb.c

    rd9167a1c re2b762ec  
    4040#include <arch.h>
    4141#include <print.h>
     42#include <macros.h>
     43
     44#ifdef CONFIG_SYMTAB
    4245#include <symtab.h>
    43 #include <macros.h>
    44 
     46#endif
    4547
    4648static unsigned int seed = 10;
     
    122124        char *sym2 = "";
    123125
     126#ifdef CONFIG_SYMTAB
    124127        char *str = get_symtab_entry(istate->pc);
    125128        if (str)
     
    128131        if (str)
    129132                sym2 = str;
     133#endif
    130134
    131135        fault_if_from_uspace(istate,
  • kernel/arch/sparc64/src/trap/exception.c

    rd9167a1c re2b762ec  
    4141#include <arch/register.h>
    4242#include <debug.h>
     43#include <print.h>
     44
     45#ifdef CONFIG_SYMTAB
    4346#include <symtab.h>
    44 #include <print.h>
     47#endif
    4548
    4649void dump_istate(istate_t *istate)
    4750{
     51        char *tpcs, *tnpcs;
     52
     53#ifdef CONFIG_SYMTAB
     54        tpcs = get_symtab_entry(istate->tpc);
     55        tnpcs = get_symtab_entry(istate->tnpc);
     56#else
     57        tpcs = tnpcs = "n/a";
     58#endif
    4859        printf("TSTATE=%#" PRIx64 "\n", istate->tstate);
    49         printf("TPC=%#" PRIx64 " (%s)\n", istate->tpc, get_symtab_entry(istate->tpc));
    50         printf("TNPC=%#" PRIx64 " (%s)\n", istate->tnpc, get_symtab_entry(istate->tnpc));
     60        printf("TPC=%#" PRIx64 " (%s)\n", istate->tpc, tpcs);
     61        printf("TNPC=%#" PRIx64 " (%s)\n", istate->tnpc, tnpcs);
    5162}
    5263
  • kernel/generic/src/console/cmd.c

    rd9167a1c re2b762ec  
    5454#include <macros.h>
    5555#include <debug.h>
    56 #include <symtab.h>
    5756#include <cpu.h>
    5857#include <mm/tlb.h>
     
    6766#include <ipc/irq.h>
    6867
     68#ifdef CONFIG_SYMTAB
     69#include <symtab.h>
     70#endif
     71
    6972#ifdef CONFIG_TEST
    7073#include <test.h>
     
    168171};
    169172
     173#ifdef CONFIG_SYMTAB
    170174/* Data and methods for 'symaddr' command. */
    171175static int cmd_symaddr(cmd_arg_t *argv);
     
    183187        .argv = &symaddr_argv
    184188};
     189#endif
    185190
    186191static char set_buf[MAX_CMDLINE+1];
     
    459464        &set4_info,
    460465        &slabs_info,
     466#ifdef CONFIG_SYMTAB
    461467        &symaddr_info,
     468#endif
    462469        &sched_info,
    463470        &threads_info,
     
    606613}
    607614
     615#ifdef CONFIG_SYMTAB
     616
    608617/** Search symbol table */
    609618int cmd_symaddr(cmd_arg_t *argv)
     
    614623}
    615624
     625#endif
     626
    616627/** Call function with zero parameters */
    617628int cmd_call0(cmd_arg_t *argv)
    618629{
     630#ifdef CONFIG_SYMTAB
    619631        uintptr_t symaddr;
    620         char *symbol;
    621632        unative_t (*fnc)(void);
    622633        fncptr_t fptr;
    623        
     634
    624635        symaddr = get_symbol_addr((char *) argv->buffer);
    625636        if (!symaddr)
     
    629640                printf("Duplicate symbol, be more specific.\n");
    630641        } else {
    631                 symbol = get_symtab_entry(symaddr);
    632642                fnc = (unative_t (*)(void)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call0);
    633                 printf("Calling %s() (%p)\n", symbol, symaddr);
     643                printf("Calling %s() (%p)\n", argv->buffer, symaddr);
    634644                printf("Result: %#" PRIxn "\n", fnc());
    635645        }
    636        
     646#endif
    637647        return 1;
    638648}
     
    670680int cmd_call1(cmd_arg_t *argv)
    671681{
     682#ifdef CONFIG_SYMTAB
    672683        uintptr_t symaddr;
    673684        char *symbol;
     
    677688       
    678689        symaddr = get_symbol_addr((char *) argv->buffer);
     690
    679691        if (!symaddr)
    680692                printf("Symbol %s not found.\n", argv->buffer);
     
    688700                printf("Result: %#" PRIxn "\n", fnc(arg1));
    689701        }
    690        
     702#endif
    691703        return 1;
    692704}
     
    695707int cmd_call2(cmd_arg_t *argv)
    696708{
     709#ifdef CONFIG_SYMTAB
    697710        uintptr_t symaddr;
    698711        char *symbol;
     
    714727                       arg1, arg2, symaddr, symbol);
    715728                printf("Result: %#" PRIxn "\n", fnc(arg1, arg2));
    716         }
    717        
     729        }       
     730#endif
    718731        return 1;
    719732}
     
    722735int cmd_call3(cmd_arg_t *argv)
    723736{
     737#ifdef CONFIG_SYMTAB
    724738        uintptr_t symaddr;
    725739        char *symbol;
     
    743757                printf("Result: %#" PRIxn "\n", fnc(arg1, arg2, arg3));
    744758        }
    745        
     759#endif
    746760        return 1;
    747761}
     
    798812
    799813        if (((char *)argv->buffer)[0] == '*') {
     814#ifdef CONFIG_SYMTAB
    800815                addr = (uint32_t *) get_symbol_addr((char *) argv->buffer + 1);
     816#else
     817                addr = 0;
     818#endif
    801819                pointer = true;
    802820        } else if (((char *) argv->buffer)[0] >= '0' &&
    803                    ((char *)argv->buffer)[0] <= '9')
     821                   ((char *)argv->buffer)[0] <= '9') {
    804822                addr = (uint32_t *)atoi((char *)argv->buffer);
    805         else
     823        } else {
     824#ifdef CONFIG_SYMTAB
    806825                addr = (uint32_t *)get_symbol_addr((char *) argv->buffer);
     826#else
     827                addr = 0;
     828#endif
     829        }
    807830
    808831        if (!addr)
    809832                printf("Symbol %s not found.\n", argv->buffer);
    810833        else if (addr == (uint32_t *) -1) {
     834#ifdef CONFIG_SYMTAB
    811835                symtab_print_search((char *) argv->buffer);
     836#endif
    812837                printf("Duplicate symbol, be more specific.\n");
    813838        } else {
  • kernel/generic/src/console/kconsole.c

    rd9167a1c re2b762ec  
    5151#include <func.h>
    5252#include <string.h>
    53 #include <symtab.h>
    5453#include <macros.h>
    5554#include <sysinfo/sysinfo.h>
    5655#include <ddi/device.h>
     56
     57#ifdef CONFIG_SYMTAB
     58#include <symtab.h>
     59#endif
    5760
    5861/** Simple kernel console.
     
    259262static int cmdtab_compl(char *name)
    260263{
    261         static char output[MAX_SYMBOL_NAME + 1];
     264        static char output[/*MAX_SYMBOL_NAME*/128 + 1];
    262265        link_t *startpos = NULL;
    263266        const char *foundtxt;
     
    291294                }
    292295        }
    293         strncpy(name, output, MAX_SYMBOL_NAME);
     296        strncpy(name, output, 128/*MAX_SYMBOL_NAME*/);
    294297        return found;
    295        
    296298}
    297299
     
    348350                                found = cmdtab_compl(tmp);
    349351                        } else { /* Symtab completion */
     352#ifdef CONFIG_SYMTAB
    350353                                found = symtab_compl(tmp);
     354#else
     355                                found = 0;
     356#endif
    351357                        }
    352358
     
    516522static int parse_int_arg(char *text, size_t len, unative_t *result)
    517523{
    518         static char symname[MAX_SYMBOL_NAME];
    519524        uintptr_t symaddr;
    520525        bool isaddr = false;
    521526        bool isptr = false;
     527
     528#ifdef CONFIG_SYMTAB
     529        static char symname[MAX_SYMBOL_NAME];
     530#endif
    522531       
    523532        /* If we get a name, try to find it in symbol table */
     
    532541        }
    533542        if (text[0] < '0' || text[0] > '9') {
     543#ifdef CONFIG_SYMTAB
    534544                strncpy(symname, text, min(len + 1, MAX_SYMBOL_NAME));
    535545                symaddr = get_symbol_addr(symname);
     
    543553                        return -1;
    544554                }
     555#else
     556                symaddr = 0;
     557#endif
    545558                if (isaddr)
    546559                        *result = (unative_t)symaddr;
  • kernel/generic/src/interrupt/interrupt.c

    rd9167a1c re2b762ec  
    4646#include <panic.h>
    4747#include <print.h>
     48
     49#ifdef CONFIG_SYMTAB
    4850#include <symtab.h>
     51#endif
    4952
    5053static struct {
     
    131134       
    132135        for (i = 0; i < IVT_ITEMS; i++) {
     136#ifdef CONFIG_SYMTAB
    133137                symbol = get_symtab_entry((unative_t) exc_table[i].f);
    134138                if (!symbol)
    135139                        symbol = "not found";
     140#else
     141                symbol = "n/a";
     142#endif
    136143
    137144#ifdef __32_BITS__
  • kernel/generic/src/synch/spinlock.c

    rd9167a1c re2b762ec  
    4343#include <print.h>
    4444#include <debug.h>
     45
     46#ifdef CONFIG_SYMTAB
    4547#include <symtab.h>
     48#endif
    4649
    4750#ifdef CONFIG_FB
     
    7780{
    7881        count_t i = 0;
     82        bool deadlock_reported = false;
     83#ifdef CONFIG_SYMTAB
    7984        char *symbol;
    80         bool deadlock_reported = false;
     85#endif
    8186
    8287        preemption_disable();
     
    109114                        printf("cpu%u: looping on spinlock %" PRIp ":%s, caller=%" PRIp,
    110115                                CPU->id, sl, sl->name, CALLER);
     116#ifdef CONFIG_SYMTAB
    111117                        symbol = get_symtab_entry(CALLER);
    112118                        if (symbol)
    113119                                printf("(%s)", symbol);
     120#endif
    114121                        printf("\n");
    115122                        i = 0;
Note: See TracChangeset for help on using the changeset viewer.