[svn-commits] tilghman: branch 1.6.2 r298957 - in /branches/1.6.2: ./ build_tools/ include/...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Dec 17 23:31:00 UTC 2010


Author: tilghman
Date: Fri Dec 17 17:30:55 2010
New Revision: 298957

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=298957
Log:
Merged revisions 298905 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r298905 | tilghman | 2010-12-17 15:40:56 -0600 (Fri, 17 Dec 2010) | 6 lines
  
  Let Asterisk find better backtrace information with libbfd.
  
  The menuselect option BETTER_BACKTRACES, if enabled, will use libbfd to search
  for better symbol information within both the Asterisk binary, as well as
  loaded modules, to assist when using inline backtraces to track down problems.
........

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/build_tools/cflags-devmode.xml
    branches/1.6.2/build_tools/menuselect-deps.in
    branches/1.6.2/configure
    branches/1.6.2/configure.ac
    branches/1.6.2/include/asterisk/autoconfig.h.in
    branches/1.6.2/include/asterisk/logger.h
    branches/1.6.2/include/asterisk/utils.h
    branches/1.6.2/main/Makefile
    branches/1.6.2/main/astobj2.c
    branches/1.6.2/main/logger.c
    branches/1.6.2/main/say.c
    branches/1.6.2/main/utils.c
    branches/1.6.2/makeopts.in
    branches/1.6.2/utils/ael_main.c
    branches/1.6.2/utils/check_expr.c
    branches/1.6.2/utils/conf2ael.c
    branches/1.6.2/utils/hashtest.c
    branches/1.6.2/utils/hashtest2.c
    branches/1.6.2/utils/refcounter.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: branches/1.6.2/build_tools/cflags-devmode.xml
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/build_tools/cflags-devmode.xml?view=diff&rev=298957&r1=298956&r2=298957
==============================================================================
--- branches/1.6.2/build_tools/cflags-devmode.xml (original)
+++ branches/1.6.2/build_tools/cflags-devmode.xml Fri Dec 17 17:30:55 2010
@@ -22,4 +22,9 @@
 		</member>
 		<member name="TEST_FRAMEWORK" displayname="Enable Test Framework API">
 		</member>
+		<member name="BETTER_BACKTRACES" displayname="Use libbfd to generate better inline backtraces">
+			<depend>BFD</depend>
+			<depend>DLADDR</depend>
+			<defaultenabled>no</defaultenabled>
+		</member>
 	</category>

Modified: branches/1.6.2/build_tools/menuselect-deps.in
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/build_tools/menuselect-deps.in?view=diff&rev=298957&r1=298956&r2=298957
==============================================================================
--- branches/1.6.2/build_tools/menuselect-deps.in (original)
+++ branches/1.6.2/build_tools/menuselect-deps.in Fri Dec 17 17:30:55 2010
@@ -1,8 +1,10 @@
 ALSA=@PBX_ALSA@
 CRYPTO=@PBX_CRYPTO@
+BFD=@PBX_BFD@
 BISON=@PBX_BISON@
 CURL=@PBX_CURL@
 DAHDI=@PBX_DAHDI@
+DLADDR=@PBX_DLADDR@
 FLEX=@PBX_FLEX@
 FREETDS=@PBX_FREETDS@
 GENERIC_ODBC=@PBX_GENERIC_ODBC@

Modified: branches/1.6.2/configure.ac
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/configure.ac?view=diff&rev=298957&r1=298956&r2=298957
==============================================================================
--- branches/1.6.2/configure.ac (original)
+++ branches/1.6.2/configure.ac Fri Dec 17 17:30:55 2010
@@ -295,15 +295,16 @@
 # to make things easier for the users.
 
 AST_EXT_LIB_SETUP([ALSA], [Advanced Linux Sound Architecture], [asound])
-AST_EXT_LIB_SETUP([FFMPEG], [Ffmpeg and avcodec], [avcodec])
+AST_EXT_LIB_SETUP([BFD], [Debug symbol decoding], [bfd])
+
+# BKTR is used for backtrace support on platforms that do not
+# have it natively.
+AST_EXT_LIB_SETUP([BKTR], [Stack Backtrace], [execinfo])
 AST_EXT_LIB_SETUP([CAP], [POSIX 1.e capabilities], [cap])
 AST_EXT_LIB_SETUP([CURSES], [curses], [curses])
 AST_EXT_LIB_SETUP([CRYPTO], [OpenSSL Cryptography], [crypto])
 AST_EXT_LIB_SETUP([DAHDI], [DAHDI], [dahdi])
