[SCM] Samba Shared Repository - branch master updated

Andrew Tridgell tridge at samba.org
Fri Apr 2 02:09:53 MDT 2010


The branch, master has been updated
       via  23f2db7... s4-python: added --debuglevel to our python scripts
       via  2c097b5... s4-pyglue: setup talloc logging in python modules
       via  a8d213c... pyrpc: do the pipe connect on a real memory context
       via  b81100c... debug: enable talloc logging
       via  fde50c6... talloc: a useful bit of debug code
       via  1b4bbec... talloc: add a define for TALLOC_MAX_DEPTH
      from  5ccd30e... talloc: change talloc minor version to 2.0.2

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 23f2db7ab60be499327ae40d7e4c604ded910bea
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Apr 2 18:31:30 2010 +1100

    s4-python: added --debuglevel to our python scripts
    
    very useful for debugging our cPython extensions, such as dcerpc
    modules

commit 2c097b51cb62a0b3cc159faea62d831d897f6017
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Apr 2 18:21:14 2010 +1100

    s4-pyglue: setup talloc logging in python modules

commit a8d213c151a73b007c62287ae068201c5a36532e
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Apr 2 18:20:51 2010 +1100

    pyrpc: do the pipe connect on a real memory context

commit b81100c71059698dbf4f1aaae52df48f65836b8e
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Apr 2 18:19:47 2010 +1100

    debug: enable talloc logging
    
    we want to ensure talloc warnings are printed in the log

commit fde50c633f3a48c8e63718903a77e2c1ecc12a55
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Apr 2 18:18:53 2010 +1100

    talloc: a useful bit of debug code
    
    this is useful when tracking down talloc loops. It is probably too
    expensive to have on by default.

commit 1b4bbec523f2bf20d91c177e7fdb4b7f87431926
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Apr 2 18:17:52 2010 +1100

    talloc: add a define for TALLOC_MAX_DEPTH
    
    Thanks to the suggestion from simo

-----------------------------------------------------------------------

Summary of changes:
 lib/talloc/talloc.c                      |   10 +++++++++-
 lib/talloc/talloc.h                      |    4 ++++
 lib/util/debug.c                         |   12 ++++++++++++
 lib/util/debug.h                         |    3 +++
 source4/librpc/rpc/pyrpc.c               |    2 +-
 source4/scripting/python/pyglue.c        |    2 ++
 source4/scripting/python/samba/getopt.py |   10 ++++++++++
 7 files changed, 41 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c
index 51a0023..bc1c697 100644
--- a/lib/talloc/talloc.c
+++ b/lib/talloc/talloc.c
@@ -754,6 +754,14 @@ void *_talloc_steal_loc(const void *new_ctx, const void *ptr, const char *locati
 				   h->location);
 		}
 	}
+
+#if 0
+	/* this test is probably too expensive to have on in the
+	   normal build, but it useful for debugging */
+	if (talloc_is_parent(new_ctx, ptr)) {
+		talloc_log("WARNING: stealing into talloc child at %s\n", location);
+	}
+#endif
 	
 	return _talloc_steal_internal(new_ctx, ptr);
 }
@@ -1999,5 +2007,5 @@ static int _talloc_is_parent(const void *context, const void *ptr, int depth)
 */
 int talloc_is_parent(const void *context, const void *ptr)
 {
-	return _talloc_is_parent(context, ptr, 10000);
+	return _talloc_is_parent(context, ptr, TALLOC_MAX_DEPTH);
 }
diff --git a/lib/talloc/talloc.h b/lib/talloc/talloc.h
index 4adc206..a98cff4 100644
--- a/lib/talloc/talloc.h
+++ b/lib/talloc/talloc.h
@@ -1591,4 +1591,8 @@ void talloc_set_log_stderr(void);
 #define talloc_append_string(c, s, a) (s?talloc_strdup_append(s,a):talloc_strdup(c, a))
 #endif
 
+#ifndef TALLOC_MAX_DEPTH
+#define TALLOC_MAX_DEPTH 10000
+#endif
+
 #endif
diff --git a/lib/util/debug.c b/lib/util/debug.c
index 996efdf..c8a2214 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -182,12 +182,24 @@ _PUBLIC_ void reopen_logs(void)
 	}
 }
 
