Attach GDB when we are in the bad condition
authorMatthieu Patou <mat@matws.net>
Mon, 8 Jul 2013 17:58:44 +0000 (10:58 -0700)
committerMatthieu Patou <mat@matws.net>
Mon, 21 Oct 2013 08:47:40 +0000 (01:47 -0700)
Signed-off-by: Matthieu Patou <mat@matws.net>
source4/dsdb/samdb/ldb_modules/linked_attributes.c

index 63ccbde896b03cfaa745f0df7ed8e98058eea97c..b728f67760a4b31ecbb57d7bd557a2ff7e03cf59 100644 (file)
@@ -36,6 +36,7 @@
 #include "dsdb/samdb/samdb.h"
 #include "librpc/gen_ndr/ndr_misc.h"
 #include "dsdb/samdb/ldb_modules/util.h"
+#include <unistd.h>
 
 struct la_private {
        struct la_context *la_list;
@@ -161,6 +162,19 @@ static int la_guid_from_dn(struct ldb_module *module,
 
        ret = dsdb_module_guid_by_dn(module, dn, guid, parent);
        if (ret != LDB_SUCCESS) {
+               pid_t ppid = getpid();
+               pid_t pid = fork();
+               if (pid == 0) {
+                       char buf[1024];
+                       snprintf(buf, 1024, "%s %d",
+                               "/tmp/samba-4.0.6/selftest/gdb_backtrace",
+                               ppid);
+                       fprintf(stderr, "%s",buf);
+                       system(buf);
+                       sleep(60);
+               } else {
+                       sleep(60);
+               }
                DEBUG(4,(__location__ ": Failed to find GUID for dn %s\n",
                         ldb_dn_get_linearized(dn)));
                return ret;