diff options
author | barts <none@none> | 2007-04-06 16:29:03 -0700 |
---|---|---|
committer | barts <none@none> | 2007-04-06 16:29:03 -0700 |
commit | f151e4bf7906a0c28313c7fae16eef109aa68fc0 (patch) | |
tree | a1aaa1554393fb0aea83342f3ef91944a7f6f1d0 /usr/src/head | |
parent | 0b8c11026a2c395e3192b02059a38c6ab233317f (diff) | |
download | illumos-gate-f151e4bf7906a0c28313c7fae16eef109aa68fc0.tar.gz |
PSARC/2007/162 Backtrace() and friends for Solaris
6536146 libc should provide glibc-compatible backtrace() functions
Diffstat (limited to 'usr/src/head')
-rw-r--r-- | usr/src/head/Makefile | 1 | ||||
-rw-r--r-- | usr/src/head/execinfo.h | 54 | ||||
-rw-r--r-- | usr/src/head/ucontext.h | 12 |
3 files changed, 61 insertions, 6 deletions
diff --git a/usr/src/head/Makefile b/usr/src/head/Makefile index 800dbc1174..9540f88181 100644 --- a/usr/src/head/Makefile +++ b/usr/src/head/Makefile @@ -65,6 +65,7 @@ HDRS= $($(MACH)_HDRS) $(ATTRDB_HDRS) \ euc.h \ exacct.h \ exacct_impl.h \ + execinfo.h \ fatal.h \ fcntl.h \ float.h \ diff --git a/usr/src/head/execinfo.h b/usr/src/head/execinfo.h new file mode 100644 index 0000000000..10aa4cb346 --- /dev/null +++ b/usr/src/head/execinfo.h @@ -0,0 +1,54 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _EXECINFO_H +#define _EXECINFO_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * These functions provide glibc-compatible backtrace functionality. + * Improved functionality is available using Solaris-specific APIs; + * see man page for walkcontext(), printstack() and addtosymstr(). + */ +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) +extern int backtrace(void **, int); +extern char **backtrace_symbols(void *const *, int); +extern void backtrace_symbols_fd(void *const *, int, int); +#else +extern int backtrace(); +extern char **backtrace_symbols(); +extern void backtrace_symbols_fd(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _EXECINFO_H */ diff --git a/usr/src/head/ucontext.h b/usr/src/head/ucontext.h index 8fc6fd52bd..15aaeff91e 100644 --- a/usr/src/head/ucontext.h +++ b/usr/src/head/ucontext.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -24,7 +23,7 @@ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -37,6 +36,7 @@ #if !defined(_XPG4_2) || defined(__EXTENSIONS__) #include <sys/siginfo.h> +#include <execinfo.h> #endif #ifdef __cplusplus @@ -63,7 +63,7 @@ extern void makecontext(ucontext_t *, void(*)(), int, ...); extern int walkcontext(const ucontext_t *, int (*)(uintptr_t, int, void *), void *); extern int printstack(int); - +extern int addrtosymstr(void *, char *, int); extern int getustack(stack_t **); extern int setustack(stack_t *); @@ -84,7 +84,7 @@ extern void makecontext(); #if !defined(_XPG4_2) || defined(__EXTENSIONS__) extern int walkcontext(); extern int printstack(); - +extern int addrtosymstr(); extern int getustack(); extern int setustack(); |