You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by "William A. Rowe, Jr." <wr...@rowe-clan.net> on 2001/08/02 22:17:42 UTC

Does anyone want this committed?

Pipe 'names' for debugging patch attached.

Three issues,

1. the stack exception code doesn't work on NT.   In fact, I doubt it ever works for
threading.  Pulling _just_that_ alone should help debug on threaded architechtures.

The better solution is to build a 'list of stacks'.  The _end symbol is a pita, we
need autoconf/libtoolers to figure out that _end exists to define HAVE__END.

2. I can't figure out how to stringize __LINE__, which sort of sucks.

3. I really didn't like breaking the semantics and sometimes passing the extra hidden
'name' argument, and sometimes not.  I figured the overhead of an extra NULL arg on
some rarely called function is a trivial issue.

If you like this, yell :)

Bill



Re: Does anyone want this committed?

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Uhhh... the patch :|

----- Original Message ----- 
From: "William A. Rowe, Jr." <wr...@rowe-clan.net>
To: <de...@apr.apache.org>
Sent: Thursday, August 02, 2001 3:17 PM
Subject: Does anyone want this committed?


> Pipe 'names' for debugging patch attached.
> 
> Three issues,i
> 
> 1. the stack exception code doesn't work on NT.   In fact, I doubt it ever works for
> threading.  Pulling _just_that_ alone should help debug on threaded architechtures.
> 
> The better solution is to build a 'list of stacks'.  The _end symbol is a pita, we
> need autoconf/libtoolers to figure out that _end exists to define HAVE__END.
> 
> 2. I can't figure out how to stringize __LINE__, which sort of sucks.
> 
> 3. I really didn't like breaking the semantics and sometimes passing the extra hidden
> 'name' argument, and sometimes not.  I figured the overhead of an extra NULL arg on
> some rarely called function is a trivial issue.
> 
> If you like this, yell :)
> 
> Bill
> 
> 
> 

Re: [PATCH] revised: Does anyone want this committed?

Posted by Branko Čibej <br...@xbc.nu>.
Did you actually compile any of this?

>
>+#define abort() DebugBreak();
>+#define assert(x) if (!(x)) DebugBreak;
>+
> #endif  /*APR_PRIVATE_H*/
> #endif  /*WIN32*/
>
Should be:

  #define abort() DebugBreak()
  #define assert(x) if ((x)); else DebugBreak()


Note the lack of semicolons at the end of the macro expansions, and the 
change to avoid the dangling else problem.


>+#ifdef APR_POOL_DEBUG
>+#define APR_STRINGIFY(S) APR_REALLY_STRINGIFY(S)
>+#define APR_REALLY_STRINGIFY(S) #S
>+#endif
>
Here you define APR_STRINGIFY, ...

>
>+#if defined(APR_POOL_DEBUG)
>+#define apr_pool_alloc_init(p) \
>+    (apr_pool_alloc_init)(p, #p " (" STRINGIFY(__LINE__) ") " __FILE__)
>+#else
>
... but use STRINGIFY later on.

Naughty, naughty.


-- 
Brane Čibej
    home:   <br...@xbc.nu>             http://www.xbc.nu/brane/
    work:   <br...@hermes.si>   http://www.hermes-softlab.com/
     ACM :   <br...@acm.org>            http://www.acm.org/




[PATCH] revised: Does anyone want this committed?

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
First off - this patch names apr_pool_t allocations (nothing to do with pipes,
sorry for my earlier misnomer.)


From: "Branko Čibej" <br...@xbc.nu>
Sent: Thursday, August 02, 2001 5:51 PM


> William A. Rowe, Jr. wrote:
>
> >2. I can't figure out how to stringize __LINE__, which sort of sucks.
> >
> The Well Known Hack is
>
>     #define STRINGIFY(S) REALLY_STRINGIFY(S)
>     #define REALLY_STRINGIFY(S) #S
>
>     char this_line_number[] = STRINGIFY(__LINE__);

Thanks, the revised patch is attached :)


One other bit of coolness for win32 developers that I like...

--- srclib/apr/include/arch/win32/apr_private.h 2001/06/06 00:07:46 1.24
+++ srclib/apr/include/arch/win32/apr_private.h 2001/08/02 23:13:00
@@ -191,5 +191,8 @@
         ptr = (type *)apr_sms_calloc(struct->mem_sys, sizeof(type)); \
     }

+#define abort() DebugBreak();
+#define assert(x) if (!(x)) DebugBreak;
+
 #endif  /*APR_PRIVATE_H*/
 #endif  /*WIN32*/


This works nicely around WIN32's bogus crtlib interceptions of abort(), which
make backtracing somewhat difficult (espessially with the BoundsChecker intercepts.)



Re: Does anyone want this committed?

Posted by Branko Čibej <br...@xbc.nu>.
William A. Rowe, Jr. wrote:

>2. I can't figure out how to stringize __LINE__, which sort of sucks.
>
The Well Known Hack is

    #define STRINGIFY(S) REALLY_STRINGIFY(S)
    #define REALLY_STRINGIFY(S) #S

    char this_line_number[] = STRINGIFY(__LINE__);



-- 
Brane Čibej
    home:   <br...@xbc.nu>             http://www.xbc.nu/brane/
    work:   <br...@hermes.si>   http://www.hermes-softlab.com/
     ACM :   <br...@acm.org>            http://www.acm.org/