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