50,10 → 50,11 |
#include <debug.h> |
#include <func.h> |
#include <string.h> |
#include <symtab.h> |
#include <macros.h> |
#include <sysinfo/sysinfo.h> |
#include <ddi/device.h> |
#include <symtab.h> |
#include <errno.h> |
|
/** Simple kernel console. |
* |
258,7 → 259,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,12 → 291,11 |
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, chardev_t *input) |
static char *clever_readline(const char *prompt, indev_t *input) |
{ |
static int histposition = 0; |
|
456,6 → 456,11 |
return current; |
} |
|
bool kconsole_check_poll(void) |
{ |
return check_poll(stdin); |
} |
|
/** Kernel console prompt. |
* |
* @param prompt Kernel console prompt (e.g kconsole/panic). |
480,6 → 485,8 |
|
if (kcon) |
_getc(stdin); |
else |
printf("Type \"exit\" to leave the console.\n"); |
|
while (true) { |
cmdline = clever_readline((char *) prompt, stdin); |
487,14 → 494,13 |
if (!len) |
continue; |
|
if ((!kcon) && (len == 4) && (strncmp(cmdline, "exit", 4) == 0)) |
break; |
|
cmd_info = parse_cmdline(cmdline, len); |
if (!cmd_info) |
continue; |
|
if ((!kcon) |
&& (strncmp(cmd_info->name, "exit", min(strlen(cmd_info->name), 5)) == 0)) |
break; |
|
(void) cmd_info->func(cmd_info->argv); |
} |
} |
509,11 → 515,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; |
int rc; |
|
static char symname[MAX_SYMBOL_NAME]; |
|
/* If we get a name, try to find it in symbol table */ |
if (text[0] == '&') { |
isaddr = true; |
526,16 → 534,20 |
} |
if (text[0] < '0' || text[0] > '9') { |
strncpy(symname, text, min(len + 1, MAX_SYMBOL_NAME)); |
symaddr = get_symbol_addr(symname); |
if (!symaddr) { |
rc = symtab_addr_lookup(symname, &symaddr); |
switch (rc) { |
case ENOENT: |
printf("Symbol %s not found.\n", symname); |
return -1; |
} |
if (symaddr == (uintptr_t) -1) { |
case EOVERFLOW: |
printf("Duplicate symbol %s.\n", symname); |
symtab_print_search(symname); |
return -1; |
default: |
printf("No symbol information available.\n"); |
return -1; |
} |
|
if (isaddr) |
*result = (unative_t)symaddr; |
else if (isptr) |