to the debuggee, and stepping in the main execution loop is now considerably
more efficient as it only single-steps to the next source line if the
situation calls for it
SCCS-vsn: old/dbx/process.c 1.8
/* Copyright (c) 1982 Regents of the University of California */
/* Copyright (c) 1982 Regents of the University of California */
-static char sccsid[] = "@(#)process.c 1.7 %G%";
+static char sccsid[] = "@(#)process.c 1.8 %G%";
#define succeeds == true
#define fails == false
#define succeeds == true
#define fails == false
+public cont(signo)
+int signo;
{
dbintr = signal(SIGINT, intr);
if (just_started) {
{
dbintr = signal(SIGINT, intr);
if (just_started) {
error("can't continue execution");
}
isstopped = false;
error("can't continue execution");
}
isstopped = false;
}
for (;;) {
if (single_stepping) {
printnews();
} else {
setallbps();
}
for (;;) {
if (single_stepping) {
printnews();
} else {
setallbps();
unsetallbps();
if (bpact() fails) {
printstatus();
}
}
unsetallbps();
if (bpact() fails) {
printstatus();
}
}
+public resume(signo)
+int signo;
printf("execution resumes at pc 0x%x\n", process->reg[PROGCTR]);
fflush(stdout);
}
printf("execution resumes at pc 0x%x\n", process->reg[PROGCTR]);
fflush(stdout);
}
pc = process->reg[PROGCTR];
if (traceexec) {
printf("execution stops at pc 0x%x on sig %d\n",
pc = process->reg[PROGCTR];
if (traceexec) {
printf("execution stops at pc 0x%x on sig %d\n",
fflush(stdout);
}
if (p->status != STOPPED) {
fflush(stdout);
}
if (p->status != STOPPED) {
- error("program unexpectedly exited with %d", p->exitval);
+ if (p->signo != 0) {
+ error("program terminated by signal %d", p->signo);
+ } else {
+ error("program unexpectedly exited with %d", p->exitval);
+ }
+/*
+ * Single-step over the current machine instruction.
+ *
+ * If we're single-stepping by source line we want to step to the
+ * next source line. Otherwise we're going to continue so there's
+ * no reason to do all the work necessary to single-step to the next
+ * source line.
+ */
+
+private stepover()
+ Boolean b;
+
+ if (single_stepping) {
+ dostep(false);
+ } else {
+ b = inst_tracing;
+ inst_tracing = true;
+ dostep(false);
+ inst_tracing = b;
+ }
Address addr;
{
setbp(addr);
Address addr;
{
setbp(addr);
unsetbp(addr);
if (not isbperr()) {
printstatus();
unsetbp(addr);
if (not isbperr()) {
printstatus();
- * Continue a stopped process. The argument points to a PROCESS structure.
- * Before the process is restarted it's user area is modified according to
- * the values in the structure. When this routine finishes,
+ * Continue a stopped process. The first argument points to a Process
+ * structure. Before the process is restarted it's user area is modified
+ * according to the values in the structure. When this routine finishes,
* the structure has the new values from the process's user area.
*
* Pcont terminates when the process stops with a signal pending that
* is being traced (via psigtrace), or when the process terminates.
*/
* the structure has the new values from the process's user area.
*
* Pcont terminates when the process stops with a signal pending that
* is being traced (via psigtrace), or when the process terminates.
*/
error("program not active");
}
do {
error("program not active");
}
do {
sigs_off();
if (ptrace(CONT, p->pid, p->reg[PROGCTR], p->signo) < 0) {
panic("can't continue process");
sigs_off();
if (ptrace(CONT, p->pid, p->reg[PROGCTR], p->signo) < 0) {
panic("can't continue process");
sigs_off();
ptrace(SSTEP, p->pid, p->reg[PROGCTR], p->signo);
pwait(p->pid, &status);
sigs_off();
ptrace(SSTEP, p->pid, p->reg[PROGCTR], p->signo);
pwait(p->pid, &status);
* Set process's user area information from given process structure.
*/
* Set process's user area information from given process structure.
*/
+private setinfo(p, signo)
{
register int i;
register int r;
if (istraced(p)) {
{
register int i;
register int r;
if (istraced(p)) {
}
for (i = 0; i < NREG; i++) {
if ((r = p->reg[i]) != p->oreg[i]) {
}
for (i = 0; i < NREG; i++) {
if ((r = p->reg[i]) != p->oreg[i]) {