[m-rev.] for review: mdb ignore counts

Zoltan Somogyi zs at cs.mu.OZ.AU
Mon Aug 6 17:08:01 AEST 2001


On 03-Aug-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> Otherwise that change looks fine.  Please post a relative diff
> when you've addressed those review comments.

Here it is. I haven't bootchecked it yet, but I don't expect any problems.

Zoltan.

Diffing browser
Diffing compiler
Diffing deep_profiler
Diffing doc
--- ws41.basis//doc/mdb_command_list	Mon Aug  6 12:58:42 2001
+++ ws41/doc/mdb_command_list	Mon Aug  6 16:52:26 2001
@@ -34,6 +34,7 @@
 	{ "parameter", "echo" },
 	{ "parameter", "scroll" },
 	{ "parameter", "context" },
+	{ "parameter", "scope" },
 	{ "parameter", "alias" },
 	{ "parameter", "unalias" },
 	{ "help", "document_category" },
--- ws41.basis//doc/mdb_command_test.inp	Mon Aug  6 12:58:42 2001
+++ ws41/doc/mdb_command_test.inp	Mon Aug  6 16:52:26 2001
@@ -34,6 +34,7 @@
 echo                 xyzzy xyzzy xyzzy xyzzy xyzzy
 scroll               xyzzy xyzzy xyzzy xyzzy xyzzy
 context              xyzzy xyzzy xyzzy xyzzy xyzzy
+scope                xyzzy xyzzy xyzzy xyzzy xyzzy
 unalias              xyzzy xyzzy xyzzy xyzzy xyzzy
 histogram_all        xyzzy xyzzy xyzzy xyzzy xyzzy
 histogram_exp        xyzzy xyzzy xyzzy xyzzy xyzzy
@@ -1734,7 +1734,7 @@
 The user may associate a break point
 with some events that occur inside a procedure;
 the invocation condition of the break point says which events these are.
-The four possible invocation conditions are:
+The four possible invocation conditions (also called scopes) are:
 @sp 1
 @itemize @bullet
 @item
@@ -2390,7 +2390,7 @@
 @cindex Breakpoints
 @sp 1
 @table @code
- at item break [-PS] [-E at var{IC}] [-I at var{IC}] @var{filename}:@var{linenumber}
+ at item break [-PS] [-E at var{ignore-count}] [-I at var{ignore-count}] @var{filename}:@var{linenumber}
 @kindex break (mdb command)
 Puts a break point on the specified line of the specified source file,
 if there is an event or a call at that position.
@@ -2400,16 +2400,20 @@
 The options @samp{-P} or @samp{--print}, and @samp{-S} or @samp{--stop}
 specify the action to be taken at the break point.
 @sp 1
-The option @samp{-E at var{IC}} tells the debugger
-to ignore the breakpoint until after @var{IC} occurrences of a call event
+The options @samp{-E at var{ignore-count}}
+and @samp{--ignore-entry @var{ignore-count}}
+tell the debugger to ignore the breakpoint
+until after @var{ignore-count} occurrences of a call event
 that matches the breakpoint.
-The option @samp{-I at var{IC}} tells the debugger
-to ignore the breakpoint until after @var{IC} occurrences of interface events
+The options @samp{-I at var{ignore-count}}
+and @samp{--ignore-interface @var{ignore-count}}
+tell the debugger to ignore the breakpoint
+until after @var{ignore-count} occurrences of interface events
 that match the breakpoint.
 @sp 1
 By default, the initial state of the break point is @samp{stop},
 and the ignore count is zero.
- at item break [-AOPSaei] [-E at var{IC}] [-I at var{IC}] @var{proc-spec}
+ at item break [-AOPSaei] [-E at var{ignore-count}] [-I at var{ignore-count}] @var{proc-spec}
 @c <module name> <predicate name> [<arity> [<mode> [<predfunc>]]]
 Puts a break point on the specified procedure.
 @sp 1
@@ -2425,23 +2429,32 @@
 on all matched procedures or just one, and if so, which one.
 @sp 1
 The options @samp{-P} or @samp{--print}, and @samp{-S} or @samp{--stop}
-specify the action to be taken at the break point,
-while the options @samp{-a} or @samp{--all},
+specify the action to be taken at the break point.
+ at sp 1
+The options @samp{-a} or @samp{--all},
 @samp{-e} or @samp{--entry}, and @samp{-i} or @samp{--interface}
 specify the invocation conditions of the break point.
