for review: provide feedback when changing levels

Zoltan Somogyi zs at cs.mu.OZ.AU
Fri Nov 13 19:04:55 AEDT 1998


For Fergus, since it implements his request.

Estimated hours taken: 4

Provide feedback for the "up", "down" and "level" commands in the debugger,
in the form of a line from an enhanced stack dump.

runtime/mercury_stack_layout.h:
	Fix the documentation of the call event number slot.

runtime/mercury_stack_trace.[ch]:
	Generalize the stack dump routines, to make them capable of printing
	the call event number, call sequence number and call depth slots
	of calls to traced procedures.

trace/mercury_trace_internal.c:
	Add a new option, -d or --detailed, to the stack command, which
	prints the call event number, call sequence number and call depth slots
	of every ancestor procedure that is execution traced.

	When changing levels, provide feedback by identifying the call
	to which the level is now set. The feedback is the detailed stack
	trace line for that call.

	When changing levels, check that we have exec trace info for the call,
	not just stack trace info.

	Fix an old bug: tables of long options should be and now are
	terminated by a NULL row.

doc/user_guide.texi:
	Document the new option of the stack command.

	Fix the documentation of the errors in the level change commands.

tests/debugger/queens.{inp,exp}:
	Test the new functionality of the stack command, and update the
	expected output.

Zoltan.

cvs diff: Diffing .
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing bytecode/test
cvs diff: Diffing compiler
cvs diff: Diffing compiler/notes
cvs diff: Diffing doc
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.143
diff -u -u -r1.143 user_guide.texi
--- user_guide.texi	1998/11/12 03:26:24	1.143
+++ user_guide.texi	1998/11/13 07:47:27
@@ -3340,12 +3340,18 @@
 even if this is very big. Later it will merely invoke a configurable
 dynamic term browser, which will eventually have its own sublanguage.
 @sp 1
- at item stack
-Prints the names of the ancestors of the call specified by the
-current event. If two or more ancestor calls are for the same
-predicate, the procedure identification will be printed once
+ at item stack [-d]
+Prints the names of the ancestors of the call
+specified by the current event.
+If two or more ancestor calls are for the same procedure,
+the procedure identification will be printed once
 with the appropriate multiplicity annotation.
 @sp 1
+The option @samp{-d} or @samp{--detailed}
+specifies that for each ancestor call,
+the call's event number, sequence number and depth should also be printed
+if the call is to a procedure that is being execution traced.
+ at sp 1
 This command will report an error if there is no stack trace
 information available about any ancestor.
 @sp 1
@@ -3365,17 +3371,24 @@
 @item down [@var{num}]
 Sets the current environment to the stack frame
 of the @var{num}'th level descendant of the current environment
-(the immediate caller is the first-level ancestor).
+(the procedure called by the current environment
+is the first-level descendant).
 @sp 1
 If @var{num} is not specified, the default value is one.
 @sp 1
-This command will report an error if the current environment
-doesn't have the required number of descendants.
+This command will report an error
+if there is no execution trace information about the requested descendant.
 @sp 1
 @item level [@var{num}]
 Sets the current environment to the stack frame of the @var{num}'th
 level ancestor of the call to which the current event belongs.
 The zero'th ancestor is the call of the event itself.
+ at sp 1
+This command will report an error
+if the current environment doesn't have the required number of ancestors,
+or if there is no execution trace information about the requested ancestor,
+or if there is no stack trace information about any of the ancestors
+between the current environment and the requested ancestor.
 @sp 1
 @item current
 Prints the current event.
cvs diff: Diffing extras
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/exceptions
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing library
cvs diff: Diffing lp_solve
cvs diff: Diffing lp_solve/lp_examples
cvs diff: Diffing profiler
cvs diff: Diffing runtime
Index: runtime/mercury_stack_layout.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stack_layout.h,v
retrieving revision 1.14
diff -u -u -r1.14 mercury_stack_layout.h
--- mercury_stack_layout.h	1998/11/12 03:16:29	1.14
+++ mercury_stack_layout.h	1998/11/13 07:19:38
@@ -381,11 +381,18 @@
 ** In procedures compiled with execution tracing, three items are stored
 ** in stack slots with fixed numbers. They are:
 **