+/* setup for logging of talloc warnings */
+static void talloc_log_fn(const char *msg)
+{
+	DEBUG(0,("%s", msg));
+}
+
+void debug_setup_talloc_log(void)
+{
+	talloc_set_log_fn(talloc_log_fn);
+}
+
 /**
   control the name of the logfile and whether logging will be to stdout, stderr
   or a file
 */
 _PUBLIC_ void setup_logging(const char *prog_name, enum debug_logtype new_logtype)
 {
+	debug_setup_talloc_log();
 	if (state.logtype < new_logtype) {
 		state.logtype = new_logtype;
 	}
diff --git a/lib/util/debug.h b/lib/util/debug.h
index eb2151f..fd2adcf 100644
--- a/lib/util/debug.h
+++ b/lib/util/debug.h
@@ -141,4 +141,7 @@ _PUBLIC_ void dbgtext(const char *format, ...) PRINTF_ATTRIBUTE(1,2);
 struct _XFILE;
 extern struct _XFILE *dbf;
 
+/* setup talloc logging */
+void debug_setup_talloc_log(void);
+
 #endif
diff --git a/source4/librpc/rpc/pyrpc.c b/source4/librpc/rpc/pyrpc.c
index 012f188..2398f27 100644
--- a/source4/librpc/rpc/pyrpc.c
+++ b/source4/librpc/rpc/pyrpc.c
@@ -346,7 +346,7 @@ PyObject *py_dcerpc_interface_init_helper(PyTypeObject *type, PyObject *args, Py
 
 		status = dcerpc_secondary_context(base_pipe, &ret->pipe, table);
 	} else {
-		status = dcerpc_pipe_connect(NULL, &ret->pipe, binding_string, 
+		status = dcerpc_pipe_connect(event_ctx, &ret->pipe, binding_string,
 		             table, credentials, event_ctx, lp_ctx);
 	}
 	if (NT_STATUS_IS_ERR(status)) {
diff --git a/source4/scripting/python/pyglue.c b/source4/scripting/python/pyglue.c
index 1071279..8fe764c 100644
--- a/source4/scripting/python/pyglue.c
+++ b/source4/scripting/python/pyglue.c
@@ -700,6 +700,8 @@ void initglue(void)
 {
 	PyObject *m;
 
+	debug_setup_talloc_log();
+
 	m = Py_InitModule3("glue", py_misc_methods, 
 			   "Python bindings for miscellaneous Samba functions.");
 	if (m == NULL)
diff --git a/source4/scripting/python/samba/getopt.py b/source4/scripting/python/samba/getopt.py
index ba7a9eb..62e16f7 100644
--- a/source4/scripting/python/samba/getopt.py
+++ b/source4/scripting/python/samba/getopt.py
@@ -22,6 +22,7 @@
 import optparse
 from credentials import Credentials, DONT_USE_KERBEROS, MUST_USE_KERBEROS
 from hostconfig import Hostconfig
+import glue
 
 __docformat__ = "restructuredText"
 
@@ -32,7 +33,11 @@ class SambaOptions(optparse.OptionGroup):
         self.add_option("-s", "--configfile", action="callback",
                         type=str, metavar="FILE", help="Configuration file",
                         callback=self._load_configfile)
+        self.add_option("-d", "--debuglevel", action="callback",
+                        type=int, metavar="DEBUGLEVEL", help="debug level",
+                        callback=self._set_debuglevel)
         self._configfile = None
+        self._debuglevel = None
 
     def get_loadparm_path(self):
         """Return the path to the smb.conf file specified on the command line.  """
@@ -41,6 +46,9 @@ class SambaOptions(optparse.OptionGroup):
     def _load_configfile(self, option, opt_str, arg, parser):
         self._configfile = arg
 
+    def _set_debuglevel(self, option, opt_str, arg, parser):
+        self._debuglevel = arg
+
     def get_loadparm(self):
         """Return a loadparm object with data specified on the command line.  """
         import os, param
@@ -51,6 +59,8 @@ class SambaOptions(optparse.OptionGroup):
             lp.load(os.getenv("SMB_CONF_PATH"))
         else:
             lp.load_default()
+        if self._debuglevel:
+            glue.set_debug_level(self._debuglevel)
         return lp
 
     def get_hostconfig(self):


-- 
Samba Shared Repository


More information about the samba-cvs mailing list