diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-06-17 06:44:15 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-06-17 06:44:15 -0700 |
commit | c43521c50efad928ff0b41724b967b96e6cb274f (patch) | |
tree | bb6e037a30856be5b560121ad79330a498acd2d6 | |
parent | f4110d5ca2700c0ed71c6e5d9f009111408dc58a (diff) | |
download | txr-c43521c50efad928ff0b41724b967b96e6cb274f.tar.gz txr-c43521c50efad928ff0b41724b967b96e6cb274f.tar.bz2 txr-c43521c50efad928ff0b41724b967b96e6cb274f.zip |
Print valgrind backtraces for break_obj.
* gc.c (more): Under EXTRA_DEBUGGING, call breakpt()
here also, when it is detected that break_obj is
added to the free list for the firts time.
Print a message and backtrace using
VALGRIND_PRINTF_BACKTRACE.
(make_obj): Likewise, for an object that is pulled out
of the free list and returned.
(mark_obj, sweep_one): Print backtrace with Valgrind for
break_obj, in addition to calling breakpt().
-rw-r--r-- | gc.c | 30 |
1 files changed, 28 insertions, 2 deletions
@@ -142,6 +142,14 @@ static void more(void) while (block < end) { block->t.next = free_list; block->t.type = convert(type_t, FREE); +#if EXTRA_DEBUGGING + if (block == break_obj) { +#if HAVE_VALGRIND + VALGRIND_PRINTF_BACKTRACE("object %p newly added to free list\n", convert(void *, block)); +#endif + breakpt(); + } +#endif free_list = block++; } @@ -198,6 +206,14 @@ val make_obj(void) freshobj[freshobj_idx++] = ret; #endif gc_bytes += sizeof (obj_t); +#if EXTRA_DEBUGGING + if (ret == break_obj) { +#if HAVE_VALGRIND + VALGRIND_PRINTF_BACKTRACE("object %p allocated\n", convert(void *, ret)); +#endif + breakpt(); + } +#endif return ret; } @@ -311,8 +327,12 @@ tail_call: obj->t.type = convert(type_t, t | REACHABLE); #if EXTRA_DEBUGGING - if (obj == break_obj) + if (obj == break_obj) { +#if HAVE_VALGRIND + VALGRIND_PRINTF_BACKTRACE("object %p marked\n", convert(void *, obj)); +#endif breakpt(); + } #endif switch (t) { @@ -478,8 +498,14 @@ static int sweep_one(obj_t *block) #endif #if EXTRA_DEBUGGING - if (block == break_obj) + if (block == break_obj) { +#if HAVE_VALGRIND + VALGRIND_PRINTF_BACKTRACE("object %p swept (type = %x)\n", + convert(void *, block), + convert(unsigned int, block->t.type)); +#endif breakpt(); + } #endif #if CONFIG_GEN_GC |