+1. I think this can go in.
Sander Striker wrote:
>[Here's an updated patch.]
>
>Since we now have a similar pool debug mode in APR, we
>can remove this code from Subversion. To turn
>debug mode on, simple pass: --enable-pool-debug=verbose
>to configure.
>
>Note: configure doesn't send --enable-pool-debug nicely
>to apr/configure. Need to figure out why not. If someone
>would look into that, that would be great.
>
>Sander
>
>Log:
>* subversion/include/svn_pools.h
>
> Remove the comments about how to turn on debugging and
> what the output format looks like.
>
> (svn_pool_create_debug, svn_pool_clear_debug,
> svn_pool_destroy_debug): change arguments from seperate
> file, line, to a single string. Pass APR_POOL__FILE_LINE__
> which is a single string containing __FILE__:__LINE__.
>
>* subversion/libsvn_subr/svn_error.c
>
> (svn_pool_create_debug, svn_pool_clear_debug,
> svn_pool_destroy_debug): change arguments from seperate
> file, line, to a single string. Call on the
> apr_pool_xxx_debug counterpart to get the debug
> functionality with the correct file:line in the output.
>
> (find_oldest_pool_ancestor): deleted.
>
>Index: ./subversion/include/svn_pools.h
>===================================================================
>--- ./subversion/include/svn_pools.h
>+++ ./subversion/include/svn_pools.h Fri Jan 25 13:53:36 2002
>@@ -39,31 +39,6 @@
>
> /*** Wrappers around APR pools, so we get error pools. ***/
>
>-/* If you want pool usage debug info dumped to stderr (in environments
>- * that support that kind of thing), #define SVN_POOL_DEBUG here.
>- *
>- * Output looks like one of these three:
>- *
>- * PDEBUG: + 0xHHHHHHHH (FILE:LINE) parent=0xPPPPPPPP
>- * PDEBUG: 0 SSSSSSSSSS TTTTTTTTTT 0xHHHHHHHH (FILE:LINE)
>- * PDEBUG: - SSSSSSSSSS TTTTTTTTTT 0xHHHHHHHH (FILE:LINE)
>- *
>- * where:
>- *
>- * '+' signifies the creation of a pool
>- * '0' signifies the clearing of a pool
>- * '-' signifies the destruction of a pool
>- * SSSSSSSSSS is the decimal size in bytes of the pool
>- * TTTTTTTTTT is the total allocation of that pool tree at the time
>- * 0xHHHHHHHH is the address of the pool
>- * 0xPPPPPPPP is the address of the pool's parent pool
>- * FILE and LINE are the source code path/line number
>- */
>-/*
>-#define SVN_POOL_DEBUG
>-*/
>-
>-
>
> /* THE ERROR POOL
> *
>@@ -164,7 +139,6 @@
> #endif /* SWIG */
>
>
>-#ifndef SVN_POOL_DEBUG
> /* Return a new pool. If PARENT_POOL is non-null, then the new
> * pool will be a subpool of it, and will inherit the containing
> * pool's dedicated error subpool and feedback stream.
>@@ -179,16 +153,14 @@
> * terminating the program. */
> apr_pool_t *svn_pool_create (apr_pool_t *parent_pool);
>
>-#else /* SVN_POOL_DEBUG */
> apr_pool_t *svn_pool_create_debug (apr_pool_t *parent_pool,
>- const char *file,
>- int line);
>-#define svn_pool_create(p) svn_pool_create_debug(p, __FILE__, __LINE__)
>-#endif /* SVN_POOL_DEBUG */
>+ const char *file_line);
>
>+#if APR_POOL_DEBUG
>+#define svn_pool_create(p) svn_pool_create_debug(p, APR_POOL__FILE_LINE__)
>+#endif /* APR_POOL_DEBUG */
>
>
>-#ifndef SVN_POOL_DEBUG
> /* Clear the passed in pool.
> *
> * The reason we need this wrapper to apr_pool_clear, is because
>@@ -199,30 +171,21 @@
> * If anything goes wrong, an abort function will be called. */
> void svn_pool_clear (apr_pool_t *p);
>
>-#else /* SVN_POOL_DEBUG */
> void svn_pool_clear_debug (apr_pool_t *p,
>- const char *file,
>- int line);
>-#define svn_pool_clear(p) svn_pool_clear_debug(p, __FILE__, __LINE__)
>-#endif /* SVN_POOL_DEBUG */
>+ const char *file_line);
>
>+#if APR_POOL_DEBUG
>+#define svn_pool_clear(p) svn_pool_clear_debug(p, APR_POOL__FILE_LINE__)
>+#endif /* APR_POOL_DEBUG */
>
>-#ifndef SVN_POOL_DEBUG
>
> /* Destroy a POOL and all of its children.
> *
>- * This wrapper to apr_pool_destroy exists for symmatry (the
>+ * This define for svn_pool_destroy exists for symmatry (the
> * not-so-grand reason) and for the existence of a great memory usage
> * debugging hook (the grand reason).
> */
>-void svn_pool_destroy (apr_pool_t *p);
>-
>-#else /* SVN_POOL_DEBUG */
>-void svn_pool_destroy_debug (apr_pool_t *p,
>- const char *file,
>- int line);
>-#define svn_pool_destroy(p) svn_pool_destroy_debug(p, __FILE__, __LINE__)
>-#endif /* SVN_POOL_DEBUG */
>+#define svn_pool_destroy apr_pool_destroy
>
>
> #ifdef __cplusplus
>Index: ./subversion/libsvn_subr/svn_error.c
>===================================================================
>--- ./subversion/libsvn_subr/svn_error.c
>+++ ./subversion/libsvn_subr/svn_error.c Fri Jan 25 15:12:39 2002
>@@ -286,41 +286,36 @@
> return APR_SUCCESS;
> }
>
>+#if APR_POOL_DEBUG
>+#undef svn_pool_create
>
>-#ifdef SVN_POOL_DEBUG
>-/* Find the oldest living ancestor of pool P (which could very well be
>- P itself) */
>-static apr_pool_t *
>-find_oldest_pool_ancestor (apr_pool_t *p)
>-{
>- while (1)
>- {
>- apr_pool_t *parent = apr_pool_get_parent (p);
>-
>- if (parent == NULL) /* too far? */
>- return p;
>- p = parent;
>- }
>- /* NOTREACHED */
>-}
>-#endif /* SVN_POOL_DEBUG */
>+apr_pool_t *
>+svn_pool_create (apr_pool_t *parent_pool);
>
>
>+#undef svn_pool_clear
>+void
>+svn_pool_clear (apr_pool_t *p);
>+#endif
>
>-#ifndef SVN_POOL_DEBUG
>+#if !APR_POOL_DEBUG
> apr_pool_t *
> svn_pool_create (apr_pool_t *parent_pool)
>-#else /* SVN_POOL_DEBUG */
>-apr_pool_t *
>-svn_pool_create_debug (apr_pool_t *parent_pool,
>- const char *file,
>- int line)
>-#endif /* SVN_POOL_DEBUG */
> {
> apr_pool_t *ret_pool;
>
> apr_pool_create_ex (&ret_pool, parent_pool, abort_on_pool_failure,
> APR_POOL_FDEFAULT);
>+#else /* APR_POOL_DEBUG */
>+apr_pool_t *
>+svn_pool_create_debug (apr_pool_t *parent_pool,
>+ const char *file_line)
>+{
>+ apr_pool_t *ret_pool;
>+
>+ apr_pool_create_ex_debug (&ret_pool, parent_pool, abort_on_pool_failure,
>+ APR_POOL_FDEFAULT, file_line);
>+#endif /* APR_POOL_DEBUG */
>
> /* If there is no parent, then initialize ret_pool as the "top". */
> if (parent_pool == NULL)
>@@ -350,46 +345,23 @@
> abort_on_pool_failure (SVN_ERR_BAD_CONTAINING_POOL);
> }
>
>-#ifdef SVN_POOL_DEBUG
>- {
>- fprintf (stderr,
>- "PDEBUG: + "
>- " " /* 10/10 here */
>- " 0x%08X (%s:%d) parent=0x%08X\n",
>- (unsigned int)ret_pool, file, line, (unsigned int)parent_pool);
>- }
>-#endif /* SVN_POOL_DEBUG */
>-
> return ret_pool;
> }
>
>
>-#ifndef SVN_POOL_DEBUG
>+#if !APR_POOL_DEBUG
> void
> svn_pool_clear (apr_pool_t *p)
>-#else /* SVN_POOL_DEBUG */
>+#else /* APR_POOL_DEBUG */
> void
> svn_pool_clear_debug (apr_pool_t *p,
>- const char *file,
>- int line)
>-#endif /* SVN_POOL_DEBUG */
>+ const char *file_line)
>+#endif /* APR_POOL_DEBUG */
> {
> apr_pool_t *error_pool;
> svn_pool_feedback_t *vtable, vtable_tmp;
> svn_boolean_t subpool_of_p_p; /* That's "predicate" to you, bud. */
>
>-#ifdef SVN_POOL_DEBUG
>- {
>- apr_size_t num_bytes = apr_pool_num_bytes (p, 1);
>- apr_size_t global_num_bytes =
>- apr_pool_num_bytes (find_oldest_pool_ancestor (p), 1);
>-
>- fprintf (stderr, "PDEBUG: 0 %10lu %10lu 0x%08X (%s:%d)\n",
>- (unsigned long)num_bytes, (unsigned long)global_num_bytes,
>- (unsigned int)p, file, line);
>- }
>-#endif /* SVN_POOL_DEBUG */
>-
> /* Get the error_pool from this pool. If it's rooted in this pool, we'll
> need to re-create it after we clear the pool. */
> svn_error__get_error_pool (p, &error_pool, &subpool_of_p_p);
>@@ -419,7 +391,11 @@
> }
>
> /* Clear the pool. All userdata of this pool is now invalid. */
>+#if !APR_POOL_DEBUG
> apr_pool_clear (p);
>+#else /* APR_POOL_DEBUG */
>+ apr_pool_clear_debug (p, file_line);
>+#endif /* APR_POOL_DEBUG */
>
> if (subpool_of_p_p)
> {
>@@ -439,30 +415,35 @@
> }
>
>
>-#ifndef SVN_POOL_DEBUG
>-void
>-svn_pool_destroy (apr_pool_t *p)
>-#else /* SVN_POOL_DEBUG */
>-void
>-svn_pool_destroy_debug (apr_pool_t *p,
>- const char *file,
>- int line)
>-#endif /* SVN_POOL_DEBUG */
>+#if !APR_POOL_DEBUG
>+apr_pool_t *
>+svn_pool_create_debug (apr_pool_t *parent_pool,
>+ const char *file_line)
> {
>-#ifdef SVN_POOL_DEBUG
>- {
>- apr_size_t num_bytes = apr_pool_num_bytes (p, 1);
>- apr_size_t global_num_bytes =
>- apr_pool_num_bytes (find_oldest_pool_ancestor (p), 1);
>-
>- fprintf (stderr, "PDEBUG: - %10lu %10lu 0x%08X (%s:%d)\n",
>- (unsigned long)num_bytes, (unsigned long)global_num_bytes,
>- (unsigned int)p, file, line);
>- }
>-#endif /* SVN_POOL_DEBUG */
>+ return svn_pool_create (parent_pool);
>+}
>+
>+
>+void
>+svn_pool_clear_debug (apr_pool_t *p,
>+ const char *file_line)
>+{
>+ svn_pool_clear (p);
>+}
>+#else /* APR_POOL_DEBUG */
>+apr_pool_t *
>+svn_pool_create (apr_pool_t *parent_pool)
>+{
>+ return svn_pool_create_debug (parent_pool, "<undefined>");
>+}
>+
>
>- apr_pool_destroy (p);
>+void
>+svn_pool_clear (apr_pool_t *p)
>+{
>+ return svn_pool_clear_debug (p, "<undefined>");
> }
>+#endif /* APR_POOL_DEBUG */
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
>For additional commands, e-mail: dev-help@subversion.tigris.org
>
--
Brane Čibej <brane_at_xbc.nu> http://www.xbc.nu/brane/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:37:00 2006