- at sp 1
-The option @samp{-E at var{IC}} tells the debugger
-to ignore the breakpoint until after @var{IC} occurrences of a call event
+If none of these options are specified,
+the default is the one indicated by the current scope
+(see the @samp{scope} command below).
+The initial scope is @samp{interface}.
+ at sp 1
+The options @samp{-E at var{ignore-count}}
+and @samp{--ignore-entry @var{ignore-count}}
+tell the debugger to ignore the breakpoint
+until after @var{ignore-count} occurrences of a call event
 that matches the breakpoint.
-The option @samp{-I at var{IC}} tells the debugger
-to ignore the breakpoint until after @var{IC} occurrences of interface events
+The options @samp{-I at var{ignore-count}}
+and @samp{--ignore-interface @var{ignore-count}}
+tell the debugger to ignore the breakpoint
+until after @var{ignore-count} occurrences of interface events
 that match the breakpoint.
 @sp 1
 By default, the action of the break point is @samp{stop},
 its invocation condition is @samp{interface},
 and the ignore count is zero.
 @sp 1
- at item break [-PS] [-E at var{IC}] [-I at var{IC}] here
+ at item break [-PS] [-E at var{ignore-count}] [-I at var{ignore-count}] here
 Puts a break point on the procedure referred to by the current event,
 with the invocation condition being the event at the current location
 in the procedure body.
@@ -2449,11 +2462,15 @@
 The options @samp{-P} or @samp{--print}, and @samp{-S} or @samp{--stop}
 specify the action to be taken at the break point.
 @sp 1
-The option @samp{-E at var{IC}} tells the debugger
-to ignore the breakpoint until after @var{IC} occurrences of a call event
+The options @samp{-E at var{ignore-count}}
+and @samp{--ignore-entry @var{ignore-count}}
+tell the debugger to ignore the breakpoint
+until after @var{ignore-count} occurrences of a call event
 that matches the breakpoint.
-The option @samp{-I at var{IC}} tells the debugger
-to ignore the breakpoint until after @var{IC} occurrences of interface events
+The options @samp{-I at var{ignore-count}}
+and @samp{--ignore-interface @var{ignore-count}}
+tell the debugger to ignore the breakpoint
+until after @var{ignore-count} occurrences of interface events
 that match the breakpoint.
 @sp 1
 By default, the initial state of the break point is @samp{stop},
@@ -2462,26 +2479,34 @@
 @item break info
 Lists the details and status of all break points.
 @sp 1
- at item ignore [-E at var{IC}] [-I at var{IC}] @var{num}
+ at item ignore [-E at var{ignore-count}] [-I at var{ignore-count}] @var{num}
 @sp 1
-The option @samp{-E at var{IC}} tells the debugger
-to ignore the breakpoint until after @var{IC} occurrences of a call event
+The options @samp{-E at var{ignore-count}}
+and @samp{--ignore-entry @var{ignore-count}}
+tell the debugger to ignore the breakpoint
+until after @var{ignore-count} occurrences of a call event
 that matches the breakpoint with the specified number.
-The option @samp{-I at var{IC}} tells the debugger
-to ignore the breakpoint until after @var{IC} occurrences of interface events
+The options @samp{-I at var{ignore-count}}
+and @samp{--ignore-interface @var{ignore-count}}
+tell the debugger to ignore the breakpoint
+until after @var{ignore-count} occurrences of interface events
 that match the breakpoint with the specified number.
 If neither option is given,
 the default is to ignore one call event
 that matches the breakpoint with the specified number.
 Reports an error if there is no break point with the specified number.
 @sp 1
- at item ignore [-E at var{IC}] [-I at var{IC}]
+ at item ignore [-E at var{ignore-count}] [-I at var{ignore-count}]
 @sp 1
-The option @samp{-E at var{IC}} tells the debugger
-to ignore the breakpoint until after @var{IC} occurrences of a call event
+The options @samp{-E at var{ignore-count}}
+and @samp{--ignore-entry @var{ignore-count}}
+tell the debugger to ignore the breakpoint
+until after @var{ignore-count} occurrences of a call event
 that matches the most recently added breakpoint.
-The option @samp{-I at var{IC}} tells the debugger
-to ignore the breakpoint until after @var{IC} occurrences of interface events
+The options @samp{-I at var{ignore-count}}
+and @samp{--ignore-interface @var{ignore-count}}
+tell the debugger to ignore the breakpoint
+until after @var{ignore-count} occurrences of interface events
 that match the most recently added breakpoint.
 If neither option is given,
 the default is to ignore one call event
