cvs commit: tng/source/include debug.h tng/source/lib debug.c

Andrew Bartlett abartlet at samba.org
Sun Jul 14 18:30:03 GMT 2002


Luke Kenneth Casson Leighton wrote:
> 
> elrond,
> 
> you would do well to examine the freedce debug
> system.
> 
> remember also that it's a BSD-style license (OSF 1.0)
> so you can use the code.  [which will save a lot of time].

Hmm, I don't actually see any difference.  Now I've not stared at the
freedec code for long, but it really does look almost exactly like
ours...

Both do a table-lookup at each DEBUG() to figure out what level a
particular subsystem should be emitted at.

> debugging options are specified at service start-time:
> 
> ./rpcserverservice -d0-20.39-41.42

That notation is *ugly*.  And we (that is *both* TNG and HEAD) support
it anyway - but you get the sanity of specifying it as a text string. 
Yes, it gets unwieldy for large numbers of classes, but we don't have
that many at present.

However, because we do it as text strings, we can dynamically register
them, and *that* has proven to be quite useful in some of our plugins.

> the debug #defines are listed in freedce/include/rpcdebug.h
> and there are about 45 of them.

Which really seems to many - but each to their own.  We have around 10
so far.

> one of them is for IDL memory, another is for security purposes,
> another is for temporary memory, another is for yacc,
> another is for the BSD-style communication subsystem,
> another is specifically for TCP under the BSD-style
> comms sub-sys, another for UDP.
> 
> basically every sub-system under the sun in freedce has its own
> debug #define number, and you specify the numbers at run-time
> of which one(s) you want to view.
> 
> the DEBUG macro has one extra argument - the #define
> listed in freedce/include/rpcdebug.h.

The Samba system just uses a per-file #define, which meant that idra and
Elrond were actually able to implement it without touching each and
every DEBUG.

> i recommended this method to andrew over eighteen months
> ago.

And as far as I can tell HEAD has actually had this (just not finished,
and unused) for about that long.  Fortunately idra and Elrond decided to
actually make it useful...

Looking at the CVS logs, jreilly implemented this 17 months ago.

> like everything else i recommended, he rubbished it and
> its usefulness to samba.

It has serious problems.  Each DEBUG() (and we have a *lot* more
DEBUG()s than I could find in freedce) expands to quite a large peice of
code.  And it almost got killed a few months back.  But I like it, and
now that it is actually used I think it will stay.

> despite it having been implemented in several development
> independent programming environments before and after
> freedce.

You know those arguments have never carried much weight around here. 
But the fundamental idea of debug classes is sane (but expensive). 
Samba takes a considerable diet when we turn the maximum debug down to
0....

> On Sun, Jul 14, 2002 at 09:15:41PM +0200, Elrond wrote:
> > elrond      2002/07/14 21:15:41 CEST
> >
> > Modified files:
> >    source/include         debug.h
> >    source/lib             debug.c
> > Log:
> > Updated debug system.
> > Most of this new system is by me, and head has tested it
> > some weeks/month for me. ;-)
> > It includes dynamic registration of debug levels and makes
> > some things a little more cleaner.
> >
> > After the cvs update, you have to do a complete recompile.
> >
> >
> > Revision  Changes    Path
> > 1.7       +8 -11     tng/source/include/debug.h
> > 1.14      +295 -78   tng/source/lib/debug.c

-- 
Andrew Bartlett                                 abartlet at pcug.org.au
Manager, Authentication Subsystems, Samba Team  abartlet at samba.org
Student Network Administrator, Hawker College   abartlet at hawkerc.net
http://samba.org     http://build.samba.org     http://hawkerc.net




More information about the samba-technical mailing list