main.c revision 8fd04b8338ed5093ec2d1e668fa620b7de44c177
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <procfs.h>
#include <libelf.h>
#include <stdarg.h>
#include <proc_service.h>
#include "rdb.h"
#include "disasm.h"
#include "gram.h"
static void
{
int pfd;
char procname[MAXPATHLEN];
/*
* open our own /proc file and set tracing flags
*/
exit(1);
}
/*
* inherit on fork, and kill-on-last-close
*/
perr("init_proc: PCSET");
/*
* no signal tracing
*/
premptyset(&sigset);
perr("PCSTRACE");
/*
* no fault tracing
*/
premptyset(&fltset);
perr("PCSFAULT");
/*
* no syscall tracing
*/
premptyset(&sysset);
perr("PSENTRY");
/*
* except exit from exec() or execve()
*/
premptyset(&sysset);
perr("PCSEXIT");
}
int
{
int pctlfd;
int pstatusfd;
char procname[MAXPATHLEN];
char *command;
char *rdb_commands = NULL;
int c;
int error = 0;
long oper;
switch (c) {
case 'f':
break;
case '?':
break;
}
(void) printf("usage: %s [-f file] executable "
"[executable arguments ...]\n", command);
(void) printf("\t-f command file\n");
exit(1);
}
/*
* set up for tracing the child.
*/
init_proc();
/*
* create a child to fork and exec from.
*/
}
/*
* initialize libelf
*/
elf_errmsg(0));
exit(1);
}
/*
* initialize librtld_db
*/
"submitted: %d\n", RD_VERSION);
exit(1);
}
/* rd_log(1); */
/*
* Child should now be waiting after the successful
* exec.
*/
exit(1);
}
/*
* wait for child process.
*/
perr("PCWSTOP");
/*
* open /proc/<cpid>/status
*/
perr("status read failed");
/*
* Make sure that it stopped where we expected.
*/
long pflags = 0;
/* successfull exec(2) */
break;
}
perr("PCRUN1");
perr("PCWSTOP");
perr("status read failed");
}
premptyset(&sysset);
perr("PIOCSEXIT");
/*
* Did we stop where we expected ?
*/
long pflags = 0;
perr("PCRUN2");
exit(1);
}
if (rdb_commands) {
(void) printf("unable to open %s for input\n",
perr("fopen");
}
} else {
rdb_prompt();
}
yyparse();
(void) printf("\ncontinuing the hung process...\n");
perr("PCRUN2");
}
return (0);
}