summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rwxr-xr-xconfigure15
-rw-r--r--gc.c18
-rw-r--r--lib.c10
-rw-r--r--lib.h1
5 files changed, 58 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index e79a1d2d..94bebc0e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2011-11-30 Kaz Kylheku <kaz@kylheku.com>
+ * configure (extra_debugging): New variable. EXTRA_DEBUGGING
+ conditionally generated in config.h.
+
+ * gc.c (break_obj): New static variable.
+ (mark_obj): Debugging feature: if the object is the one stored in
+ break_obj and not yet reached, then call breakpt.
+ (deheap): New debugging function for viewing regions of the heaps.
+
+ * lib.c (breakpt): New function.
+
+ * lib.h (breakpt): Declared.
+
+2011-11-30 Kaz Kylheku <kaz@kylheku.com>
+
* hash.c (hash_process_weak): Fix regression caused by a mistake
in the the 2010-01-26 commit, prior to release 033. When processing a
table with weak values, this function was mistakenly testing the keys
diff --git a/configure b/configure
index 2b012c43..6255fc9a 100755
--- a/configure
+++ b/configure
@@ -135,6 +135,7 @@ lex_dbg_flags=${lex_dbg_flags-}
txr_dbg_opts=${txr_dbg_opts---gc-debug}
valgrind=${valgrind-}
lit_align=${lit_align-}
+extra_debugging=${extra_debugging-}
#
# If --help was given (or --help=<nonempty> or help=<nonempty>) then
@@ -334,6 +335,11 @@ valgrind [$valgrind]
Valgrind integration means that when the program is running under valgrind,
it advises valgrind about stack memory locations accessed by the garbage
collector, to suppress diagnostics about uninitialized accesses.
+
+extra_debugging [$extra_debugging]
+
+ Use --extra_debugging to configure some additional debugging features,
+ which incur a run-time penalty.
!
exit 1
fi
@@ -922,6 +928,15 @@ else
fi
#
+# Extra debugging.
+#
+
+if [ -n "$extra_debugging" ] ; then
+ printf "Configuring extra debugging, as requested ...\n"
+ printf "#define EXTRA_DEBUGGING 1\n" >> config.h
+fi
+
+#
# Clean up
#
diff --git a/gc.c b/gc.c
index 4f8c41bc..72b1af05 100644
--- a/gc.c
+++ b/gc.c
@@ -72,6 +72,10 @@ static val heap_min_bound, heap_max_bound;
int gc_enabled = 1;
+#if EXTRA_DEBUGGING
+static val break_obj;
+#endif
+
val prot1(val *loc)
{
assert (top < prot_stack_limit);
@@ -243,6 +247,11 @@ tail_call:
obj->t.type = (type_t) (obj->t.type | REACHABLE);
+#if EXTRA_DEBUGGING
+ if (obj == break_obj)
+ breakpt();
+#endif
+
switch (t) {
case CONS:
mark_obj(obj->c.car);
@@ -512,6 +521,15 @@ void unmark(void)
}
}
+void dheap(heap_t *heap, int start, int end);
+
+void dheap(heap_t *heap, int start, int end)
+{
+ int i;
+ for (i = start; i < end; i++)
+ format(std_output, lit("(~a ~s)\n"), num(i), &heap->block[i], nao);
+}
+
/*
* This function does nothing.
* gc_hint(x) just takes the address of local variable x
diff --git a/lib.c b/lib.c
index fdf5758e..a605a556 100644
--- a/lib.c
+++ b/lib.c
@@ -3228,3 +3228,13 @@ void d(val obj)
{
dump(obj, std_output);
}
+
+/*
+ * Function for software breakpoints.
+ * Debugging routines call here when a breakpoint
+ * is requested. For this to work, set a breakpoint
+ * on this function.
+ */
+void breakpt(void)
+{
+}
diff --git a/lib.h b/lib.h
index 732c5eb8..47cb414e 100644
--- a/lib.h
+++ b/lib.h
@@ -495,6 +495,7 @@ void init(const wchar_t *progname, mem_t *(*oom_realloc)(mem_t *, size_t),
val *stack_bottom);
void dump(val obj, val stream);
void d(val obj);
+void breakpt(void);
#define nil ((obj_t *) 0)