Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4131 → Rev 4132

/trunk/kernel/generic/src/synch/spinlock.c
42,7 → 42,10
#include <preemption.h>
#include <print.h>
#include <debug.h>
 
#ifdef CONFIG_SYMTAB
#include <symtab.h>
#endif
 
#ifdef CONFIG_FB
#include <genarch/fb/fb.h>
76,8 → 79,10
void spinlock_lock_debug(spinlock_t *sl)
{
count_t i = 0;
bool deadlock_reported = false;
#ifdef CONFIG_SYMTAB
char *symbol;
bool deadlock_reported = false;
#endif
 
preemption_disable();
while (test_and_set(&sl->val)) {
108,9 → 113,11
if (i++ > DEADLOCK_THRESHOLD) {
printf("cpu%u: looping on spinlock %" PRIp ":%s, caller=%" PRIp,
CPU->id, sl, sl->name, CALLER);
#ifdef CONFIG_SYMTAB
symbol = get_symtab_entry(CALLER);
if (symbol)
printf("(%s)", symbol);
#endif
printf("\n");
i = 0;
deadlock_reported = true;
/trunk/kernel/generic/src/interrupt/interrupt.c
45,7 → 45,10
#include <console/cmd.h>
#include <panic.h>
#include <print.h>
 
#ifdef CONFIG_SYMTAB
#include <symtab.h>
#endif
 
static struct {
const char *name;
130,9 → 133,13
#endif
for (i = 0; i < IVT_ITEMS; i++) {
#ifdef CONFIG_SYMTAB
symbol = get_symtab_entry((unative_t) exc_table[i].f);
if (!symbol)
symbol = "not found";
#else
symbol = "n/a";
#endif
 
#ifdef __32_BITS__
printf("%-3u %-20s %10p %s\n", i + IVT_FIRST, exc_table[i].name,
/trunk/kernel/generic/src/console/cmd.c
53,7 → 53,6
#include <string.h>
#include <macros.h>
#include <debug.h>
#include <symtab.h>
#include <cpu.h>
#include <mm/tlb.h>
#include <arch/mm/tlb.h>
66,6 → 65,10
#include <ipc/ipc.h>
#include <ipc/irq.h>
 
#ifdef CONFIG_SYMTAB
#include <symtab.h>
#endif
 
#ifdef CONFIG_TEST
#include <test.h>
#endif
167,6 → 170,7
.argv = &desc_argv
};
 
#ifdef CONFIG_SYMTAB
/* Data and methods for 'symaddr' command. */
static int cmd_symaddr(cmd_arg_t *argv);
static char symaddr_buf[MAX_CMDLINE+1];
182,6 → 186,7
.argc = 1,
.argv = &symaddr_argv
};
#endif
 
static char set_buf[MAX_CMDLINE+1];
static int cmd_set4(cmd_arg_t *argv);
458,7 → 463,9
&ipc_info,
&set4_info,
&slabs_info,
#ifdef CONFIG_SYMTAB
&symaddr_info,
#endif
&sched_info,
&threads_info,
&tasks_info,
605,6 → 612,8
return 1;
}
 
#ifdef CONFIG_SYMTAB
 
/** Search symbol table */
int cmd_symaddr(cmd_arg_t *argv)
{
613,14 → 622,16
return 1;
}
 
#endif
 
/** Call function with zero parameters */
int cmd_call0(cmd_arg_t *argv)
{
#ifdef CONFIG_SYMTAB
uintptr_t symaddr;
char *symbol;
unative_t (*fnc)(void);
fncptr_t fptr;
 
symaddr = get_symbol_addr((char *) argv->buffer);
if (!symaddr)
printf("Symbol %s not found.\n", argv->buffer);
628,12 → 639,11
symtab_print_search((char *) argv->buffer);
printf("Duplicate symbol, be more specific.\n");
} else {
symbol = get_symtab_entry(symaddr);
fnc = (unative_t (*)(void)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call0);
printf("Calling %s() (%p)\n", symbol, symaddr);
printf("Calling %s() (%p)\n", argv->buffer, symaddr);
printf("Result: %#" PRIxn "\n", fnc());
}
#endif
return 1;
}
 
669,6 → 679,7
/** Call function with one parameter */
int cmd_call1(cmd_arg_t *argv)
{
#ifdef CONFIG_SYMTAB
uintptr_t symaddr;
char *symbol;
unative_t (*fnc)(unative_t, ...);
676,6 → 687,7
fncptr_t fptr;
symaddr = get_symbol_addr((char *) argv->buffer);
 
if (!symaddr)
printf("Symbol %s not found.\n", argv->buffer);
else if (symaddr == (uintptr_t) -1) {
687,7 → 699,7
printf("Calling f(%#" PRIxn "): %p: %s\n", arg1, symaddr, symbol);
printf("Result: %#" PRIxn "\n", fnc(arg1));
}
#endif
return 1;
}
 
694,6 → 706,7
/** Call function with two parameters */
int cmd_call2(cmd_arg_t *argv)
{
#ifdef CONFIG_SYMTAB
uintptr_t symaddr;
char *symbol;
unative_t (*fnc)(unative_t, unative_t, ...);
713,8 → 726,8
printf("Calling f(%#" PRIxn ", %#" PRIxn "): %p: %s\n",
arg1, arg2, symaddr, symbol);
printf("Result: %#" PRIxn "\n", fnc(arg1, arg2));
}
}
#endif
return 1;
}
 
