On Mon, Sep 24, 2001 at 11:48:44PM +0800, Stas Bekman wrote:
> Where do we put debug functions? debugger doesn't really help in dumping 
> complicated data structures like apr_table_t.
> 
> For example I wrote the following debug print:
> 
> /* dump the values of the table */
> void debug_dump_table(apr_table_t *table, char *desc)
> {
>      apr_array_header_t *arr = apr_table_elts(table);
>      apr_table_entry_t *entries  = (apr_table_entry_t *)arr->elts;
>      int i;
> 
>      fprintf(stderr, "!!! Dumping table:\n <%s>\n", desc);
>      for (i = 0; i < arr->nelts; i++) {
>          char *val = (char *)apr_table_get(table, entries[i].key);
>          fprintf(stderr, "!!! %s = %s\n", entries[i].key, val);
>      }
>      fprintf(stderr, "!!! </%s>\n", desc);
> }
> 
> I guess I can also think of .gdbinit macro to do the same or even based 
> on this function.

How about stuffing them all in modperl_debug.[hc] and make sure all call
to stuff in there is wrapped in a DEBUG() macro ?  That way, all that stuff
goes in when MP_DEBUG=1, but vanishes otherwise.

> But for this particular functions I suppose the best place is in apr 
> itself, not sure if I've missed some existing function.
> 
> _____________________________________________________________________
> Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
> http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
> mailto:[EMAIL PROTECTED]   http://apachetoday.com http://eXtropia.com/
> http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
+----------------------------------------------------+
| Philippe M. Chiasson  <[EMAIL PROTECTED]>             |
+----------------------------------------------------+
| F9BF E0C2 480E 7680 1AE5  3631 CB32 A107 88C3 A5A5 |
+----------------------------------------------------+
gethostent not implemented : Your C library apparently
doesn't implement gethostent(), probably because if it did,
it'd feel morally obligated to return every hostname on the
Internet. 
        -- perldiag(1)

perl -e '$$=\${gozer};{$_=unpack(P26,pack(L,$$));/^Just Another Perl 
Hacker!\n$/&&print||$$++&&redo}'

PGP signature

Reply via email to