aboutsummaryrefslogtreecommitdiffstats
path: root/include/asterisk/logger.h
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-05-23 22:35:50 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-05-23 22:35:50 +0000
commitc0ca2a427bbbe205b9fd8d7a2c8b119cb56c6c80 (patch)
treec8d0825b33b156cc9ea02bc81363305f700e8393 /include/asterisk/logger.h
parent972905a6358c269996d5d7abaa89a4f2d5d350fa (diff)
A new feature thanks to the fine folks at Switchvox!
If a deadlock is detected, then the typical lock information will be printed along with a backtrace of the stack for the offending threads. Use of this requires compiling with DETECT_DEADLOCKS and having glibc installed. Furthermore, issuing the "core show locks" CLI command will print the normal lock information as well as a backtraces for each lock. This requires that DEBUG_THREADS is enabled and that glibc is installed. All the backtrace features may be disabled by running the configure script with --without-execinfo as an argument git-svn-id: http://svn.digium.com/svn/asterisk/trunk@118173 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include/asterisk/logger.h')
-rw-r--r--include/asterisk/logger.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/include/asterisk/logger.h b/include/asterisk/logger.h
index 4995c54c2..2695efb99 100644
--- a/include/asterisk/logger.h
+++ b/include/asterisk/logger.h
@@ -219,6 +219,50 @@ unsigned int ast_verbose_get_by_file(const char *file);
} \
} while (0)
+#ifndef _LOGGER_BACKTRACE_H
+#define _LOGGER_BACKTRACE_H
+#ifdef HAVE_BKTR
+#define AST_MAX_BT_FRAMES 32
+/* \brief
+ *
+ * A structure to hold backtrace information. This structure provides an easy means to
+ * store backtrace information or pass backtraces to other functions.
+ */
+struct ast_bt {
+ /*! The addresses of the stack frames. This is filled in by calling the glibc backtrace() function */
+ void *addresses[AST_MAX_BT_FRAMES];
+ /*! The number of stack frames in the backtrace */
+ int num_frames;
+ /*! Tells if the ast_bt structure was dynamically allocated */
+ unsigned int alloced:1;
+};
+
+/* \brief
+ * Allocates memory for an ast_bt and stores addresses and symbols.
+ *
+ * \return Returns NULL on failure, or the allocated ast_bt on success
+ */
+struct ast_bt *ast_bt_create(void);
+
+/* \brief
+ * Fill an allocated ast_bt with addresses
+ *
+ * \retval 0 Success
+ * \retval -1 Failure
+ */
+int ast_bt_get_addresses(struct ast_bt *bt);
+
+/* \brief
+ *
+ * Free dynamically allocated portions of an ast_bt
+ *
+ * \retval NULL.
+ */
+void *ast_bt_destroy(struct ast_bt *bt);
+
+#endif /* HAVE_BKTR */
+#endif /* _LOGGER_BACKTRACE_H */
+
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif