1
0
Files
irix-657m-src/irix/cmd/icrash_old/cmds/cmd_dump.c
2022-09-29 17:59:04 +03:00

102 lines
2.0 KiB
C

#ident "$Header: /proj/irix6.5.7m/isms/irix/cmd/icrash_old/cmds/RCS/cmd_dump.c,v 1.1 1999/05/25 19:19:20 tjm Exp $"
#define _KERNEL 1
#include <sys/types.h>
#include <sys/param.h>
#include <stdio.h>
#include <errno.h>
#include "icrash.h"
#include "extern.h"
/*
* dump_cmd() -- Run the 'dump' command.
*/
int
dump_cmd(command_t cmd)
{
int mode;
k_uint_t size;
kaddr_t start_addr;
struct syment *sp;
sp = get_sym(cmd.args[0], B_TEMP);
if (!KL_ERROR) {
start_addr = sp->n_value;
free_sym(sp);
if (DEBUG(DC_GLOBAL, 1)) {
fprintf(cmd.ofp, "start_addr=0x%llx\n", start_addr);
}
}
else {
get_value(cmd.args[0], &mode, 0, &start_addr);
if (KL_ERROR) {
kl_print_error(K);
return(1);
}
/* If entered as a PFN, convert to physical address
*/
if (mode == 1) {
start_addr = Ctob(K, start_addr);
}
}
if (cmd.nargs > 1) {
GET_VALUE(cmd.args[1], &size);
if (KL_ERROR) {
kl_print_error(K);
return(1);
}
}
else {
size = 1;
}
if ((start_addr == 0) &&
((cmd.args[0][0] != '0') && (cmd.args[0][0] != '#'))) {
fprintf(cmd.ofp, "%s not found in symbol table.\n", cmd.args[0]);
}
dump_memory(start_addr, size, cmd.flags, cmd.ofp);
if (KL_ERROR) {
kl_print_error(K);
return(1);
}
return(0);
}
#define _DUMP_USAGE \
"[-d] [-o] [-x] [-B] [-D] [-H] [-W] [-w outfile] addr [count]"
/*
* dump_usage() -- Print the usage string for the 'dump' command.
*/
void
dump_usage(command_t cmd)
{
CMD_USAGE(cmd, _DUMP_USAGE);
}
/*
* dump_help() -- Print the help information for the 'dump' command.
*/
void
dump_help(command_t cmd)
{
CMD_HELP(cmd, _DUMP_USAGE,
"Display count values starting at kernel virtual address "
"addr in one of the following formats: decimal (-d), "
"octal (-o), or hexadecimal (-x). The default format is hexidecimal, "
"and the default count is 1.");
}
/*
* dump_parse() -- Parse the command line arguments for the 'dump' command.
*/
int
dump_parse(command_t cmd)
{
int i;
i = C_TRUE|C_DECIMAL|C_OCTAL|C_HEX|C_BYTE|C_WORD|C_DWORD|C_HWORD|C_WRITE;
return (i);
}