summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorArnaud Versini <arnaud.versini@gmail.com>2011-11-18 19:57:16 +0100
committerMichael Meeks <michael.meeks@suse.com>2011-11-21 17:10:08 +0000
commit513c888595db021c8eaed77a2438301b1c306885 (patch)
treef3915e8e0088b7b57e761dfeb803b71869326b66 /sal
parentaf19d9f563667376f759b4526bc1bcb056947394 (diff)
Remove internal backtrace and backtrace_symbols_fd
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/backtrace.c81
-rw-r--r--sal/osl/unx/backtrace.h23
2 files changed, 2 insertions, 102 deletions
diff --git a/sal/osl/unx/backtrace.c b/sal/osl/unx/backtrace.c
index d5e4e94afaa4..01ff18f3713b 100644
--- a/sal/osl/unx/backtrace.c
+++ b/sal/osl/unx/backtrace.c
@@ -211,87 +211,6 @@ void backtrace_symbols_fd( void **buffer, int size, int fd )
#define _GNU_SOURCE
#endif
-#include <dlfcn.h>
-#include <pthread.h>
-#include <setjmp.h>
-#include <stdio.h>
-#include "backtrace.h"
-
-#if defined(SPARC)
-
-#define FRAME_PTR_OFFSET 1
-#define FRAME_OFFSET 0
-
-#else
-
-#error Unknown Linux target platform.
-
-#endif /* defined SPARC or INTEL */
-
-typedef int ptrdiff_t;
-
-int backtrace( void **buffer, int max_frames )
-{
- struct frame *fp;
- jmp_buf ctx;
- int i;
-
- /* flush register windows */
-#ifdef SPARC
- asm("ta 3");
-#endif
- /* get stack- and framepointer */
- setjmp(ctx);
- fp = (struct frame*)(((size_t*)(ctx))[FRAME_PTR_OFFSET]);
- for ( i=0; (i<FRAME_OFFSET) && (fp!=0); i++)
- fp = fp->fr_savfp;
-
- /* iterate through backtrace */
- for (i=0; fp && fp->fr_savpc && i<max_frames; i++)
- {
- /* store frame */
- *(buffer++) = (void *)fp->fr_savpc;
- /* next frame */
- fp=fp->fr_savfp;
- }
- return i;
-}
-
-void backtrace_symbols_fd( void **buffer, int size, int fd )
-{
- FILE *fp = fdopen( fd, "w" );
-
- if ( fp )
- {
- void **pFramePtr;
-
- for ( pFramePtr = buffer; size > 0 && pFramePtr && *pFramePtr; pFramePtr++, size-- )
- {
- Dl_info dli;
-
- if ( 0 != dladdr( *pFramePtr, &dli ) )
- {
- ptrdiff_t offset;
-
- if ( dli.dli_fname && dli.dli_fbase )
- {
- offset = (ptrdiff_t)*pFramePtr - (ptrdiff_t)dli.dli_fbase;
- fprintf( fp, "%s+0x%x", dli.dli_fname, offset );
- }
- if ( dli.dli_sname && dli.dli_saddr )
- {
- offset = (ptrdiff_t)*pFramePtr - (ptrdiff_t)dli.dli_saddr;
- fprintf( fp, "(%s+0x%x)", dli.dli_sname, offset );
- }
- }
- fprintf( fp, "[0x%x]\n", *pFramePtr );
- }
-
- fflush( fp );
- fclose( fp );
- }
-}
-
#endif /* defined LINUX */
#if defined( MACOSX )
diff --git a/sal/osl/unx/backtrace.h b/sal/osl/unx/backtrace.h
index 79fb58025e2e..61d63ec94d4a 100644
--- a/sal/osl/unx/backtrace.h
+++ b/sal/osl/unx/backtrace.h
@@ -58,27 +58,8 @@ struct frame {
#endif /* defined SOLARIS || FREEBSD || NETBSD || OPENBSD */
-#if defined (LINUX) && defined (SPARC)
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* backtrace function with same behaviour as defined in GNU libc */
-
-int backtrace( void **buffer, int max_frames );
-
-void backtrace_symbols_fd( void **buffer, int size, int fd );
-
-/* no frame.h on linux sparc */
-struct frame {
- long arg0[8];
- long arg1[6];
- struct frame *fr_savfp;
- long fr_savpc;
-};
-
-#ifdef __cplusplus
-} /* extern "C" */
+#if defined (LINUX)
+#include <execinfo.h>
#endif
#endif /* defined LINUX && SPARC */