* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
static char sccsid
[] = "@(#)trinfo.c 5.2 (Berkeley) 4/7/87";
* Trace information management.
* The trace information is a list of variables that are being
* traced or whose value changing should cause a stop.
#include "process/process.rep"
#include "process/pxinfo.h"
* When tracing variables we keep a copy of their most recent value
* and compare it to the current one each time a breakpoint occurs.
* MAXTRSIZE is the maximum size variable we allow.
* The tracing structure is a list of information about all the
* variables that are being traced.
* add a variable to be traced
addvar(trtype
, node
, cond
)
tp
->traddr
= (ADDRESS
) -1;
* remove a variable from the trace list
delvar(trtype
, node
, cond
)
register TRINFO
*tp
, *last
;
for (tp
= trhead
; tp
!= NIL
; tp
= tp
->trnext
) {
if (tp
->trtype
== trtype
&&
tr_equal(tp
->trvar
, node
) &&
tr_equal(tp
->trcond
, cond
)) {
trerror("can't delete term %t", node
);
last
->trnext
= tp
->trnext
;
if (tp
->trvalue
!= NIL
) {
* Print out any news about variables in the list whose
for (tp
= trhead
; tp
!= NIL
; tp
= tp
->trnext
) {
if (tp
->trcond
!= NIL
&& !cond(tp
->trcond
)) {
while (s
!= NIL
&& s
!= tp
->trblock
) {
if (tp
->traddr
== (ADDRESS
) -1) {
tp
->traddr
= lval(p
->left
);
dread(buff
, tp
->traddr
, n
);
if (tp
->trvalue
== NIL
) {
tp
->trvalue
= alloc(n
, char);
mov(buff
, tp
->trvalue
, n
);
if (tp
->trtype
== TRPRINT
) {
printf("initially (at ");
printwhere(curline
, srcfilename(pc
));
} else if (cmp(tp
->trvalue
, buff
, n
) != 0) {
mov(buff
, tp
->trvalue
, n
);
printwhere(prevline
, srcfilename(pc
));
if (tp
->trtype
== TRSTOP
) {
* Free the table. Note that trvar and trcond fields are not freed,
* this is because they are the same as in the breakpoint table and
* are freed by the bpfree routine.
register TRINFO
*tp
, *next
;
for (tp
= trhead
; tp
!= NIL
; tp
= next
) {
if (tp
->trvalue
!= NIL
) {