utils.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2000 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <libelf.h>
#include "rdb.h"
void
perr(char * s)
{
perror(s);
exit(1);
}
hexstr_to_num(const char * str)
{
size_t i;
for (i = 0; i < len; i++)
return (num);
}
#define STBUFSIZ 1024
{
int bufind = 0;
int cont = 1;
return (RET_FAILED);
STBUFSIZ)) == -1)
return (RET_FAILED);
intbufind = 0;
}
return (RET_OK);
bufind++;
intbufind++;
}
return (RET_FAILED);
}
void
{
(void) display_all_regs(ph);
return;
}
}
void
char * format)
{
printf("\n%17s:",
int i;
for (i = 0; i < count; i++) {
unsigned long word;
if ((i % 4) == 0)
sizeof (unsigned long)) != PS_OK) {
printf("\nfailed to read memory at: 0x%lx\n",
address);
return;
}
address += 4;
}
putchar('\n');
return;
}
if (*format == 'b') {
int i;
unsigned char byte;
if ((i % 8) == 0)
sizeof (unsigned char)) != PS_OK) {
"at: 0x%lx\n", address);
return;
}
}
putchar('\n');
return;
}
if (*format == 's') {
char buf[MAXPATHLEN];
MAXPATHLEN) != RET_OK) {
return;
}
return;
}
}