Exemplo n.º 1
0
runpcs(runmode,execsig)
{
	INT		rc;
	REG BKPTR	bkpt;
	IF adrflg THEN userpc=dot; FI
	printf("%s: running\n", symfil);

	WHILE --loopcnt>=0
	DO
#ifdef DEBUG
		printf("\ncontinue %x %d\n",userpc,execsig);
#endif
		IF runmode==SINGLE
		THEN delbp(); /* hardware handles single-stepping */
		ELSE /* continuing from a breakpoint is hard */
			IF bkpt=scanbkpt(userpc)
			THEN execbkpt(bkpt,execsig); execsig=0;
			FI
			setbp();
		FI
		ptrace(runmode,pid,userpc,execsig);
		bpwait(); chkerr(); execsig=0; delbp(); readregs();

		IF signo==0
		ANDF runmode != SINGLE
#ifdef mc68000
		ANDF (bkpt=scanbkpt(userpc - 2))	/* argh */
#else
		ANDF (bkpt=scanbkpt(userpc))
#endif
		THEN /* stopped by BPT instruction */
#ifdef DEBUG
			printf("\n BPT code; '%s'%o'%o'%d",
				bkpt->comm,bkpt->comm[0],EOR,bkpt->flag);
#endif
			dot=bkpt->loc;
			userpc = dot;
			*(ADDR *)(((ADDR)&u)+PC-getradj(1)) = userpc;
			IF bkpt->flag==BKPTEXEC
			ORF ((bkpt->flag=BKPTEXEC)
				ANDF bkpt->comm[0]!=EOR
				ANDF command(bkpt->comm,':')
				ANDF --bkpt->count)
			THEN execbkpt(bkpt,execsig); execsig=0; loopcnt++;
			ELSE bkpt->count=bkpt->initcnt; rc=1;
			FI
		ELSE execsig=signo; rc=0;
		FI
	OD
	return(rc);
}
Exemplo n.º 2
0
runpcs(int runmode, int keepnote)
{
	int rc;
	BKPT *bkpt;

	rc = 0;
	if (adrflg)
		rput(cormap, mach->pc, dot);
	dot = rget(cormap, mach->pc);
	flush();
	while (loopcnt-- > 0) {
		if(loopcnt != 0)
			printpc();
		if (runmode == SINGLE) {
			bkpt = scanbkpt(dot);
			if (bkpt) {
				switch(bkpt->flag){
				case BKPTTMP:
					bkpt->flag = BKPTCLR;
					break;
				case BKPTSKIP:
					bkpt->flag = BKPTSET;
					break;
				}
			}
			runstep(dot, keepnote);
		} else {
			if ((bkpt = scanbkpt(rget(cormap, mach->pc))) != 0) {
				execbkpt(bkpt, keepnote);
				keepnote = 0;
			}
			setbp();
			runrun(keepnote);
		}
		keepnote = 0;
		delbp();
		dot = rget(cormap, mach->pc);
		/* real note? */
		if (nnote > 0) {
			keepnote = 1;
			rc = 0;
			continue;
		}
		bkpt = scanbkpt(dot);
		if(bkpt == 0){
			keepnote = 0;
			rc = 0;
			continue;
		}
		/* breakpoint */
		if (bkpt->flag == BKPTTMP)
			bkpt->flag = BKPTCLR;
		else if (bkpt->flag == BKPTSKIP) {
			execbkpt(bkpt, keepnote);
			keepnote = 0;
			loopcnt++;	/* we didn't really stop */
			continue;
		}
		else {
			bkpt->flag = BKPTSKIP;
			--bkpt->count;
			if ((bkpt->comm[0] == EOR || command(bkpt->comm, ':') != 0)
			&&  bkpt->count != 0) {
				execbkpt(bkpt, keepnote);
				keepnote = 0;
				loopcnt++;
				continue;
			}
			bkpt->count = bkpt->initcnt;
		}
		rc = 1;
	}
	return(rc);
}