}
}
-/*
- * Global variables to get information about lock/unlock db access
- */
-utime_t _db_lock_time = 0;
-int _db_lock_recurse_count = 0;
-pthread_t _db_lock_threadid;
-
-static void print_lock_dbg(FILE *fp)
-{
- char buf[128];
- bstrutime(buf, sizeof(buf), _db_lock_time);
-
- fprintf(fp, "lock info: recurse_count=%i threadid=0x%x time=%s\n",
- _db_lock_recurse_count, (int)_db_lock_threadid, buf);
-}
-
/* defined in jcr.c */
-extern void _print_jcr_dbg(FILE *fp);
+extern void _dbg_print_jcr(FILE *fp);
+/* defined in plugin.c */
+extern void _dbg_print_plugin(FILE *fp);
/*
* !!! WARNING !!!
* This function should be used ONLY after a violent signal. We walk through the
* JCR chain without doing any lock, bacula should not be running.
*/
-static void print_bacula_dbg()
+static void dbg_print_bacula()
{
char buf[512];
- snprintf(buf, sizeof(buf), "%s/bacula.%d.bactrace",
- working_directory, getpid());
+ snprintf(buf, sizeof(buf), "%s/%s.%d.bactrace",
+ working_directory, my_name, getpid());
FILE *fp = fopen(buf, "ab") ;
if (!fp) {
fp = stderr;
}
+
+ fprintf(stderr, "Dumping: %s\n", buf);
+
+ /* Print also B_DB and RWLOCK structure
+ * Can add more info about JCR with dbg_jcr_add_hook()
+ */
+ _dbg_print_jcr(fp);
- _print_jcr_dbg(fp);
- print_lock_dbg(fp);
+ _dbg_print_plugin(fp);
if (fp != stderr) {
fclose(fp);
if (sig == SIGTERM) {
// Emsg1(M_TERM, -1, "Shutting down Bacula service: %s ...\n", my_name);
} else {
- Emsg2(M_FATAL, -1, _("Bacula interrupted by signal %d: %s\n"), sig, get_signal_name(sig));
+/* ***FIXME*** Display a message without taking any lock in the system
+ * Emsg2(M_FATAL, -1, _("Bacula interrupted by signal %d: %s\n"), sig, get_signal_name(sig));
+ */
+ fprintf(stderr, _("Bacula interrupted by signal %d: %s\n"), sig, get_signal_name(sig));
}
#ifdef TRACEBACK
Dmsg0(500, "Done waitpid\n");
fprintf(stderr, _("Traceback complete, attempting cleanup ...\n"));
/* print information about the current state into working/<file>.bactrace */
- print_bacula_dbg();
+ dbg_print_bacula();
exit_handler(sig); /* clean up if possible */
Dmsg0(500, "Done exit_handler\n");
} else {
bmicrosleep(30, 0);
}
fprintf(stderr, _("It looks like the traceback worked ...\n"));
+ dbg_print_bacula();
}
#endif
-
exit_handler(sig);
}