721,6 → 734,7
/** Call function with three parameters */
int cmd_call3(cmd_arg_t *argv)
{
#ifdef CONFIG_SYMTAB
uintptr_t symaddr;
char *symbol;
unative_t (*fnc)(unative_t, unative_t, unative_t, ...);
742,7 → 756,7
arg1, arg2, arg3, symaddr, symbol);
printf("Result: %#" PRIxn "\n", fnc(arg1, arg2, arg3));
}
#endif
return 1;
}
 
797,18 → 811,29
bool pointer = false;
 
if (((char *)argv->buffer)[0] == '*') {
#ifdef CONFIG_SYMTAB
addr = (uint32_t *) get_symbol_addr((char *) argv->buffer + 1);
#else
addr = 0;
#endif
pointer = true;
} else if (((char *) argv->buffer)[0] >= '0' &&
((char *)argv->buffer)[0] <= '9')
((char *)argv->buffer)[0] <= '9') {
addr = (uint32_t *)atoi((char *)argv->buffer);
else
} else {
#ifdef CONFIG_SYMTAB
addr = (uint32_t *)get_symbol_addr((char *) argv->buffer);
#else
addr = 0;
#endif
}
 
if (!addr)
printf("Symbol %s not found.\n", argv->buffer);
else if (addr == (uint32_t *) -1) {
#ifdef CONFIG_SYMTAB
symtab_print_search((char *) argv->buffer);
#endif
printf("Duplicate symbol, be more specific.\n");
} else {
if (pointer)
/trunk/kernel/generic/src/console/kconsole.c
50,11 → 50,14
#include <debug.h>
#include <func.h>
#include <string.h>
#include <symtab.h>
#include <macros.h>
#include <sysinfo/sysinfo.h>
#include <ddi/device.h>
 
#ifdef CONFIG_SYMTAB
#include <symtab.h>
#endif
 
/** Simple kernel console.
*
* The console is realized by kernel thread kconsole.
258,7 → 261,7
*/
static int cmdtab_compl(char *name)
{
static char output[MAX_SYMBOL_NAME + 1];
static char output[/*MAX_SYMBOL_NAME*/128 + 1];
link_t *startpos = NULL;
const char *foundtxt;
int found = 0;
290,9 → 293,8
startpos = startpos->next;
}
}
strncpy(name, output, MAX_SYMBOL_NAME);
strncpy(name, output, 128/*MAX_SYMBOL_NAME*/);
return found;
}
 
static char *clever_readline(const char *prompt, indev_t *input)
347,7 → 349,11
if (i == 0) { /* Command completion */
found = cmdtab_compl(tmp);
} else { /* Symtab completion */
#ifdef CONFIG_SYMTAB
found = symtab_compl(tmp);
#else
found = 0;
#endif
}
 