@@ -2640,6 +2665,24 @@
 @sp 1
 @item context
 Reports where contexts are being printed.
+ at sp 1
+ at item scope all
+Sets the default scope of new breakpoints to "all",
+i.e. by default, new breakpoints on procedures
+will stop at all events in the procedure.
+ at sp 1
+ at item scope interface
+Sets the default scope of new breakpoints to "interface",
+i.e. by default, new breakpoints on procedures
+will stop at all interface events in the procedure.
+ at sp 1
+ at item scope entry
+Sets the default scope of new breakpoints to "entry",
+i.e. by default, new breakpoints on procedures
+will stop only at events representing calls to the procedure.
+ at sp 1
+ at item scope
+Reports the current default scope of new breakpoints.
 @sp 1
 @item alias @var{name} @var{command} [@var{command-parameter} ...]
 @kindex alias (mdb command)
Diffing library
Diffing runtime
--- ws41.basis//runtime/mercury_conf.h.in	Mon Aug  6 13:00:44 2001
+++ ws41/runtime/mercury_conf.h.in	Mon Aug  6 16:44:48 2001
@@ -146,6 +146,7 @@
 ** The following macros are defined iff the corresponding function or
 ** system call is available:
 **
+**	HAVE_SNPRINTF 		we have the snprintf() function.
 **	HAVE_VSNPRINTF 		we have the vsnprintf() function.
 **	HAVE__VSNPRINTF 	we have the _vsnprintf() function.
 **	HAVE_SYSCONF     	we have the sysconf() system call.
@@ -168,6 +169,7 @@
 **				rather than a function, so you should use
 **				#if defined(fileno) || defined(HAVE_FILENO)
 */
+#undef	HAVE_SNPRINTF
 #undef	HAVE_VSNPRINTF
 #undef	HAVE__VSNPRINTF
 #undef	HAVE_SYSCONF
Diffing scripts
Diffing trace
--- ws41.basis//trace/mercury_trace_internal.c	Mon Aug  6 13:00:56 2001
+++ ws41/trace/mercury_trace_internal.c	Mon Aug  6 16:43:40 2001
@@ -1170,8 +1170,10 @@
 		when = MR_default_breakpoint_scope;
 		action = MR_SPY_STOP;
 		multi_match = MR_MULTIMATCH_ASK;
-		/* The value of ignore_when doesn't matter */
-		/* while ignore_count contains zero. */
+		/*
+		** The value of ignore_when doesn't matter
+		** while ignore_count contains zero.
+		*/
 		ignore_when = MR_SPY_DONT_IGNORE;
 		ignore_count = 0;
 		if (! MR_trace_options_when_action_multi_ignore(&when, &action,
--- ws41.basis//trace/mercury_trace_spy.c	Mon Aug  6 13:00:56 2001
+++ ws41/trace/mercury_trace_spy.c	Mon Aug  6 16:52:51 2001
@@ -373,6 +373,10 @@
 	return point_slot;
 }
 
+/* 1024 characters should be big enough ... */
+#define		MR_ERROR_MSG_BUF_SIZE	1024
+static char	MR_error_msg_buf[MR_ERROR_MSG_BUF_SIZE];
+
 int
 MR_add_line_spy_point(MR_Spy_Action action, MR_Spy_Ignore_When ignore_when,
 	int ignore_count, const char *orig_filename, int linenumber,
@@ -405,11 +409,20 @@
 
 	if (new_size == old_size) {
 		/* there were no matching labels */
-		char	buf[1024];	/* this should be big enough ... */
-
-		snprintf(buf, 1024, "there is no event at %s:%d",
+#ifdef	HAVE_SNPRINTF
+		snprintf(MR_error_msg_buf, MR_ERROR_MSG_BUF_SIZE,
+			"there is no event at %s:%d",
 			filename, linenumber);
-		*problem = buf;
+#else
+		/* not absolutely safe, but the risk of overflow is minimal */
+		sprintf(MR_error_msg_buf,
+			"there is no event at %s:%d",
+			filename, linenumber);
+		if (strlen(MR_error_msg_buf) >= MR_ERROR_MSG_BUF_SIZE) {
+			MR_fatal_error("MR_add_line_spy_point: buf overflow");
+		}
+#endif
+		*problem = MR_error_msg_buf;
 		return -1;
 	}
 
Diffing tools
Diffing util
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list