for review: nicer stack dumps
Tyson Dowd
trd at cs.mu.OZ.AU
Tue Apr 21 12:48:45 AEST 1998
Hi,
Zoltan, since you asked for this in the previous diff I sent, would
you like to review it?
===================================================================
Estimated hours taken: 1
runtime/mercury_stack_trace.c:
Use stack layout data structures to do stack dumps.
Improve the output format, output the determinism and
mode number of each predicate.
Index: runtime/mercury_stack_trace.c
===================================================================
RCS file: /home/staff/zs/imp/mercury/runtime/mercury_stack_trace.c,v
retrieving revision 1.5
diff -u -r1.5 mercury_stack_trace.c
--- mercury_stack_trace.c 1998/04/18 08:06:52 1.5
+++ mercury_stack_trace.c 1998/04/20 06:52:09
@@ -14,6 +14,27 @@
#include "mercury_stack_trace.h"
#include <stdio.h>
+static const char * detism_names[] = {
+ "failure", /* 0 */
+ "", /* 1 */
+ "semidet", /* 2 */
+ "nondet", /* 3 */
+ "erroneous", /* 4 */
+ "", /* 5 */
+ "det", /* 6 */
+ "multidet", /* 7 */
+ "", /* 8 */
+ "", /* 9 */
+ "cc_nondet", /* 10 */
+ "", /* 11 */
+ "", /* 12 */
+ "", /* 13 */
+ "cc_multidet" /* 14 */
+};
+
+
+
+
void
MR_dump_stack(Code *success_pointer, Word *det_stack_pointer,
Word *current_frame)
@@ -65,7 +86,12 @@
break;
}
if (MR_DETISM_DET_STACK(determinism)) {
- fprintf(stderr, "\t%s\n", label->e_name);
+ fprintf(stderr, "\t%s:%s/%ld (mode %ld, %s)\n",
+ entry_layout->MR_sle_def_module,
+ entry_layout->MR_sle_name,
+ (long) entry_layout->MR_sle_arity,
+ (long) entry_layout->MR_sle_mode,
+ detism_names[entry_layout->MR_sle_detism]);
if (type == MR_LVAL_TYPE_STACKVAR) {
success_pointer = (Code *) field(0,
det_stack_pointer, -number);
@@ -75,10 +101,16 @@
det_stack_pointer = det_stack_pointer -
entry_layout->MR_sle_stack_slots;
} else {
- fprintf(stderr, "\t%s\n", label->e_name);
+ fprintf(stderr, "\t%s:%s/%ld (mode %ld, %s)\n",
+ entry_layout->MR_sle_def_module,
+ entry_layout->MR_sle_name,
+ (long) entry_layout->MR_sle_arity,
+ (long) entry_layout->MR_sle_mode,
+ detism_names[entry_layout->MR_sle_detism]);
success_pointer = bt_succip(current_frame);
current_frame = bt_succfr(current_frame);
}
} while (TRUE);
#endif /* MR_STACK_TRACE */
}
+
--
Tyson Dowd # There isn't any reason why Linux can't be
# implemented as an enterprise computing solution.
trd at cs.mu.oz.au # Find out what you've been missing while you've
http://www.cs.mu.oz.au/~trd # been rebooting Windows NT. -- InfoWorld, 1998.
More information about the developers
mailing list