andrey Tue Jun 24 06:56:59 2008 UTC Modified files: /php-src/ext/mysqlnd mysqlnd_palloc.c Log: Even more debug info http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd_palloc.c?r1=1.10&r2=1.11&diff_format=u Index: php-src/ext/mysqlnd/mysqlnd_palloc.c diff -u php-src/ext/mysqlnd/mysqlnd_palloc.c:1.10 php-src/ext/mysqlnd/mysqlnd_palloc.c:1.11 --- php-src/ext/mysqlnd/mysqlnd_palloc.c:1.10 Mon Jun 23 22:21:55 2008 +++ php-src/ext/mysqlnd/mysqlnd_palloc.c Tue Jun 24 06:56:59 2008 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mysqlnd_palloc.c,v 1.10 2008/06/23 22:21:55 andrey Exp $ */ +/* $Id: mysqlnd_palloc.c,v 1.11 2008/06/24 06:56:59 andrey Exp $ */ #include "php.h" #include "mysqlnd.h" #include "mysqlnd_priv.h" @@ -67,6 +67,8 @@ /* One more for empty position of last_added - always 0x0, bounds checking */ ret->free_list.ptr_line = calloc(ret->max_items + 1, sizeof(mysqlnd_zval *)); ret->free_list.last_added = ret->free_list.ptr_line + ret->max_items; + ret->free_list.canary1 = (void*)0xBEEF; + ret->free_list.canary2 = (void*)0xAFFE; /* 3. Allocate and initialize our zvals and initialize the free list */ ret->block = calloc(ret->max_items, sizeof(mysqlnd_zval)); @@ -154,7 +156,10 @@ ret->gc_list.ptr_line = calloc(cache->max_items, sizeof(mysqlnd_zval *)); /* Backward and forward looping is possible */ ret->gc_list.last_added = ret->gc_list.ptr_line; + ret->gc_list.canary1 = (void*)0xCAFE; + ret->gc_list.canary2 = (void*)0x190280; + DBG_INF_FMT("ptr_line=%p last_added=%p", ret->gc_list.ptr_line, ret->gc_list.last_added); DBG_RETURN(ret); } /* }}} */ @@ -166,7 +171,8 @@ DBG_ENTER("_mysqlnd_palloc_get_thd_cache_reference"); if (cache) { ++cache->references; - DBG_INF_FMT("cache=%p new_refc=%d", *cache, cache->references); + DBG_INF_FMT("cache=%p new_refc=%d gc_list.canary1=%p gc_list.canary2=%p", + *cache, cache->references, cache->gc_list.canary1, cache->gc_list.canary2); mysqlnd_palloc_get_cache_reference(cache->parent); } DBG_RETURN(cache); @@ -202,7 +208,10 @@ DBG_ENTER("_mysqlnd_palloc_free_thd_cache_reference"); if (*cache) { --(*cache)->parent->references; - DBG_INF_FMT("cache=%p references_left=%d", *cache, (*cache)->references); + DBG_INF_FMT("cache=%p references_left=%d canary1=%p canary2=%p", + *cache, (*cache)->references, (*cache)->gc_list.canary1, (*cache)->gc_list.canary2); + + DBG_INF_FMT("gc_list.ptr_line=%p gc_list.last_added=%p", (*cache)->gc_list.ptr_line, (*cache)->gc_list.last_added); if (--(*cache)->references == 0) { mysqlnd_palloc_free_thd_cache(*cache TSRMLS_CC); @@ -309,15 +318,19 @@ DBG_INF_FMT("cache=%p *last_added=%p free_items=%d", thd_cache, thd_cache->parent->free_list.last_added, thd_cache->parent->free_items); + DBG_INF_FMT("gc_list.ptr_line=%p gc_list.last_added=%p gc_list.canary1=%p gc_list.canary2=%p", + thd_cache->gc_list.ptr_line, thd_cache->gc_list.last_added, + thd_cache->gc_list.canary1, thd_cache->gc_list.canary2); } if (thd_cache) { MYSQLND_ZVAL_PCACHE *cache = thd_cache->parent; LOCK_PCACHE(cache); - DBG_INF_FMT("free_items=%d free_list.ptr_line=%p free_list.last_added=%p *free_list.last_added=%p", + DBG_INF_FMT("free_items=%d free_list.ptr_line=%p free_list.last_added=%p *free_list.last_added=%p free_list.canary1=%p free_list.canary2=%p", cache->free_items, cache->free_list.ptr_line, cache->free_list.last_added, - *cache->free_list.last_added); + *cache->free_list.last_added, + cache->free_list.canary1, cache->free_list.canary2); /* We have max_items + 1 allocated block for free_list, thus we know if we */ if ((ret = *cache->free_list.last_added)) { @@ -367,6 +380,8 @@ thd_cache->parent->block, thd_cache->parent->last_in_block, *zv, Z_REFCOUNT_PP(zv), type); + DBG_INF_FMT("gc_list.ptr_line=%p gc_list.last_added=%p gc_list.canary1=%p gc_list.canary2=%p", + thd_cache->gc_list.ptr_line, thd_cache->gc_list.last_added, thd_cache->gc_list.canary1, thd_cache->gc_list.canary2); } *copy_ctor_called = FALSE; /* Check whether cache is used and the zval is from the cache */ @@ -442,10 +457,11 @@ shutdown :(. */ LOCK_PCACHE(cache); - DBG_INF_FMT("gc_list.ptr_line=%p gc_list.last_added=%p *gc_list.last_added=%p", + DBG_INF_FMT("gc_list.ptr_line=%p gc_list.last_added=%p *gc_list.last_added=%p free_list.canary1=%p free_list.canary2=%p", thd_cache->gc_list.ptr_line, thd_cache->gc_list.last_added, - *thd_cache->gc_list.last_added); + *thd_cache->gc_list.last_added, + cache->free_list.canary1, cache->free_list.canary2); if ((thd_cache->gc_list.last_added - thd_cache->gc_list.ptr_line) > cache->max_items) { DBG_ERR("Buffer overflow follows"); DBG_ERR_FMT("parent->max_items=%d parent->free_items=%d diff=%d",
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php