-**	the event number of the call event,
+**	the event number of the last event before the call event,
 **	the call number, and
 **	the call depth.
 **
-** The following macros will access them. They can be used whenever
+** Note that the first slot does not store the number of the call event
+** itself, but rather the number of the call event minus one. The reason
+** for this is that (a) incrementing the number stored in this slot would
+** increase executable size, and (b) if the procedure is shallow traced,
+** MR_trace may not be called for the call event, so we cannot shift the
+** burden of initializing fields to the MR_trace of the call event either.
+**
+** The following macros will access the fixed slots. They can be used whenever
 ** MR_ENTRY_LAYOUT_HAS_EXEC_TRACE(entry) is true; which set you should use
 ** depends on the determinism of the procedure.
 **
Index: runtime/mercury_stack_trace.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stack_trace.c,v
retrieving revision 1.21
diff -u -u -r1.21 mercury_stack_trace.c
--- mercury_stack_trace.c	1998/11/05 03:53:44	1.21
+++ mercury_stack_trace.c	1998/11/13 07:25:42
@@ -35,14 +35,16 @@
 
 static	void	MR_dump_stack_record_init(void);
 static	void	MR_dump_stack_record_frame(FILE *fp,
-			const MR_Stack_Layout_Entry *);
+			const MR_Stack_Layout_Entry *,
+			Word *base_sp, Word *base_curfr);
 static	void	MR_dump_stack_record_flush(FILE *fp);
 static	void	MR_dump_stack_record_print(FILE *fp,
-			const MR_Stack_Layout_Entry *, int, int);
+			const MR_Stack_Layout_Entry *, int, int,
+			Word *base_sp, Word *base_curfr);
 
 void
 MR_dump_stack(Code *success_pointer, Word *det_stack_pointer,
-		Word *current_frame)
+	Word *current_frame, bool include_trace_data)
 {
 #ifndef MR_STACK_TRACE
 	fprintf(stderr, "Stack dump not available in this grade.\n");
@@ -62,7 +64,7 @@
 		layout = label->i_layout;
 		entry_layout = layout->MR_sll_entry;
 		result = MR_dump_stack_from_layout(stderr, entry_layout,
-			det_stack_pointer, current_frame);
+			det_stack_pointer, current_frame, include_trace_data);
 
 		if (result != NULL) {
 			fprintf(stderr, "%s\n", result);
@@ -73,13 +75,15 @@
 
 const char *
 MR_dump_stack_from_layout(FILE *fp, const MR_Stack_Layout_Entry *entry_layout,
-	Word *det_stack_pointer, Word *current_frame)
+	Word *det_stack_pointer, Word *current_frame, bool include_trace_data)
 {
 	MR_Stack_Walk_Step_Result	result;
 	const MR_Stack_Layout_Label	*return_label_layout;
 	const char			*problem;
 	Word				*stack_trace_sp;
 	Word				*stack_trace_curfr;
+	Word				*old_trace_sp;
+	Word				*old_trace_curfr;
 
 	do_init_modules();
 	MR_dump_stack_record_init();
@@ -88,17 +92,33 @@
 	stack_trace_curfr = current_frame;
 
 	do {
+		old_trace_sp    = stack_trace_sp;
+		old_trace_curfr = stack_trace_curfr;
+
 		result = MR_stack_walk_step(entry_layout, &return_label_layout,
 				&stack_trace_sp, &stack_trace_curfr, &problem);
 		if (result == STEP_ERROR_BEFORE) {
 			MR_dump_stack_record_flush(fp);
 			return problem;
 		} else if (result == STEP_ERROR_AFTER) {
-			MR_dump_stack_record_frame(fp, entry_layout);
+			if (include_trace_data) {
+				MR_dump_stack_record_frame(fp, entry_layout,
+					old_trace_sp, old_trace_curfr);
+			} else {
+				MR_dump_stack_record_frame(fp, entry_layout,
+					NULL, NULL);
+			}
+
 			MR_dump_stack_record_flush(fp);
 			return problem;
 		} else {
-			MR_dump_stack_record_frame(fp, entry_layout);
+			if (include_trace_data) {
+				MR_dump_stack_record_frame(fp, entry_layout,
+					old_trace_sp, old_trace_curfr);
+			} else {
+				MR_dump_stack_record_frame(fp, entry_layout,
+					NULL, NULL);
+			}
 		}
 
 		if (return_label_layout == NULL) {
@@ -258,6 +278,8 @@
 static	const MR_Stack_Layout_Entry	*prev_entry_layout;
 static	int				prev_entry_layout_count;
 static	int				prev_entry_start_level;
+static	Word				*prev_entry_base_sp;
+static	Word				*prev_entry_base_curfr;
 static	int				current_level;
 
 static void
@@ -270,15 +292,42 @@
 }
 
 static void
-MR_dump_stack_record_frame(FILE *fp, const MR_Stack_Layout_Entry *entry_layout)
+MR_dump_stack_record_frame(FILE *fp, const MR_Stack_Layout_Entry *entry_layout,
+	Word *base_sp, Word *base_curfr)
 {
-	if (entry_layout == prev_entry_layout) {
-		prev_entry_layout_count++;
-	} else {
+	bool	must_flush;
+
+	must_flush = 
+		/*
+		** We cannot merge two calls if they are to different
+		** procedures.
+		*/
+
+		(entry_layout != prev_entry_layout) ||
+
+		/*
+		** We cannot merge two calls even to the same procedure.
+		** if we are printing trace data, since this will differ
+		** between the calls.
+		**
+		** Note that it is not possible for two calls to the same
+		** procedure to differ on whether the procedure has trace
+		** layout data or not; this is why we don't have to test
+		** prev_entry_base_sp and prev_entry_base_curfr.
+		*/
+
+		((base_sp != NULL) || (base_curfr != NULL));
+
+	if (must_flush) {
 		MR_dump_stack_record_flush(fp);
+
 		prev_entry_layout = entry_layout;
 		prev_entry_layout_count = 1;
 		prev_entry_start_level = current_level;
+		prev_entry_base_sp = base_sp;
+		prev_entry_base_curfr = base_curfr;
+	} else {
+		prev_entry_layout_count++;
 	}
 
 	current_level++;
@@ -289,37 +338,68 @@
 {
 	if (prev_entry_layout != NULL) {
 		MR_dump_stack_record_print(fp, prev_entry_layout,
-			prev_entry_layout_count, prev_entry_start_level);
+			prev_entry_layout_count, prev_entry_start_level,
+			prev_entry_base_sp, prev_entry_base_curfr);
 	}
 }
 
 static void
 MR_dump_stack_record_print(FILE *fp, const MR_Stack_Layout_Entry *entry_layout,
-	int count, int start_level)
+	int count, int start_level, Word *base_sp, Word *base_curfr)
 {
-	fprintf(fp, "%9d ", start_level);
+	fprintf(fp, "%4d ", start_level);
 
 	if (count > 1) {
 		fprintf(fp, " %3d* ", count);
-	} else {
+	} else if ((base_sp == NULL) && (base_curfr == NULL)) {
 		fprintf(fp, "%5s ", "");
+	} else {
+		/*
+		** If we are printing trace data, we need all the horizonal
+		** room we can get, and there will not be any repeated lines,
+		** so we don't reserve space for the repeat counts.
+		*/
 	}
 
-	MR_print_proc_id(fp, entry_layout, NULL);
+	MR_print_proc_id(fp, entry_layout, NULL, base_sp, base_curfr);
 }
 
 void
 MR_print_proc_id_for_debugger(const MR_Stack_Layout_Entry *entry_layout)
 {
-	MR_print_proc_id(stdout, entry_layout, NULL);
+	MR_print_proc_id(stdout, entry_layout, NULL, NULL, NULL);
 }
 
 void
 MR_print_proc_id(FILE *fp, const MR_Stack_Layout_Entry *entry,
-	const char *extra)
+	const char *extra, Word *base_sp, Word *base_curfr)
 {
 	if (! MR_ENTRY_LAYOUT_HAS_PROC_ID(entry)) {
 		fatal_error("cannot print procedure id without layout");
+	}
+
+	if (MR_ENTRY_LAYOUT_HAS_EXEC_TRACE(entry)) {
+		if (MR_DETISM_DET_STACK(entry->MR_sle_detism)) {
+			if (base_sp != NULL) {
+				fprintf(fp, "%7lu %7lu %4lu ",
+					(unsigned long)
+					MR_event_num_stackvar(base_sp) + 1,
+					(unsigned long)
+					MR_call_num_stackvar(base_sp),
+					(unsigned long)
+					MR_call_depth_stackvar(base_sp));
+			}
+		} else {
+			if (base_curfr != NULL) {
+				fprintf(fp, "%7lu %7lu %4lu ",
+					(unsigned long)
+					MR_event_num_framevar(base_curfr) + 1,
+					(unsigned long)
+					MR_call_num_framevar(base_curfr),
+					(unsigned long)
+					MR_call_depth_framevar(base_curfr));
+			}
+		}
 	}
 
 	if (MR_ENTRY_LAYOUT_COMPILER_GENERATED(entry)) {
Index: runtime/mercury_stack_trace.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stack_trace.h,v
retrieving revision 1.12
diff -u -u -r1.12 mercury_stack_trace.h
--- mercury_stack_trace.h	1998/11/09 10:24:39	1.12
+++ mercury_stack_trace.h	1998/11/13 06:46:22
@@ -21,7 +21,9 @@
 ** MR_dump_stack:
 ** 	Given the succip, det stack pointer and current frame, generate a 
 ** 	stack dump showing the name of each active procedure on the
-** 	stack.
+** 	stack. If include_trace_data data is set, also print the
+**	call event number, call sequence number and depth for every
+**	traced procedure.
 ** 	NOTE: MR_dump_stack will assume that the succip is for the
 ** 	topmost stack frame.  If you call MR_dump_stack from some
 ** 	pragma c_code, that may not be the case.
@@ -39,7 +41,7 @@
 */
 
 extern	void	MR_dump_stack(Code *success_pointer, Word *det_stack_pointer,
-			Word *current_frame);
+			Word *current_frame, bool include_trace_data);
 
 /*
 ** MR_dump_stack_from_layout:
@@ -53,7 +55,8 @@
 
 extern	const char	*MR_dump_stack_from_layout(FILE *fp,
 				const MR_Stack_Layout_Entry *entry_layout,
-				Word *det_stack_pointer, Word *current_frame);
+				Word *det_stack_pointer, Word *current_frame,
+				bool include_trace_data);
 
 /*
 ** MR_dump_nondet_stack_from_layout:
@@ -136,11 +139,15 @@
 ** consisting of "pred" or "func", module name, pred or func name, arity,
 ** mode number and determinism, followed by an optional extra string,
 ** and a newline.
+**
+** If the procedure has trace layout information and the relevant one of
+** base_sp and base_curfr is not NULL, it also prints the call event number,
+** call sequence number and call depth of the call.
 */
 
 extern	void	MR_print_proc_id_for_debugger(
 			const MR_Stack_Layout_Entry *entry);
 extern	void	MR_print_proc_id(FILE *fp, const MR_Stack_Layout_Entry *entry,
-			const char *extra);
+			const char *extra, Word *base_sp, Word *base_curfr);
 
 #endif /* MERCURY_STACK_TRACE_H */
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
Index: tests/debugger/queens.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/queens.exp,v
retrieving revision 1.5
diff -u -u -r1.5 queens.exp
--- queens.exp	1998/11/12 03:26:33	1.5
+++ queens.exp	1998/11/13 07:51:07
@@ -33,10 +33,12 @@
        V_10                 		[2, 3, 4, 5]
        V_11                 		1
 mdb> level 1
+   1       5       4    3 pred queens:qperm/2-0 (nondet) 
 Ancestor level set to 1.
 mdb> print *
        HeadVar__1           		[1, 2, 3, 4, 5]
 mdb> up 1
+   2       4       3    2 pred queens:queen/2-0 (nondet) 
 Ancestor level set to 2.
 mdb> vars
         0 HeadVar__1
@@ -82,6 +84,17 @@
       18:      9  6 DISJ pred queens:qdelete/3-0 (nondet) c2;d1;
       19:      9  6 EXIT pred queens:qdelete/3-0 (nondet) 
       20:     10  6 CALL pred queens:qperm/2-0 (nondet) 
+mdb> stack
+   0    4* pred queens:qperm/2-0 (nondet)
+   4       pred queens:queen/2-0 (nondet)
+   5       pred queens:main/2-0 (cc_multi)
+mdb> stack -d
+   0      20      10    6 pred queens:qperm/2-0 (nondet)
+   1      15       8    5 pred queens:qperm/2-0 (nondet)
+   2      10       6    4 pred queens:qperm/2-0 (nondet)
+   3       5       4    3 pred queens:qperm/2-0 (nondet)
+   4       4       3    2 pred queens:queen/2-0 (nondet)
+   5       1       1    1 pred queens:main/2-0 (cc_multi)
 mdb> print *
        HeadVar__1           		[4, 5]
 mdb> 
Index: tests/debugger/queens.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/queens.inp,v
retrieving revision 1.4
diff -u -u -r1.4 queens.inp
--- queens.inp	1998/11/12 03:26:35	1.4
+++ queens.inp	1998/11/13 07:21:58
@@ -35,6 +35,8 @@
 print *
 
 goto -a 20
+stack
+stack -d
 print *
 
 retry
cvs diff: Diffing tests/general
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
Index: trace/mercury_trace_internal.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_internal.c,v
retrieving revision 1.12
diff -u -u -r1.12 mercury_trace_internal.c
--- mercury_trace_internal.c	1998/11/13 05:13:04	1.12
+++ mercury_trace_internal.c	1998/11/13 07:47:30
@@ -138,6 +138,8 @@
 static	bool	MR_trace_options_quiet(bool *verbose,
 			char ***words, int *word_count,
 			const char *cat, const char *item);
+static	bool	MR_trace_options_detailed(bool *detailed, char ***words,
+			int *word_count, const char *cat, const char *item);
 static	bool	MR_trace_options_confirmed(bool *confirmed, char ***words,
 			int *word_count, const char *cat, const char *item);
 static	void	MR_trace_usage(const char *cat, const char *item);
@@ -741,14 +743,22 @@
 			MR_trace_usage("browsing", "print");
 		}
 	} else if (streq(words[0], "stack")) {
-		if (word_count == 1) {
+		bool	include_trace_data;
+
+		include_trace_data = FALSE;
+		if (! MR_trace_options_detailed(&include_trace_data,
+				&words, &word_count, "browsing", "stack"))
+		{
+			; /* the usage message has already been printed */
+		} else if (word_count == 1) {
 			const char	*result;
 
 			do_init_modules();
 			result = MR_dump_stack_from_layout(stdout,
 					layout->MR_sll_entry,
 					MR_saved_sp(saved_regs),
-					MR_saved_curfr(saved_regs));
+					MR_saved_curfr(saved_regs),
+					include_trace_data);
 			if (result != NULL) {
 				printf("%s.\n", result);
 			}
@@ -1204,7 +1214,8 @@
 	{ "none",	FALSE,	NULL,	'n' },
 	{ "some",	FALSE,	NULL,	's' },
 	{ "nostrict",	FALSE,	NULL,	'N' },
-	{ "strict",	FALSE,	NULL,	'S' }
+	{ "strict",	FALSE,	NULL,	'S' },
+	{ NULL,		FALSE,	NULL,	0 }
 };
 
 static bool
@@ -1256,7 +1267,8 @@
 	{ "entry",	FALSE,	NULL,	'e' },
 	{ "interface",	FALSE,	NULL,	'i' },
 	{ "print",	FALSE,	NULL,	'P' },
-	{ "stop",	FALSE,	NULL,	'S' }
+	{ "stop",	FALSE,	NULL,	'S' },
+	{ NULL,		FALSE,	NULL,	0 }
 };
 
 static bool
