diff options
-rw-r--r-- | ChangeLog | 14 | ||||
-rwxr-xr-x | configure | 15 | ||||
-rw-r--r-- | gc.c | 18 | ||||
-rw-r--r-- | lib.c | 10 | ||||
-rw-r--r-- | lib.h | 1 |
5 files changed, 58 insertions, 0 deletions
@@ -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 @@ -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 # @@ -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 @@ -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) +{ +} @@ -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) |