From 9c8b6cd6a1bf06ae6efa2d4a8402e481ef5b07b5 Mon Sep 17 00:00:00 2001 From: bubulle Date: Thu, 16 Jun 2011 20:24:37 +0000 Subject: Merge release 3.5.9 git-svn-id: svn://svn.debian.org/svn/pkg-samba/trunk/samba@3825 fc4039ab-9d04-0410-8cac-899223bdd6b0 --- docs/htmldocs/Samba3-Developers-Guide/debug.html | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'docs/htmldocs/Samba3-Developers-Guide/debug.html') diff --git a/docs/htmldocs/Samba3-Developers-Guide/debug.html b/docs/htmldocs/Samba3-Developers-Guide/debug.html index a9c518e142..6c65d83f23 100644 --- a/docs/htmldocs/Samba3-Developers-Guide/debug.html +++ b/docs/htmldocs/Samba3-Developers-Guide/debug.html @@ -1,4 +1,4 @@ -Chapter 4. The samba DEBUG system

Chapter 4. The samba DEBUG system

Chris Hertel

July 1998

New Output Syntax

+Chapter 4. The samba DEBUG system

Chapter 4. The samba DEBUG system

Chris Hertel

July 1998

New Output Syntax

The syntax of a debugging log file is represented as:

   >debugfile< :== { >debugmsg< }
@@ -25,12 +25,12 @@ FUNCTION is the function from which the debug message was generated.
 

LINE is the line number of the debug statement that generated the message. -

Basically, what that all means is:

  1. +

    Basically, what that all means is:

    1. A debugging log file is made up of debug messages. -

    2. +

    3. Each debug message is made up of a header and text. The header is separated from the text by a newline. -

    4. +

    5. The header begins with the timestamp and debug level of the message enclosed in brackets. The filename, function, and line number at which the message was generated follow. The filename is @@ -38,7 +38,7 @@ terminated by a colon, and the function name is terminated by the parenthesis which contain the line number. Depending upon the compiler, the function name may be missing (it is generated by the __FUNCTION__ macro, which is not universally implemented, dangit). -

    6. +

    7. The message text is made up of zero or more lines, each terminated by a newline.

    Here's some example output:

    @@ -51,7 +51,7 @@ by a newline.
     Note that in the above example the function names are not listed on
     the header line. That's because the example above was generated on an
     SGI Indy, and the SGI compiler doesn't support the __FUNCTION__ macro.
    -

The DEBUG() Macro

+

The DEBUG() Macro

Use of the DEBUG() macro is unchanged. DEBUG() takes two parameters. The first is the message level, the second is the body of a function call to the Debug1() function. @@ -102,7 +102,7 @@ would look like this: [1998/07/30 16:00:51, 0] file.c:function(261) .

Which isn't much use. The format buffer kludge fixes this problem. -

The DEBUGADD() Macro

+

The DEBUGADD() Macro

In addition to the kludgey solution to the broken line problem described above, there is a clean solution. The DEBUGADD() macro never generates a header. It will append new text to the current debug @@ -116,7 +116,7 @@ DEBUGADD() macro is the same as that of the DEBUG() macro. This is the first line. This is the second line. This is the third line. -

The DEBUGLVL() Macro

+

The DEBUGLVL() Macro

One of the problems with the DEBUG() macro was that DEBUG() lines tended to get a bit long. Consider this example from nmbd_sendannounce.c: @@ -143,15 +143,15 @@ the global DEBUGLEVEL value, so: dbgtext( "on subnet %s ", subrec->subnet_name ); dbgtext( "for workgroup %s\n", work->work_group ); } -

(The dbgtext() function is explained below.)

There are a few advantages to this scheme:

  1. +

    (The dbgtext() function is explained below.)

    There are a few advantages to this scheme:

    1. The test is performed only once. -

    2. +

    3. You can allocate variables off of the stack that will only be used within the DEBUGLVL() block. -

    4. +

    5. Processing that is only relevant to debug output can be contained within the DEBUGLVL() block. -

New Functions

dbgtext()

+

New Functions

dbgtext()

This function prints debug message text to the debug file (and possibly to syslog) via the format buffer. The function uses a variable argument list just like printf() or Debug1(). The @@ -160,7 +160,7 @@ and then passed to format_debug_text(). If you use DEBUGLVL() you will probably print the body of the message using dbgtext(). -

dbghdr()

+

dbghdr()

This is the function that writes a debug message header. Headers are not processed via the format buffer. Also note that if the format buffer is not empty, a call to dbghdr() will not @@ -168,7 +168,7 @@ produce any output. See the comments in dbghdr() for more info.

It is not likely that this function will be called directly. It is used by DEBUG() and DEBUGADD(). -

format_debug_text()

+

format_debug_text()

This is a static function in debug.c. It stores the output text for the body of the message in a buffer until it encounters a newline. When the newline character is found, the buffer is -- cgit v1.2.3