if (found == 0)
515,10 → 521,13
 
static int parse_int_arg(char *text, size_t len, unative_t *result)
{
static char symname[MAX_SYMBOL_NAME];
uintptr_t symaddr;
bool isaddr = false;
bool isptr = false;
 
#ifdef CONFIG_SYMTAB
static char symname[MAX_SYMBOL_NAME];
#endif
/* If we get a name, try to find it in symbol table */
if (text[0] == '&') {
531,6 → 540,7
len--;
}
if (text[0] < '0' || text[0] > '9') {
#ifdef CONFIG_SYMTAB
strncpy(symname, text, min(len + 1, MAX_SYMBOL_NAME));
symaddr = get_symbol_addr(symname);
if (!symaddr) {
542,6 → 552,9
symtab_print_search(symname);
return -1;
}
#else
symaddr = 0;
#endif
if (isaddr)
*result = (unative_t)symaddr;
else if (isptr)
/trunk/kernel/Makefile
195,7 → 195,6
generic/src/printf/vprintf.c \
generic/src/printf/vsprintf.c \
generic/src/printf/vsnprintf.c \
generic/src/debug/symtab.c \
generic/src/time/clock.c \
generic/src/time/timeout.c \
generic/src/time/delay.c \
226,6 → 225,14
generic/src/console/cmd.c
endif
 
## Kernel symbol information
#
 
ifeq ($(CONFIG_SYMTAB),y)
GENERIC_SOURCES += \
generic/src/debug/symtab.c
endif
 
## Udebug interface sources
#
 
321,6 → 328,12
ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES)))
GENARCH_OBJECTS := $(addsuffix .o,$(basename $(GENARCH_SOURCES)))
 
ifeq ($(CONFIG_SYMTAB),y)
SYMTAB_OBJECTS := generic/src/debug/real_map.o
else
SYMTAB_OBJECTS :=
endif
 
.PHONY: all build clean archlinks depend disasm
 
all: ../Makefile.config ../config.h ../config.defs
363,8 → 376,8
generic/src/debug/real_map.o: generic/src/debug/real_map.bin
echo $(SYMTAB_SECTION)" .incbin \"$<\"" | $(AS) $(AFLAGS) -o $@
 