@@ -1302,6 +1314,39 @@
 	return TRUE;
 }
 
+static struct MR_option MR_trace_detailed_opts[] =
+{
+	{ "detailed",	FALSE,	NULL,	'd' },
+	{ NULL,		FALSE,	NULL,	0 }
+};
+
+static bool
+MR_trace_options_detailed(bool *detailed, char ***words, int *word_count,
+	const char *cat, const char *item)
+{
+	int	c;
+
+	MR_optind = 0;
+	while ((c = MR_getopt_long(*word_count, *words, "d",
+			MR_trace_detailed_opts, NULL)) != EOF)
+	{
+		switch (c) {
+
+			case 'd':
+				*detailed = TRUE;
+				break;
+
+			default:
+				MR_trace_usage(cat, item);
+				return FALSE;
+		}
+	}
+
+	*words = *words + MR_optind - 1;
+	*word_count = *word_count - MR_optind + 1;
+	return TRUE;
+}
+
 static bool
 MR_trace_options_confirmed(bool *confirmed, char ***words, int *word_count,
 	const char *cat, const char *item)
@@ -1336,7 +1381,8 @@
 static struct MR_option MR_trace_quiet_opts[] =
 {
 	{ "quiet",	FALSE,	NULL,	'q' },
-	{ "verbose",	FALSE,	NULL,	'v' }
+	{ "verbose",	FALSE,	NULL,	'v' },
+	{ NULL,		FALSE,	NULL,	0 }
 };
 
 static bool