-
-# BKTR is used for backtrace support on platforms that do not
-# have it natively.
-AST_EXT_LIB_SETUP([BKTR], [Stack Backtrace], [execinfo])
+AST_EXT_LIB_SETUP([FFMPEG], [Ffmpeg and avcodec], [avcodec])
 AST_EXT_LIB_SETUP([GSM], [External GSM], [gsm], [, use 'internal' GSM otherwise])
 AST_EXT_LIB_SETUP([GTK], [gtk], [gtk])
 AST_EXT_LIB_SETUP([GTK2], [gtk2], [gtk2])
@@ -820,6 +821,23 @@
   AC_DEFINE([TYPEOF_FD_SET_FDS_BITS], [long long], [Define to a type of the same size as fd_set.fds_bits[[0]]])
 fi ; fi ; fi
 
+AC_MSG_CHECKING(for dladdr in dlfcn.h)
+PBX_DLADDR=0
+old_LIBS=${LIBS}
+LIBS="${LIBS} -ldl"
+AC_LINK_IFELSE(
+	AC_LANG_PROGRAM([#define _GNU_SOURCE 1
+#include <dlfcn.h>],
+		[dladdr((void *)0, (void *)0)]
+	),
+	AC_MSG_RESULT(yes)
+	PBX_DLADDR=1
+	AC_SUBST([PBX_DLADDR])
+	AC_DEFINE([HAVE_DLADDR], 1, [Define to 1 if your system has the dladdr() GNU extension]),
+	AC_MSG_RESULT(no)
+)
+LIBS=${old_LIBS}
+
 # PKGCONFIG is used in later tests
 AC_CHECK_TOOL(PKGCONFIG, pkg-config, No)
 
@@ -827,6 +845,8 @@
 # do the package library checks now
 
 AST_EXT_LIB_CHECK([ALSA], [asound], [snd_spcm_init], [alsa/asoundlib.h], [-lm -ldl])
+
+AST_EXT_LIB_CHECK([BFD], [bfd], [bfd_openr], [bfd.h])
 
 AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h])
 

Modified: branches/1.6.2/include/asterisk/autoconfig.h.in
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/include/asterisk/autoconfig.h.in?view=diff&rev=298957&r1=298956&r2=298957
==============================================================================
--- branches/1.6.2/include/asterisk/autoconfig.h.in (original)
+++ branches/1.6.2/include/asterisk/autoconfig.h.in Fri Dec 17 17:30:55 2010
@@ -110,6 +110,9 @@
 /* Define to 1 if your GCC C compiler supports the 'weak_import' attribute. */
 #undef HAVE_ATTRIBUTE_weak_import
 
+/* Define to 1 if you have the Debug symbol decoding library. */
+#undef HAVE_BFD
+
 /* Define to 1 if you have the Stack Backtrace library. */
 #undef HAVE_BKTR
 
@@ -164,6 +167,9 @@
 /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
    */
 #undef HAVE_DIRENT_H
+
+/* Define to 1 if your system has the dladdr() GNU extension */
+#undef HAVE_DLADDR
 
 /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
 #undef HAVE_DOPRNT

Modified: branches/1.6.2/include/asterisk/logger.h
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/include/asterisk/logger.h?view=diff&rev=298957&r1=298956&r2=298957
==============================================================================
--- branches/1.6.2/include/asterisk/logger.h (original)
+++ branches/1.6.2/include/asterisk/logger.h Fri Dec 17 17:30:55 2010
@@ -276,6 +276,16 @@
  */
 void *ast_bt_destroy(struct ast_bt *bt);
 
+/* \brief Retrieve symbols for a set of backtrace addresses
+ *
+ * \param addresses A list of addresses, such as the ->addresses structure element of struct ast_bt.
+ * \param num_frames Number of addresses in the addresses list
+ * \retval NULL Unable to allocate memory
+ * \return List of strings
+ * \since 1.6.2.16
+ */
+char **ast_bt_get_symbols(void **addresses, size_t num_frames);
+
 #endif /* HAVE_BKTR */
 #endif /* _LOGGER_BACKTRACE_H */
 

Modified: branches/1.6.2/include/asterisk/utils.h
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/include/asterisk/utils.h?view=diff&rev=298957&r1=298956&r2=298957
==============================================================================
--- branches/1.6.2/include/asterisk/utils.h (original)
+++ branches/1.6.2/include/asterisk/utils.h Fri Dec 17 17:30:55 2010
@@ -726,4 +726,13 @@
  */
 int ast_eid_cmp(const struct ast_eid *eid1, const struct ast_eid *eid2);
 
