You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gb...@apache.org on 2013/05/07 17:09:06 UTC

svn commit: r1479934 - in /subversion/site/publish/docs/community-guide: debugging.part.html debugging.toc.html

Author: gbg
Date: Tue May  7 15:09:06 2013
New Revision: 1479934

URL: http://svn.apache.org/r1479934
Log:
Add section describing usage of the SVN_DBG macro to the Community Guide page
'Debugging SVN'. 

* publish/docs/community-guide/debugging.part.html
  (svn_dbg): Provide overview, links, hints and sample patches. 

* publish/docs/community-guide/debugging.toc.html
  (): Add link to section svn_dbg.

Suggested by: danielsh

Modified:
    subversion/site/publish/docs/community-guide/debugging.part.html
    subversion/site/publish/docs/community-guide/debugging.toc.html

Modified: subversion/site/publish/docs/community-guide/debugging.part.html
URL: http://svn.apache.org/viewvc/subversion/site/publish/docs/community-guide/debugging.part.html?rev=1479934&r1=1479933&r2=1479934&view=diff
==============================================================================
--- subversion/site/publish/docs/community-guide/debugging.part.html (original)
+++ subversion/site/publish/docs/community-guide/debugging.part.html Tue May  7 15:09:06 2013
@@ -6,7 +6,94 @@
 
 <!--#include virtual="debugging.toc.html" -->
 
-<p class="todo">TODO: document <tt>SVN_DBG</tt></p>
+<div class="h2" id="svn_dbg">
+<h2>Debugging with SVN_DBG
+  <a class="sectionlink" href="<!--#echo var="GUIDE_DEBUGGING_PAGE" -->#debugging-svn_debug"
+    title="Link to this section">&para;</a>
+</h2>
+
+<p>The SVN_DBG debugging tool is a C Preprocessor macro that sends
+debugging output to stdout (by default) or stderr whilst not interfering
+with the SVN test suite.</p>
+ 
+<p>It provides an alternative to a debugger such as gdb, or
+alternatively, extra information to assist in the use of a debugger.  It
+might be especially useful in situations where a debugger cannot be
+used.</p>
+
+<p>The svn_debug module contains two debug aid macros that print the
+file:line of the call and printf-like arguments to
+the <code>#SVN_DBG_OUTPUT </code> stdio stream (#stdout by
+default):</p>
+
+<pre>
+SVN_DBG( ( const char *fmt, ...) ) /* double braces are neccessary */
+</pre>
+and
+<pre>
+SVN_DBG_PROPS( ( apr_hash_t *props, const char *header_fmt, ...) )
+</pre>
+
+<p>Controlling SVN_DBG output:</p>
+<ul>
+<li>SVN_DBG is enabled whenever svn is configured
+with <code>--enable-maintainer-mode</code>.
+</li>
+<li>The SVN test suite turns off SVN_DBG output automatically, to
+suppress the output manually, set the <code>SVN_DBG_QUIET</code>
+variable to 1 in your shell environment.
+</li>
+<li>When you are done, please be sure to remove any instances of
+the <code>SVN_DBG </code> and <code>SVN_DBG_PROPS </code> macros from
+any code you are committing and from any patch that you send to the
+list.  (AKA: Do not forget a scalpel in the patient!)
+</li>
+</ul>
+
+<p>The SVN_DBG macro definitions and code are located in:</p>
+<ul>
+<li><a href="https://svn.apache.org/repos/asf/subversion/trunk/subversion/include/private/svn_debug.h">
+subversion/include/private/svn_debug.h</a> </li>
+<li><a href="https://svn.apache.org/repos/asf/subversion/trunk/subversion/libsvn_subr/debug.c">
+subversion/libsvn_subr/debug.c
+</a></li>
+</ul>
+
+<p>Sample patch showing usage of the SVN_DBG macro:</p>
+
+<pre>
+Index: subversion/libsvn_fs_fs/fs_fs.c
+===================================================================
+--- subversion/libsvn_fs_fs/fs_fs.c     (revision 1476635)
++++ subversion/libsvn_fs_fs/fs_fs.c     (working copy)
+@@ -2303,6 +2303,9 @@ get_node_revision_body(node_revision_t **noderev_p
+ 
+   /* First, try a cache lookup. If that succeeds, we are done here. */
+   SVN_ERR(get_cached_node_revision_body(noderev_p, fs, id, &#38;is_cached, pool));
++  SVN_DBG(("Getting %s from: %s\n", 
++           svn_fs_fs__id_unparse(id),
++           is_cached ? "cache" : "disk"));
+   if (is_cached)
+     return SVN_NO_ERROR;
+</pre>
+
+<p>Sample patch showing usage of the SVN_DBG_PROPS macro:</p>
+
+<pre>
+Index: subversion/svn/proplist-cmd.c
+===================================================================
+--- subversion/svn/proplist-cmd.c	(revision 1475745)
++++ subversion/svn/proplist-cmd.c	(working copy)
+@@ -221,6 +221,7 @@ svn_cl__proplist(apr_getopt_t *os,
+                                       URL, &#38;(opt_state->start_revision),
+                                       &#38;rev, ctx, scratch_pool));
++      /*  this can be called with svn proplist  --revprop -r &lt;rev&gt; */
++      SVN_DBG_PROPS((proplist,"The variable apr_hash_t *proplist contains: "));
+       if (opt_state->xml)
+         {
+           svn_stringbuf_t *sb = NULL;
+</pre>
+</div> <!-- svn_debug -->
 
 <div class="h2" id="server-debugging">
 <h2>Debugging the server

Modified: subversion/site/publish/docs/community-guide/debugging.toc.html
URL: http://svn.apache.org/viewvc/subversion/site/publish/docs/community-guide/debugging.toc.html?rev=1479934&r1=1479933&r2=1479934&view=diff
==============================================================================
--- subversion/site/publish/docs/community-guide/debugging.toc.html (original)
+++ subversion/site/publish/docs/community-guide/debugging.toc.html Tue May  7 15:09:06 2013
@@ -1,11 +1,13 @@
 <!--#if expr='"$DOCUMENT_NAME" = "debugging.html" || "$DOCUMENT_NAME" = "community-guide.html"' -->
 <ul>
+  <li><a href="#svn_dbg">Debugging with SVN_DBG</a></li>
   <li><a href="#server-debugging">Debugging the server</a></li>
   <li><a href="#net-trace">Tracing network traffic</a></li>
   <li><a href="#tracing-memory-leaks">Tracking down memory leaks</a></li>
 </ul>
 <!--#else -->
 <ul>
+  <li><a href="debugging.html#svn_dbg">Debugging with SVN_DBG</a></li>
   <li><a href="debugging.html#server-debugging">Debugging the server</a></li>
   <li><a href="debugging.html#net-trace">Tracing network traffic</a></li>
   <li><a href="debugging.html#tracing-memory-leaks">Tracking down memory leaks</a></li>