RE: [PATCH] Add --enable-pool-debug to configure
Sander Striker wrote: Ok, that sounds like a plan. One minor nit which would be great if we could agree on: simply defining APR_POOL_DEBUG should enable the basic debug mode. +1... Working on it... [bit short on time at the moment] Most likely it would be best to do the mojo in apr_pools.h and adjust apr_pools.c accordingly. For example: #ifdef APR_POOL_DEBUG #if APR_POOL_DEBUG == 2 #define APR_POOL_DEBUG_LEVEL 2 #elif APR_POOL_DEBUG == 1 #define APR_POOL_DEBUG_LEVEL 1 #else #define APR_POOL_DEBUG_LEVEL 0 #endif #endif Well, I don't really feel like adding all this... and use APR_POOL_DEBUG_LEVEL in apr_pools.c otherwise you run into lots of ugly stuff in apr_pool.c. Recall that compiling with -DAPR_POOLS_DEBUG will not result in #if APR_POOLS_DEBUG == 0 being true. This trick will work (at the start of apr_pools.c): #if defined(APR_POOL_DEBUG) (APR_POOL_DEBUG != 0) (APR_POOL_DEBUG - 0 == 0) #undef APR_POOL_DEBUG #define APR_POOL_DEBUG 1 #endif And you can't do stuff like #if APR_POOLS_DEBUG == 0 || defined(APR_POOLS_DEBUG) since that would grab the non 0 ones as well. This would actually be ok, since there is a common debug codebase for all the debug modes (a malloc based one). The approach that looked most appealing to me is the following: | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | - | | | | | | | | x | General debug code enabled (good for --with-efence) | | | | | | | x | | Verbose output on stderr (report CREATE, CLEAR, DESTROY) | | | | | | x | | | Lifetime checking. On each use of a pool, check its lifetime. If the pool is out of scope, abort(). In combination with the verbose flag above, it will output LIFE in such an event prior to aborting. | | | | | x | | | | Pool owner checking. On each use of a pool, check if the current thread is the pools owner. If not, abort(). In combination with the verbose flag above, it will output OWNER in such an event prior to aborting. Use the debug function apr_pool_set_owner() to switch a pools ownership. I haven't thought of more modes, but this seems extentable enough to me. It also allows combinations. At configure time I'd like to be able to do the following: ./configure --enable-pool-debug ; default debug mode (malloc system) ./configure --enable-pool-debug=yes ; same ./configure --enable-pool-debug=verbose ; verbose output ./configure --enable-pool-debug=lifetime ; lifetime checking ./configure --enable-pool-debug=owner ; owner checking ./configure --enable-pool-debug=all ; enable all debug modes Or even: ./configure --enable-pool-debug=verbose owner Thoughts? Sander
Re: [PATCH] Add --enable-pool-debug to configure
On Mon, Jan 14, 2002 at 11:55:48AM -0800, Roy T. Fielding wrote: +AC_ARG_ENABLE(pool-debug, + [ --enable-pool-debug[={yes|verbose}]], + [ if test -z $enableval -o $enableval = yes; then +APR_ADDTO(CPPFLAGS, -DAPR_POOL_DEBUG) +elif test $enableval = verbose; then +APR_ADDTO(CPPFLAGS, -DAPR_POOL_DEBUG_VERBOSE) +fi + ]) + Why not use one APR_POOL_DEBUG symbol and give it values of 0 | 1 | 2 ??? +1. This way we could expand or rearrange the verbosity later. This seems as good a time as any to get it right - going to a numbered system seems best in the long run. -- justin
RE: [PATCH] Add --enable-pool-debug to configure
From: Justin Erenkrantz [mailto:[EMAIL PROTECTED] Subject: Re: [PATCH] Add --enable-pool-debug to configure On Mon, Jan 14, 2002 at 11:55:48AM -0800, Roy T. Fielding wrote: +AC_ARG_ENABLE(pool-debug, + [ --enable-pool-debug[={yes|verbose}]], + [ if test -z $enableval -o $enableval = yes; then +APR_ADDTO(CPPFLAGS, -DAPR_POOL_DEBUG) +elif test $enableval = verbose; then +APR_ADDTO(CPPFLAGS, -DAPR_POOL_DEBUG_VERBOSE) +fi + ]) + Why not use one APR_POOL_DEBUG symbol and give it values of 0 | 1 | 2 ??? +1. This way we could expand or rearrange the verbosity later. This seems as good a time as any to get it right - going to a numbered system seems best in the long run. -- justin Ok, that sounds like a plan. One minor nit which would be great if we could agree on: simply defining APR_POOL_DEBUG should enable the basic debug mode. Eg. $ CPPFLAGS=-DAPR_POOL_DEBUG ./configure ... Gets you the pools code with debugging enabled $ CPPFLAGS=-DAPR_POOL_DEBUG=0 ./configure Same. $ CPPFLAGS=-DAPR_POOL_DEBUG=1 ./configure Enables debugging and verbose output. Thoughts? Sander
Re: [PATCH] Add --enable-pool-debug to configure
Sander Striker wrote: Ok, that sounds like a plan. One minor nit which would be great if we could agree on: simply defining APR_POOL_DEBUG should enable the basic debug mode. +1... Most likely it would be best to do the mojo in apr_pools.h and adjust apr_pools.c accordingly. For example: #ifdef APR_POOL_DEBUG #if APR_POOL_DEBUG == 2 #define APR_POOL_DEBUG_LEVEL 2 #elif APR_POOL_DEBUG == 1 #define APR_POOL_DEBUG_LEVEL 1 #else #define APR_POOL_DEBUG_LEVEL 0 #endif #endif and use APR_POOL_DEBUG_LEVEL in apr_pools.c otherwise you run into lots of ugly stuff in apr_pool.c. Recall that compiling with -DAPR_POOLS_DEBUG will not result in #if APR_POOLS_DEBUG == 0 being true. And you can't do stuff like #if APR_POOLS_DEBUG == 0 || defined(APR_POOLS_DEBUG) since that would grab the non 0 ones as well. -- === Jim Jagielski [|] [EMAIL PROTECTED] [|] http://www.jaguNET.com/ A society that will trade a little liberty for a little order will lose both and deserve neither
Re: [PATCH] Add --enable-pool-debug to configure
Sander Striker wrote: Hi, This is kind of a convenience patch. It allows you to specify the type of pools debugging you want at configure time. +1 -- === Jim Jagielski [|] [EMAIL PROTECTED] [|] http://www.jaguNET.com/ A society that will trade a little liberty for a little order will lose both and deserve neither
Re: [PATCH] Add --enable-pool-debug to configure
Jim Jagielski wrote: Sander Striker wrote: Hi, This is kind of a convenience patch. It allows you to specify the type of pools debugging you want at configure time. +1 can you make it so that the 'debug' versions of the apr are created with a different library name apr-d apr-util-d or something like that?
RE: [PATCH] Add --enable-pool-debug to configure
From: Ian Holsman [mailto:[EMAIL PROTECTED] Subject: Re: [PATCH] Add --enable-pool-debug to configure Sander Striker wrote: Hi, This is kind of a convenience patch. It allows you to specify the type of pools debugging you want at configure time. can you make it so that the 'debug' versions of the apr are created with a different library name apr-d apr-util-d or something like that? Personally I am not going to add that no. I also feel that there are quite a few debug options, I don't see why the pools debugging should result in a different library name. If you really want this kind of feature I'd suggest a --libname=name kind of thing, instead of binding it to a debug option. Sander