Import BSDDB 4.7.25 (as of svn r89086)

This commit is contained in:
Zachary Ware
2017-09-04 13:40:25 -05:00
parent 4b29e0458f
commit 8f590873d0
4781 changed files with 2241032 additions and 6 deletions

45
os/os_stack.c Normal file
View File

@@ -0,0 +1,45 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 2001,2008 Oracle. All rights reserved.
*
* $Id: os_stack.c 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#include "db_config.h"
#include "db_int.h"
#if defined(HAVE_SYSTEM_INCLUDE_FILES) && defined(HAVE_BACKTRACE) && \
defined(HAVE_BACKTRACE_SYMBOLS) && defined(HAVE_EXECINFO_H)
#include <execinfo.h>
#endif
/*
* __os_stack --
* Output a stack trace to the message file handle.
*
* PUBLIC: void __os_stack __P((ENV *));
*/
void
__os_stack(env)
ENV *env;
{
#if defined(HAVE_BACKTRACE) && defined(HAVE_BACKTRACE_SYMBOLS)
void *array[200];
size_t i, size;
char **strings;
/*
* Solaris and the GNU C library support this interface. Solaris
* has additional interfaces (printstack and walkcontext), I don't
* know if they offer any additional value or not.
*/
size = backtrace(array, sizeof(array) / sizeof(array[0]));
strings = backtrace_symbols(array, size);
for (i = 0; i < size; ++i)
__db_errx(env, "%s", strings[i]);
free(strings);
#endif
COMPQUIET(env, NULL);
}