kernel.raw: depend arch/$(KARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/real_map.o
$(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
kernel.raw: depend arch/$(KARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(SYMTAB_OBJECTS)
$(LD) -T arch/$(KARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SYMTAB_OBJECTS) -o $@ -Map kernel.map
 
kernel.bin: kernel.raw
$(OBJCOPY) -O $(BFD) kernel.raw kernel.bin
/trunk/kernel/arch/sparc64/src/trap/exception.c
40,14 → 40,25
#include <arch/asm.h>
#include <arch/register.h>
#include <debug.h>
#include <symtab.h>
#include <print.h>
 
#ifdef CONFIG_SYMTAB
#include <symtab.h>
#endif
 
void dump_istate(istate_t *istate)
{
char *tpcs, *tnpcs;
 
#ifdef CONFIG_SYMTAB
tpcs = get_symtab_entry(istate->tpc);
tnpcs = get_symtab_entry(istate->tnpc);
#else
tpcs = tnpcs = "n/a";
#endif
printf("TSTATE=%#" PRIx64 "\n", istate->tstate);
printf("TPC=%#" PRIx64 " (%s)\n", istate->tpc, get_symtab_entry(istate->tpc));
printf("TNPC=%#" PRIx64 " (%s)\n", istate->tnpc, get_symtab_entry(istate->tnpc));
printf("TPC=%#" PRIx64 " (%s)\n", istate->tpc, tpcs);
printf("TNPC=%#" PRIx64 " (%s)\n", istate->tnpc, tnpcs);
}
 
/** Handle instruction_access_exception. (0x8) */
/trunk/kernel/arch/ia64/src/interrupt.c
38,7 → 38,6
#include <ddi/irq.h>
#include <panic.h>
#include <print.h>
#include <symtab.h>
#include <debug.h>
#include <console/console.h>
#include <arch/types.h>
55,6 → 54,10
#include <synch/spinlock.h>
#include <mm/tlb.h>
 
#ifdef CONFIG_SYMTAB
#include <symtab.h>
#endif
 
#define VECTORS_64_BUNDLE 20
#define VECTORS_16_BUNDLE 48
#define VECTORS_16_BUNDLE_START 0x5000
137,9 → 140,13
{
char *ifa, *iipa, *iip;
 
#ifdef CONFIG_SYMTAB
ifa = get_symtab_entry(istate->cr_ifa);
iipa = get_symtab_entry(istate->cr_iipa);
iip = get_symtab_entry(istate->cr_iip);
#else
ifa = iipa = iip = "n/a";
#endif
 
putchar('\n');
printf("Interrupted context dump:\n");
/trunk/kernel/arch/ppc32/src/mm/tlb.c
39,9 → 39,11
#include <mm/as.h>
#include <arch.h>
#include <print.h>
#include <symtab.h>
#include <macros.h>
 
#ifdef CONFIG_SYMTAB
#include <symtab.h>
#endif
 
static unsigned int seed = 10;
static unsigned int seed_real __attribute__ ((section("K_UNMAPPED_DATA_START"))) = 42;
121,6 → 123,7
char *symbol = "";
char *sym2 = "";
 
#ifdef CONFIG_SYMTAB
char *str = get_symtab_entry(istate->pc);
if (str)
symbol = str;
127,6 → 130,7
str = get_symtab_entry(istate->lr);
if (str)
sym2 = str;
#endif
 
fault_if_from_uspace(istate,
"PHT Refill Exception on %p.", badvaddr);
/trunk/kernel/arch/amd64/src/debugger.c
35,7 → 35,6
#include <arch/debugger.h>
#include <console/kconsole.h>
#include <console/cmd.h>
#include <symtab.h>
#include <print.h>
#include <panic.h>
#include <interrupt.h>
45,6 → 44,10
#include <func.h>
#include <smp/ipi.h>
 
#ifdef CONFIG_SYMTAB
#include <symtab.h>
#endif
 
typedef struct {
uintptr_t address; /**< Breakpoint address */
int flags; /**< Flags regarding breakpoint */
229,8 → 232,13
*((unative_t *) breakpoints[slot].address));
}
}
 
#ifdef CONFIG_SYMTAB
printf("Reached breakpoint %d:%lx(%s)\n", slot, getip(istate),
get_symtab_entry(getip(istate)));
#else
printf("Reached breakpoint %d:%lx\n", slot, getip(istate));
#endif
 
#ifdef CONFIG_KCONSOLE
atomic_set(&haltstate, 1);
355,7 → 363,11
for (i = 0; i < BKPOINTS_MAX; i++)
if (breakpoints[i].address) {
#ifdef CONFIG_SYMTAB
symbol = get_symtab_entry(breakpoints[i].address);
#else
symbol = "n/a";
#endif
 
#ifdef __32_BITS__
printf("%-2u %-5d %#10zx %s\n", i,
/trunk/kernel/arch/amd64/src/interrupt.c
43,7 → 43,6
#include <mm/tlb.h>
#include <mm/as.h>
#include <arch.h>
#include <symtab.h>
#include <arch/asm.h>
#include <proc/scheduler.h>
#include <proc/thread.h>
53,6 → 52,10
#include <interrupt.h>
#include <ddi/irq.h>
 
#ifdef CONFIG_SYMTAB
#include <symtab.h>
#endif
 
/*
* Interrupt and exception dispatching.
*/
66,8 → 69,12
char *symbol;
/* uint64_t *x = &istate->stack[0]; */
 
#ifdef CONFIG_SYMTAB
if (!(symbol = get_symtab_entry(istate->rip)))
symbol = "";
#else
symbol = "";
#endif
 
printf("-----EXCEPTION(%d) OCCURED----- ( %s )\n", n, __func__);
printf("%%rip: %#llx (%s)\n", istate->rip, symbol);
/trunk/kernel/arch/mips32/src/exception.c
41,7 → 41,6
#include <arch.h>
#include <debug.h>
#include <proc/thread.h>
#include <symtab.h>
#include <print.h>
#include <interrupt.h>
#include <func.h>
48,6 → 47,10
#include <ddi/irq.h>
#include <arch/debugger.h>
 
#ifdef CONFIG_SYMTAB
#include <symtab.h>
#endif
 
static char * exctable[] = {
"Interrupt",
"TLB Modified",
76,6 → 79,7
char *pcsymbol = "";
char *rasymbol = "";
 
#ifdef CONFIG_SYMTAB
char *s = get_symtab_entry(istate->epc);
if (s)
pcsymbol = s;
82,6 → 86,7
s = get_symtab_entry(istate->ra);
if (s)
rasymbol = s;
#endif
printf("PC: %#x(%s) RA: %#x(%s), SP(%p)\n", istate->epc, pcsymbol, istate->ra, rasymbol, istate->sp);
}
/trunk/kernel/arch/mips32/src/debugger.c
37,7 → 37,6
#include <memstr.h>
#include <console/kconsole.h>
#include <console/cmd.h>
#include <symtab.h>
#include <print.h>
#include <panic.h>
#include <arch.h>
44,6 → 43,10
#include <arch/cp0.h>
#include <func.h>
 
#ifdef CONFIG_SYMTAB
#include <symtab.h>
#endif
 
bpinfo_t breakpoints[BKPOINTS_MAX];
SPINLOCK_INITIALIZE(bkpoint_lock);
 
259,7 → 262,11
for (i = 0; i < BKPOINTS_MAX; i++)
if (breakpoints[i].address) {
#ifdef CONFIG_SYMTAB
symbol = get_symtab_entry(breakpoints[i].address);
#else
symbol = "n/a";
#endif
printf("%-2u %-5d %#10zx %-6s %-7s %-8s %s\n", i,
breakpoints[i].counter, breakpoints[i].address,
348,9 → 355,14
if (cur->flags & BKPOINT_INPROG)
printf("Warning: breakpoint recursion\n");
if (!(cur->flags & BKPOINT_FUNCCALL))
if (!(cur->flags & BKPOINT_FUNCCALL)) {
#ifdef CONFIG_SYMTAB
printf("***Breakpoint %d: %p in %s.\n", i, fireaddr,
get_symtab_entry(istate->epc));
#else
printf("***Breakpoint %d: %p.\n", i, fireaddr);
#endif
}
 
/* Return first instruction back */
((uint32_t *)cur->address)[0] = cur->instruction;
363,8 → 375,12
}
cur->flags |= BKPOINT_INPROG;
} else {
printf("***Breakpoint %p in %s.\n", fireaddr,
#ifdef CONFIG_SYMTAB
printf("***Breakpoint %p in %s.\n", fireaddr,
get_symtab_entry(fireaddr));
#else
printf("***Breakpoint %p.\n", fireaddr);
#endif
/* Move on to next instruction */
istate->epc += 4;
}
/trunk/kernel/arch/mips32/src/mm/tlb.c
40,7 → 40,6
#include <arch/cp0.h>
#include <panic.h>
#include <arch.h>
#include <symtab.h>
#include <synch/mutex.h>
#include <print.h>
#include <debug.h>
47,6 → 46,10
#include <align.h>
#include <interrupt.h>
 
#ifdef CONFIG_SYMTAB
#include <symtab.h>
#endif
 
static void tlb_refill_fail(istate_t *);
static void tlb_invalid_fail(istate_t *);
static void tlb_modified_fail(istate_t *);
323,6 → 326,7
char *symbol = "";
char *sym2 = "";
 
#ifdef CONFIG_SYMTAB
char *s = get_symtab_entry(istate->epc);
if (s)
symbol = s;
329,6 → 333,7
s = get_symtab_entry(istate->ra);
if (s)
sym2 = s;
#endif
 
fault_if_from_uspace(istate, "TLB Refill Exception on %p.",
cp0_badvaddr_read());
341,9 → 346,12
{
char *symbol = "";
 
#ifdef CONFIG_SYMTAB
char *s = get_symtab_entry(istate->epc);
if (s)
symbol = s;
#endif
 
fault_if_from_uspace(istate, "TLB Invalid Exception on %p.",
cp0_badvaddr_read());
panic("%x: TLB Invalid Exception at %x(%s).", cp0_badvaddr_read(),
354,9 → 362,12
{
char *symbol = "";
 
#ifdef CONFIG_SYMTAB
char *s = get_symtab_entry(istate->epc);
if (s)
symbol = s;
#endif
 
fault_if_from_uspace(istate, "TLB Modified Exception on %p.",
cp0_badvaddr_read());
panic("%x: TLB Modified Exception at %x(%s).", cp0_badvaddr_read(),
/trunk/kernel/arch/ia32/src/interrupt.c
44,7 → 44,6
#include <mm/tlb.h>
#include <mm/as.h>
#include <arch.h>
#include <symtab.h>
#include <proc/thread.h>
#include <proc/task.h>
#include <synch/spinlock.h>
53,6 → 52,10
#include <interrupt.h>
#include <ddi/irq.h>
 
#ifdef CONFIG_SYMTAB
#include <symtab.h>
#endif
 
/*
* Interrupt and exception dispatching.
*/
63,10 → 66,15
 
void decode_istate(istate_t *istate)
{
char *symbol = get_symtab_entry(istate->eip);
char *symbol;
 
#ifdef CONFIG_SYMTAB
symbol = get_symtab_entry(istate->eip);
if (!symbol)
symbol = "";
#else
symbol = "";
#endif
 
if (CPU)
printf("----------------EXCEPTION OCCURED (cpu%u)----------------\n", CPU->id);
/trunk/HelenOS.config
317,6 → 317,9
% Kernel console support
! CONFIG_KCONSOLE (y/n)
 
% Kernel symbol information
! CONFIG_SYMTAB (y/n)
 
% Detailed kernel logging
! CONFIG_LOG (n/y)
 
/trunk/defaults/sparc64/Makefile.config
31,6 → 31,9
# Kernel console support
CONFIG_KCONSOLE = y
 
# Kernel symbol information
CONFIG_SYMTAB = y
 
# Detailed kernel logging
CONFIG_LOG = n
 
/trunk/defaults/ia64/Makefile.config
28,6 → 28,9
# Kernel console support
CONFIG_KCONSOLE = y
 
# Kernel symbol information
CONFIG_SYMTAB = y
 
# Detailed kernel logging
CONFIG_LOG = n
 
/trunk/defaults/arm32/Makefile.config
16,6 → 16,9
# Kernel console support
CONFIG_KCONSOLE = y
 
# Kernel symbol information
CONFIG_SYMTAB = y
 
# Detailed kernel logging
CONFIG_LOG = n
 
/trunk/defaults/ppc32/Makefile.config
16,6 → 16,9
# Kernel console support
CONFIG_KCONSOLE = y
 
# Kernel symbol information
CONFIG_SYMTAB = y
 
# Detailed kernel logging
CONFIG_LOG = n
 
/trunk/defaults/amd64/Makefile.config
28,6 → 28,9
# Kernel console support
CONFIG_KCONSOLE = y
 
# Kernel symbol information
CONFIG_SYMTAB = y
 
# Detailed kernel logging
CONFIG_LOG = n
 
/trunk/defaults/mips32/Makefile.config
22,6 → 22,9
# Kernel console support
CONFIG_KCONSOLE = y
 
# Kernel symbol information
CONFIG_SYMTAB = y
 
# Detailed kernel logging
CONFIG_LOG = n
 
/trunk/defaults/ia32/Makefile.config
34,6 → 34,9
# Kernel console support
CONFIG_KCONSOLE = y
 
# Kernel symbol information
CONFIG_SYMTAB = y
 
# Detailed kernel logging
CONFIG_LOG = n