148104Sbostic /*-
2*62129Sbostic  * Copyright (c) 1980, 1993
3*62129Sbostic  *	The Regents of the University of California.  All rights reserved.
422567Sdist  *
548104Sbostic  * %sccs.include.redist.c%
648104Sbostic  *
7*62129Sbostic  *	@(#)breakpoint.h	8.1 (Berkeley) 06/06/93
822567Sdist  */
95448Slinton 
105448Slinton /*
115448Slinton  * Breakpoint module definitions.
125448Slinton  *
135448Slinton  * This module contains routines that manage breakpoints at a high level.
145448Slinton  * This includes adding and deleting breakpoints, handling the various
155448Slinton  * types of breakpoints when they happen, management of conditions for
165448Slinton  * breakpoints, and display information after single stepping.
175448Slinton  */
185448Slinton 
195448Slinton unsigned short tracing;
205448Slinton unsigned short var_tracing;
215448Slinton unsigned short inst_tracing;
225448Slinton 
235448Slinton BOOLEAN isstopped;
245448Slinton 
255448Slinton #define ss_lines		(tracing != 0)
265448Slinton #define ss_variables		(var_tracing != 0)
275448Slinton #define ss_instructions		(inst_tracing != 0)
285448Slinton #define single_stepping		(ss_lines || ss_variables || ss_instructions)
295448Slinton 
305448Slinton /*
315448Slinton  * types of breakpoints
325448Slinton  */
335448Slinton 
345448Slinton typedef enum {
355448Slinton 	ALL_ON,			/* turn TRACE on */
365448Slinton 	ALL_OFF,		/* turn TRACE off */
375448Slinton 	INST,			/* trace instruction (source line) */
385448Slinton 	CALL, RETURN,		/* trace procedure/function */
395448Slinton 	BLOCK_ON,		/* set CALL breakpoint */
405448Slinton 	BLOCK_OFF,		/* clear CALL breakpoint */
415448Slinton 	TERM_ON,		/* turn TRACEVAR on */
425448Slinton 	TERM_OFF,		/* turn TRACEVAR off */
435448Slinton 	AT_BP,			/* print expression at a line */
445448Slinton 	STOP_BP,		/* stop execution */
455448Slinton 	CALLPROC,		/* return from a "call"-ed procedure */
465448Slinton 	END_BP,			/* return from program */
475448Slinton 	STOP_ON,		/* start looking for stop condition */
485448Slinton 	STOP_OFF,		/* stop looking for stop condition */
495448Slinton } BPTYPE;
505448Slinton 
515448Slinton /*
525448Slinton  * Things that are on the tracing or condition list are either
535448Slinton  * associated with the trace (implying printing) or stop commands.
545448Slinton  */
555448Slinton 
565448Slinton typedef enum { TRPRINT, TRSTOP } TRTYPE;
575448Slinton 
585448Slinton /*
595448Slinton  * routines available from this module
605448Slinton  */
615448Slinton 
6233241Sbostic int addvar();		/* add a variable to the trace list */
6333241Sbostic int delvar();		/* delete a variable from the trace list */
6433241Sbostic int printvarnews();	/* print out variables that have changed */
6533241Sbostic int trfree();		/* free the entire trace list */
6633241Sbostic int addcond();		/* add a condition to the list */
6733241Sbostic int delcond();		/* delete a condition from the list */
685448Slinton BOOLEAN trcond();	/* determine if any trace condition is true */
695448Slinton BOOLEAN stopcond();	/* determine if any stop condition is true */
705448Slinton 
7133241Sbostic int addbp();		/* add a breakpoint */
7233241Sbostic int delbp();		/* delete a breakpoint, return FALSE if unsuccessful */
7333241Sbostic int bpfree();		/* free all breakpoint information */
7433241Sbostic int setallbps();	/* set traps for all breakpoints */
7533241Sbostic int unsetallbps();	/* remove traps at all breakpoints */
765448Slinton BOOLEAN bpact();	/* handle a breakpoint */
7733241Sbostic int fixbps();		/* destroy temporary breakpoints left after a fault */
7833241Sbostic int status();		/* list items being traced */
79