@@ -1550,7 +1596,8 @@
 		MR_spy_points[spy_point_num]->spy_enabled ? "+" : "-",
 		MR_spy_action_string(MR_spy_points[spy_point_num]->spy_action),
 		MR_spy_when_string(MR_spy_points[spy_point_num]->spy_when));
-	MR_print_proc_id_for_debugger(MR_spy_points[spy_point_num]->spy_proc);
+	MR_print_proc_id(stdout, MR_spy_points[spy_point_num]->spy_proc,
+		NULL, NULL, NULL);
 }
 
 static void
@@ -1595,15 +1642,25 @@
 	Word				*base_sp;
 	Word				*base_curfr;
 	const char 			*problem;
+	const MR_Stack_Layout_Label	*label_layout;
+	const MR_Stack_Layout_Entry	*entry;
 
 	base_sp = MR_saved_sp(saved_regs);
 	base_curfr = MR_saved_curfr(saved_regs);
-	if (MR_find_nth_ancestor(top_layout, ancestor_level,
-			&base_sp, &base_curfr, &problem) == NULL)
-	{
+	label_layout = MR_find_nth_ancestor(top_layout, ancestor_level,
+			&base_sp, &base_curfr, &problem);
+
+	if (label_layout == NULL) {
 		return problem;
 	} else {
-		return NULL;
+		entry = label_layout->MR_sll_entry;
+		printf("%4d ", ancestor_level);
+		MR_print_proc_id(stdout, entry, "", base_sp, base_curfr);
+		if (MR_ENTRY_LAYOUT_HAS_EXEC_TRACE(entry)) {
+			return NULL;
+		} else {
+			return "this procedure does not have debugging info";
+		}
 	}
 }
 
@@ -2292,14 +2349,7 @@
 		(long) MR_trace_event_number, (long) seqno, (long) depth);
 
 	MR_trace_print_port(port);
-
-	/*
-	** The following should be a full identification of the procedure
-	** provided (a) there was no intermodule optimization and (b) we are
-	** not interested in tracing compiler-generated procedures.
-	*/
-
-	MR_print_proc_id(stdout, layout->MR_sll_entry, path);
+	MR_print_proc_id(stdout, layout->MR_sll_entry, path, NULL, NULL);
 }
 
 static void
cvs diff: Diffing trial
cvs diff: Diffing util



More information about the developers mailing list