main.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 2001 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#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"
void
{
int pfd;
char procname[MAXPATHLEN];
long oper;
long pflags;
/*
* open our own /proc file and set tracing flags
*/
procname);
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 = 0;
int c;
int error = 0;
long oper;
switch (c) {
case 'f':
break;
case '?':
break;
}
printf("usage: %s [-f file] executable "
"[executable arguments ...]\n", command);
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
*/
exit(1);
}
/*
* initialize librtld_db
*/
"submited: %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;
/* sucessefull 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) {
perr("fopen");
}
} else {
rdb_prompt();
}
yyparse();
printf("\ncontinueing the hung process...\n");
perr("PCRUN2");
}
return (0);
}