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)