summaryrefslogtreecommitdiff
path: root/lib/util/util.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-07-20 15:31:49 +1000
committerAndrew Tridgell <tridge@samba.org>2010-09-04 12:29:10 +1000
commitb58bfb351025816b18389ac2377c429b8a777dde (patch)
tree5453e8198587591c2b9c409e63f653970c1f5162 /lib/util/util.c
parent31d3227074a63ab7f66f74eca019884bb2e236da (diff)
downloadsamba-b58bfb351025816b18389ac2377c429b8a777dde.tar.gz
samba-b58bfb351025816b18389ac2377c429b8a777dde.tar.bz2
samba-b58bfb351025816b18389ac2377c429b8a777dde.zip
util: added samba_start_debugger()
This developer function is useful for debugging unusual error conditions
Diffstat (limited to 'lib/util/util.c')
-rw-r--r--lib/util/util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/util/util.c b/lib/util/util.c
index d645f7edc9..c0af4b0116 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -891,3 +891,17 @@ void *allocate_anonymous_shared(size_t bufsz)
}
+#ifdef DEVELOPER
+/* used when you want a debugger started at a particular point in the
+ code. Mostly useful in code that runs as a child process, where
+ normal gdb attach is harder to organise.
+*/
+void samba_start_debugger(void)
+{
+ char *cmd = NULL;
+ asprintf(&cmd, "xterm -e \"gdb --pid %u\"&", getpid());
+ system(cmd);
+ free(cmd);
+ sleep(2);
+}
+#endif