1 /*
2  * Copyright (c) 1980 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  *
6  *	@(#)breakpoint.h	5.2 (Berkeley) 01/03/88
7  */
8 
9 /*
10  * Breakpoint module definitions.
11  *
12  * This module contains routines that manage breakpoints at a high level.
13  * This includes adding and deleting breakpoints, handling the various
14  * types of breakpoints when they happen, management of conditions for
15  * breakpoints, and display information after single stepping.
16  */
17 
18 unsigned short tracing;
19 unsigned short var_tracing;
20 unsigned short inst_tracing;
21 
22 BOOLEAN isstopped;
23 
24 #define ss_lines		(tracing != 0)
25 #define ss_variables		(var_tracing != 0)
26 #define ss_instructions		(inst_tracing != 0)
27 #define single_stepping		(ss_lines || ss_variables || ss_instructions)
28 
29 /*
30  * types of breakpoints
31  */
32 
33 typedef enum {
34 	ALL_ON,			/* turn TRACE on */
35 	ALL_OFF,		/* turn TRACE off */
36 	INST,			/* trace instruction (source line) */
37 	CALL, RETURN,		/* trace procedure/function */
38 	BLOCK_ON,		/* set CALL breakpoint */
39 	BLOCK_OFF,		/* clear CALL breakpoint */
40 	TERM_ON,		/* turn TRACEVAR on */
41 	TERM_OFF,		/* turn TRACEVAR off */
42 	AT_BP,			/* print expression at a line */
43 	STOP_BP,		/* stop execution */
44 	CALLPROC,		/* return from a "call"-ed procedure */
45 	END_BP,			/* return from program */
46 	STOP_ON,		/* start looking for stop condition */
47 	STOP_OFF,		/* stop looking for stop condition */
48 } BPTYPE;
49 
50 /*
51  * Things that are on the tracing or condition list are either
52  * associated with the trace (implying printing) or stop commands.
53  */
54 
55 typedef enum { TRPRINT, TRSTOP } TRTYPE;
56 
57 /*
58  * routines available from this module
59  */
60 
61 int addvar();		/* add a variable to the trace list */
62 int delvar();		/* delete a variable from the trace list */
63 int printvarnews();	/* print out variables that have changed */
64 int trfree();		/* free the entire trace list */
65 int addcond();		/* add a condition to the list */
66 int delcond();		/* delete a condition from the list */
67 BOOLEAN trcond();	/* determine if any trace condition is true */
68 BOOLEAN stopcond();	/* determine if any stop condition is true */
69 
70 int addbp();		/* add a breakpoint */
71 int delbp();		/* delete a breakpoint, return FALSE if unsuccessful */
72 int bpfree();		/* free all breakpoint information */
73 int setallbps();	/* set traps for all breakpoints */
74 int unsetallbps();	/* remove traps at all breakpoints */
75 BOOLEAN bpact();	/* handle a breakpoint */
76 int fixbps();		/* destroy temporary breakpoints left after a fault */
77 int status();		/* list items being traced */
78