Example #1
0
setup()
{
	close(fsym); fsym = -1;
#ifndef VFORK
	IF (pid = fork()) == 0
#else
	IF (pid = vfork()) == 0
#endif
	THEN ptrace(PT_TRACE_ME,0,0,0);
#ifdef VFORK
	     signal(SIGTRAP,nullsig);
#endif
	     signal(SIGINT,sigint); signal(SIGQUIT,sigqit);
	     doexec(); exit(0);
	ELIF pid == -1
	THEN error(NOFORK);
	ELSE bpwait(); readregs(); lp[0]=EOR; lp[1]=0;
	     fsym=open(symfil,wtflag);
	     IF errflg
	     THEN printf("%s: cannot execute\n",symfil);
		  endpcs(); error(0);
	     FI
	FI
	bpstate=BPOUT;
}
Example #2
0
void
done(void)
{
	if (pid)
		endpcs();
	exits(exitflg? "error": 0);
}
Example #3
0
void
msgpcs(char *msg)
{
	char err[ERRMAX];

	setpcs();
	if(write(msgfd, msg, strlen(msg)) < 0 && !ending){
		errstr(err, sizeof err);
		if(strcmp(err, "interrupted") != 0)
			endpcs();
		errors("can't write control file", err);
	}
}
Example #4
0
/*
 * reload the note buffer
 */
void
loadnote(void)
{
	int i;
	char err[ERRMAX];

	setpcs();
	for(i=0; i<nnote; i++){
		if(write(notefd, note[i], strlen(note[i])) < 0){
			errstr(err, sizeof err);
			if(strcmp(err, "interrupted") != 0)
				endpcs();
			errors("can't write note file", err);
		}
	}
	nnote = 0;
}
Example #5
0
/*
 * empty the note buffer and toss pending breakpoint notes
 */
void
unloadnote(void)
{
	char err[ERRMAX];

	setpcs();
	for(; nnote<NNOTE; nnote++){
		switch(read(notefd, note[nnote], sizeof note[nnote])){
		case -1:
			errstr(err, sizeof err);
			if(strcmp(err, "interrupted") != 0)
				endpcs();
			errors("can't read note file", err);
		case 0:
			return;
		}
		note[nnote][ERRMAX-1] = '\0';
		if(strncmp(note[nnote], "sys: breakpoint", 15) == 0)
			--nnote;
	}
}