mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 14:58:25 +00:00
Merged revisions 298960 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r298960 | tilghman | 2010-12-17 17:52:04 -0600 (Fri, 17 Dec 2010) | 20 lines Merged revisions 298957 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ................ r298957 | tilghman | 2010-12-17 17:30:55 -0600 (Fri, 17 Dec 2010) | 13 lines 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. Review: https://reviewboard.asterisk.org/r/1055/ ........ ................ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@298961 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
22
main/utils.c
22
main/utils.c
@@ -29,6 +29,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
|
||||
#include <ctype.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_DEV_URANDOM
|
||||
#include <fcntl.h>
|
||||
@@ -746,7 +747,7 @@ static void append_backtrace_information(struct ast_str **str, struct ast_bt *bt
|
||||
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) {
|
||||
@@ -2106,3 +2107,22 @@ int ast_get_tid(void)
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user