+/*!\brief Resolve a binary to a full pathname
+ * \param binary Name of the executable to resolve
+ * \param fullpath Buffer to hold the complete pathname
+ * \param fullpath_size Size of \a fullpath
+ * \retval NULL \a binary was not found or the environment variable PATH is not set
+ * \return \a fullpath
+ */
+char *ast_utils_which(const char *binary, char *fullpath, size_t fullpath_size);
+
 #endif /* _ASTERISK_UTILS_H */

Modified: branches/1.6.2/main/Makefile
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/main/Makefile?view=diff&rev=298957&r1=298956&r2=298957
==============================================================================
--- branches/1.6.2/main/Makefile (original)
+++ branches/1.6.2/main/Makefile Fri Dec 17 17:30:55 2010
@@ -56,6 +56,10 @@
   AST_LIBS+=$(EDITLINE_LIB) -lm
 endif
 
+ifneq ($(findstring BETTER_BACKTRACES,$(MENUSELECT_CFLAGS)),)
+  AST_LIBS+=$(BFD_LIB)
+endif
+
 ifneq ($(findstring darwin,$(OSARCH)),)
   AST_LIBS+=-lresolv
   ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)

Modified: branches/1.6.2/main/astobj2.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/main/astobj2.c?view=diff&rev=298957&r1=298956&r2=298957
==============================================================================
--- branches/1.6.2/main/astobj2.c (original)
+++ branches/1.6.2/main/astobj2.c Fri Dec 17 17:30:55 2010
@@ -88,7 +88,7 @@
 	char **strings;
 
 	c = backtrace(addresses, N1);
-	strings = backtrace_symbols(addresses,c);
+	strings = ast_bt_get_symbols(addresses,c);
 	ast_verbose("backtrace returned: %d\n", c);
 	for(i = 0; i < c; i++) {
 		ast_verbose("%d: %p %s\n", i, addresses[i], strings[i]);

Modified: branches/1.6.2/main/logger.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/main/logger.c?view=diff&rev=298957&r1=298956&r2=298957
==============================================================================
--- branches/1.6.2/main/logger.c (original)
+++ branches/1.6.2/main/logger.c Fri Dec 17 17:30:55 2010
@@ -46,8 +46,12 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #ifdef HAVE_BKTR
-#include <execinfo.h>
-#define MAX_BACKTRACE_FRAMES 20
+#  include <execinfo.h>
+#  define MAX_BACKTRACE_FRAMES 20
+#  if defined(HAVE_DLADDR) && defined(HAVE_BFD) && defined(BETTER_BACKTRACES)
+#    include <dlfcn.h>
+#    include <bfd.h>
+#  endif
 #endif
 
 #define SYSLOG_NAMES /* so we can map syslog facilities names to their numeric values,
@@ -1214,6 +1218,150 @@
 	return NULL;
 }
 
