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