|
|
DataMuseum.dkPresents historical artifacts from the history of: CP/M |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about CP/M Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 2688 (0xa80)
Types: TextFile
Names: »ATBREAK.C«
└─⟦b35f94715⟧ Bits:30003295 BDS C version 1.50 arbejdsdiskette til RC703 Piccolo
└─⟦b35f94715⟧ Bits:30005324 BDS C version 1.50 arbejdsdiskette til RC703 Piccolo
└─⟦this⟧ »ATBREAK.C«
#include "cdb2.h"
/* Copyright (c) 1982 by J. David Kirkland, Jr. */
isbreak() æ
/* isbreak() determines whether cursn and curfnt are a breakpoint.
* The CALLER must check that curbreak != 0xff
*/
/* struct breakentry *isb_q; */
isb_q = breaktabÆcurbreakÅ;
/* first, try to find an entry in breaktab */
while (curfnt==isb_q->bfnt && cursn > isb_q->bsn)
isb_q++;
/* did we find one? if so, decrement bcount and check for zero */
if (curfnt!=isb_q->bfnt øø cursn!=isb_q->bsn øø --(isb_q->bcount) )
return 0;
else æ
isb_q->bcount = 1;
return 1;
å
å
atbreak (sp) struct savearea *sp; æ
/* the assembly package calls atbreak whenever a RST is encountered.
* A pointer to the savearea is passed
*/
unsigned sn, *resume, atret();
if (0==(sn = *(resume = sp->statement++))) æ
/* sn == 0 means entry to a new function; stack on tracetab */
if (ntraces>=MAXTRACES) æ
if (!trace_full) æ
printf("fn trace table full (size is %d);",
MAXTRACES);
printf(" fn tracing inactiveØn");
trace_full = 1;
å
å
else æ
tracetabÆntracesÅ.taddr = sp->caller_return;
tracetabÆntraces++Å.tsn = cursn;
sp->caller_return = atret;
å
curbreak = (curfnt = addr2fnt(resume))->fntbreakindex;
curargs = (sp+1);
å
cursn = sn;
if (trace_display && walkcount!=1) æ
printf(" trace: %s ",curfnt->fntname);
printasn(sn);
printf(" Æ%04xÅØn",sp->statement);
å
if ((walkcount && !--walkcount) øø kbhit() øø
(curbreak!=NOBREAK && isbreak()) ) æ
/* at a breakpoint */
walkcount = 0;
trace_display = 0;
printf("Ønbreak at %s ",curfnt->fntname);
printasn(sn);
printf(" Æ%04xÅØn",sp->statement);
cursave = sp;
command();
å
resumeit(sp);
å
atreturn (h) int h; æ
/* when a function returns, it returns here because atbreak() changed
* the stacked return address. atreturn() checks for a breakpoint
* at sn == -1 (i.e., function return) and acts accordingly.
*/
char *t, stop;
if (trace_full) æ
printf("fn tracing now restored.Øn");
trace_full = 0;
å
cursn = -1;
if ( (stop = (curbreak!=NOBREAK && isbreak()) øø
(walkcount && !--walkcount) øø kbhit() ) øø trace_display ) æ
printf(stop ? "Øn" : " trace: ");
printf("%s returning %04x = %d = '",curfnt->fntname,h,h);
interprete(h>>8);
interprete(h&255);
printf("'Øn");
if (stop)
command();
å
t = tracetabÆ--ntracesÅ.taddr;
curbreak = (curfnt = addr2fnt(t))->fntbreakindex;
curargs = NIL;
return t;
å
«eof»