+char **ast_bt_get_symbols(void **addresses, size_t num_frames)
+{
+	char **strings = NULL;
+#if defined(BETTER_BACKTRACES)
+	int stackfr;
+	bfd *bfdobj;           /* bfd.h */
+	Dl_info dli;           /* dlfcn.h */
+	long allocsize;
+	asymbol **syms = NULL; /* bfd.h */
+	bfd_vma offset;        /* bfd.h */
+	const char *lastslash;
+	asection *section;
+	const char *file, *func;
+	unsigned int line;
+	char address_str[128];
+	char msg[1024];
+	size_t strings_size;
+	size_t *eachlen;
+#endif
+
+#if defined(BETTER_BACKTRACES)
+	strings_size = num_frames * sizeof(*strings);
+	eachlen = ast_calloc(num_frames, sizeof(*eachlen));
+
+	if (!(strings = ast_calloc(num_frames, sizeof(*strings)))) {
+		return NULL;
+	}
+
+	for (stackfr = 0; stackfr < num_frames; stackfr++) {
+		int found = 0, symbolcount;
+
+		msg[0] = '\0';
+
+		if (!dladdr(addresses[stackfr], &dli)) {
+			continue;
+		}
+
+		if (strcmp(dli.dli_fname, "asterisk") == 0) {
+			char asteriskpath[256];
+			if (!(dli.dli_fname = ast_utils_which("asterisk", asteriskpath, sizeof(asteriskpath)))) {
+				/* This will fail to find symbols */
+				ast_log(LOG_DEBUG, "Failed to find asterisk binary for debug symbols.\n");
+				dli.dli_fname = "asterisk";
+			}
+		}
+
+		lastslash = strrchr(dli.dli_fname, '/');
+		if (	(bfdobj = bfd_openr(dli.dli_fname, NULL)) &&
+				bfd_check_format(bfdobj, bfd_object) &&
+				(allocsize = bfd_get_symtab_upper_bound(bfdobj)) > 0 &&
+				(syms = ast_malloc(allocsize)) &&
+				(symbolcount = bfd_canonicalize_symtab(bfdobj, syms))) {
+
+			if (bfdobj->flags & DYNAMIC) {
+				offset = addresses[stackfr] - dli.dli_fbase;
+			} else {
+				offset = addresses[stackfr] - (void *) 0;
+			}
+
+			for (section = bfdobj->sections; section; section = section->next) {
+				if (	!bfd_get_section_flags(bfdobj, section) & SEC_ALLOC ||
+						section->vma > offset ||
+						section->size + section->vma < offset) {
+					continue;
+				}
+
+				if (!bfd_find_nearest_line(bfdobj, section, syms, offset - section->vma, &file, &func, &line)) {
+					continue;
+				}
+
+				/* Stack trace output */
+				found++;
+				if ((lastslash = strrchr(file, '/'))) {
+					const char *prevslash;
+					for (prevslash = lastslash - 1; *prevslash != '/' && prevslash >= file; prevslash--);
+					if (prevslash >= file) {
+						lastslash = prevslash;
+					}
+				}
+				if (dli.dli_saddr == NULL) {
+					address_str[0] = '\0';
+				} else {
+					snprintf(address_str, sizeof(address_str), " (%p+%lX)",
+						dli.dli_saddr,
+						(unsigned long) (addresses[stackfr] - dli.dli_saddr));
+				}
+				snprintf(msg, sizeof(msg), "%s:%u %s()%s",
+					lastslash ? lastslash + 1 : file, line,
+					S_OR(func, "???"),
+					address_str);
+
+				break; /* out of section iteration */
+			}
+		}
+		if (bfdobj) {
+			bfd_close(bfdobj);
+			if (syms) {
+				ast_free(syms);
+			}
+		}
+
+		/* Default output, if we cannot find the information within BFD */
+		if (!found) {
+			if (dli.dli_saddr == NULL) {
+				address_str[0] = '\0';
+			} else {
+				snprintf(address_str, sizeof(address_str), " (%p+%lX)",
+					dli.dli_saddr,
+					(unsigned long) (addresses[stackfr] - dli.dli_saddr));
+			}
+			snprintf(msg, sizeof(msg), "%s %s()%s",
+				lastslash ? lastslash + 1 : dli.dli_fname,
+				S_OR(dli.dli_sname, "<unknown>"),
+				address_str);
+		}
+
+		if (!ast_strlen_zero(msg)) {
+			char **tmp;
+			eachlen[stackfr] = strlen(msg);
+			if (!(tmp = ast_realloc(strings, strings_size + eachlen[stackfr] + 1))) {
+				ast_free(strings);
+				strings = NULL;
+				break; /* out of stack frame iteration */
+			}
+			strings = tmp;
+			strings[stackfr] = (char *) strings + strings_size;
+			ast_copy_string(strings[stackfr], msg, eachlen[stackfr] + 1);
+			strings_size += eachlen[stackfr] + 1;
+		}
+	}
+
+	if (strings) {
+		/* Recalculate the offset pointers */
+		strings[0] = (char *) strings + num_frames * sizeof(*strings);
+		for (stackfr = 1; stackfr < num_frames; stackfr++) {
+			strings[stackfr] = strings[stackfr - 1] + eachlen[stackfr - 1] + 1;
+		}
+	}
+#else /* !defined(BETTER_BACKTRACES) */
+	strings = backtrace_symbols(addresses, num_frames);
+#endif /* defined(BETTER_BACKTRACES) */
+	return strings;
+}
+
 #endif /* HAVE_BKTR */
 
 void ast_backtrace(void)
@@ -1228,7 +1376,7 @@
 		return;
 	}
 
-	if ((strings = backtrace_symbols(bt->addresses, bt->num_frames))) {
+	if ((strings = ast_bt_get_symbols(bt->addresses, bt->num_frames))) {
 		ast_debug(1, "Got %d backtrace record%c\n", bt->num_frames, bt->num_frames != 1 ? 's' : ' ');
 		for (i = 0; i < bt->num_frames; i++) {
 			ast_log(LOG_DEBUG, "#%d: [%p] %s\n", i, bt->addresses[i], strings[i]);
@@ -1240,7 +1388,7 @@
 	ast_bt_destroy(bt);
 #else
 	ast_log(LOG_WARNING, "Must run configure with '--with-execinfo' for stack backtraces.\n");
-#endif
+#endif /* defined(HAVE_BKTR) */
 }
 
 void __ast_verbose_ap(const char *file, int line, const char *func, const char *fmt, va_list ap)

Modified: branches/1.6.2/main/say.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/main/say.c?view=diff&rev=298957&r1=298956&r2=298957
==============================================================================
--- branches/1.6.2/main/say.c (original)
+++ branches/1.6.2/main/say.c Fri Dec 17 17:30:55 2010
@@ -3493,6 +3493,8 @@
 	int res=0, offset, sndoffset;
 	char sndfile[256], nextmsg[256];
 
+	ast_backtrace();
+
 	if (format == NULL)
 		format = "ABdY 'digits/at' IMp";
 

Modified: branches/1.6.2/main/utils.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/main/utils.c?view=diff&rev=298957&r1=298956&r2=298957
==============================================================================
--- branches/1.6.2/main/utils.c (original)
+++ branches/1.6.2/main/utils.c Fri Dec 17 17:30:55 2010
@@ -28,6 +28,7 @@
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include <ctype.h>
+#include <sys/stat.h>
 #include <sys/stat.h>
 
 #ifdef HAVE_DEV_URANDOM
@@ -736,7 +737,7 @@
 		return;
 	}
 
-	if ((symbols = backtrace_symbols(bt->addresses, bt->num_frames))) {
+	if ((symbols = ast_bt_get_symbols(bt->addresses, bt->num_frames))) {
 		int frame_iterator;
 		
 		for (frame_iterator = 0; frame_iterator < bt->num_frames; ++frame_iterator) {
@@ -1826,3 +1827,22 @@
 	return res;
 }
 #endif
+
+char *ast_utils_which(const char *binary, char *fullpath, size_t fullpath_size)
+{
+	const char *envPATH = getenv("PATH");
+	char *tpath, *path;
+	struct stat unused;
+	if (!envPATH) {
+		return NULL;
+	}
+	tpath = ast_strdupa(envPATH);
+	while ((path = strsep(&tpath, ":"))) {
+		snprintf(fullpath, fullpath_size, "%s/%s", path, binary);
+		if (!stat(fullpath, &unused)) {
+			return fullpath;
+		}
+	}
+	return NULL;
+}
+

Modified: branches/1.6.2/makeopts.in
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/makeopts.in?view=diff&rev=298957&r1=298956&r2=298957
==============================================================================
--- branches/1.6.2/makeopts.in (original)
+++ branches/1.6.2/makeopts.in Fri Dec 17 17:30:55 2010
@@ -81,6 +81,9 @@
 ALSA_INCLUDE=@ALSA_INCLUDE@
 ALSA_LIB=@ALSA_LIB@
 
+BFD_INCLUDE=@BFD_INCLUDE@
+BFD_LIB=@BFD_LIB@
+
 CURL_INCLUDE=@CURL_INCLUDE@
 CURL_LIB=@CURL_LIB@
 

Modified: branches/1.6.2/utils/ael_main.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/utils/ael_main.c?view=diff&rev=298957&r1=298956&r2=298957
==============================================================================
--- branches/1.6.2/utils/ael_main.c (original)
+++ branches/1.6.2/utils/ael_main.c Fri Dec 17 17:30:55 2010
@@ -591,6 +591,17 @@
 	return 0;
 }
 
+char **ast_bt_get_symbols(void **addresses, size_t num_frames)
+{
+	char **foo = calloc(num_frames, sizeof(char *) + 1);
+	if (foo) {
+		int i;
+		for (i = 0; i < num_frames; i++) {
+			foo[i] = (char *) foo + sizeof(char *) * num_frames;
+		}
+	}
+	return foo;
+}
 #else
 void ast_remove_lock_info(void *lock_addr)
 {

Modified: branches/1.6.2/utils/check_expr.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/utils/check_expr.c?view=diff&rev=298957&r1=298956&r2=298957
==============================================================================
--- branches/1.6.2/utils/check_expr.c (original)
+++ branches/1.6.2/utils/check_expr.c Fri Dec 17 17:30:55 2010
@@ -72,6 +72,18 @@
 {
 	/* Suck it, you stupid utils directory! */
 	return 0;
+}
+char **ast_bt_get_symbols(void **addresses, size_t num_frames);
+char **ast_bt_get_symbols(void **addresses, size_t num_frames)
+{
+	char **foo = calloc(num_frames, sizeof(char *) + 1);
+	if (foo) {
+		int i;
+		for (i = 0; i < num_frames; i++) {
+			foo[i] = (char *) foo + sizeof(char *) * num_frames;
+		}
+	}
+	return foo;
 }
 #else
 void ast_store_lock_info(enum ast_lock_type type, const char *filename,

Modified: branches/1.6.2/utils/conf2ael.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/utils/conf2ael.c?view=diff&rev=298957&r1=298956&r2=298957
==============================================================================
--- branches/1.6.2/utils/conf2ael.c (original)
+++ branches/1.6.2/utils/conf2ael.c Fri Dec 17 17:30:55 2010
@@ -724,6 +724,18 @@
 	return 0;
 }
 
+char **ast_bt_get_symbols(void **addresses, size_t num_frames)
+{
+	char **foo = calloc(num_frames, sizeof(char *) + 1);
+	if (foo) {
+		int i;
+		for (i = 0; i < num_frames; i++) {
+			foo[i] = (char *) foo + sizeof(char *) * num_frames;
+		}
+	}
+	return foo;
+}
+
 #else
 void ast_remove_lock_info(void *lock_addr)
 {

Modified: branches/1.6.2/utils/hashtest.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/utils/hashtest.c?view=diff&rev=298957&r1=298956&r2=298957
==============================================================================
--- branches/1.6.2/utils/hashtest.c (original)
+++ branches/1.6.2/utils/hashtest.c Fri Dec 17 17:30:55 2010
@@ -385,6 +385,19 @@
 	return 0;
 }
 
+char **ast_bt_get_symbols(void **addresses, size_t num_frames);
+char **ast_bt_get_symbols(void **addresses, size_t num_frames)
+{
+	char **foo = calloc(num_frames, sizeof(char *) + 1);
+	if (foo) {
+		int i;
+		for (i = 0; i < num_frames; i++) {
+			foo[i] = (char *) foo + sizeof(char *) * num_frames;
+		}
+	}
+	return foo;
+}
+
 void *ast_bt_destroy(struct ast_bt *bt);
 void *ast_bt_destroy(struct ast_bt *bt)
 {

Modified: branches/1.6.2/utils/hashtest2.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/utils/hashtest2.c?view=diff&rev=298957&r1=298956&r2=298957
==============================================================================
--- branches/1.6.2/utils/hashtest2.c (original)
+++ branches/1.6.2/utils/hashtest2.c Fri Dec 17 17:30:55 2010
@@ -395,6 +395,18 @@
 	return -1;
 }
 
+char **ast_bt_get_symbols(void **addresses, size_t num_frames)
+{
+	char **foo = calloc(num_frames, sizeof(char *) + 1);
+	if (foo) {
+		int i;
+		for (i = 0; i < num_frames; i++) {
+			foo[i] = (char *) foo + sizeof(char *) * num_frames;
+		}
+	}
+	return foo;
+}
+
 void *ast_bt_destroy(struct ast_bt *bt)
 {
 	return NULL;

Modified: branches/1.6.2/utils/refcounter.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/utils/refcounter.c?view=diff&rev=298957&r1=298956&r2=298957
==============================================================================
--- branches/1.6.2/utils/refcounter.c (original)
+++ branches/1.6.2/utils/refcounter.c Fri Dec 17 17:30:55 2010
@@ -287,6 +287,19 @@
 	return 0;
 }
 
+char **ast_bt_get_symbols(void **addresses, size_t num_frames);
+char **ast_bt_get_symbols(void **addresses, size_t num_frames)
+{
+	char **foo = calloc(num_frames, sizeof(char *) + 1);
+	if (foo) {
+		int i;
+		for (i = 0; i < num_frames; i++) {
+			foo[i] = (char *) foo + sizeof(char *) * num_frames;
+		}
+	}
+	return foo;
+}
+
 void *ast_bt_destroy(struct ast_bt *bt);
 void *ast_bt_destroy(struct ast_bt *bt)
 {




More information about the svn-commits mailing list