diff options
Diffstat (limited to 'editors/openoffice.org-1.1/files/patch-backtrace')
-rw-r--r-- | editors/openoffice.org-1.1/files/patch-backtrace | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/editors/openoffice.org-1.1/files/patch-backtrace b/editors/openoffice.org-1.1/files/patch-backtrace new file mode 100644 index 0000000..41daab7 --- /dev/null +++ b/editors/openoffice.org-1.1/files/patch-backtrace @@ -0,0 +1,96 @@ +Issuetracker : #iXXXXX# +CWS : N/A +Author : <maho@openoffice.org> (JCA) +Description : FreeBSD porting : An implementation of backtrace at sal/osl/unx +To pass the compilation, we preparing dummy function at sal. +We implemented this. + +--- sal/osl/unx/backtrace.c Tue Jul 6 19:35:44 2004 ++++ sal/osl/unx/backtrace.c Sun Oct 23 12:07:07 2005 +@@ -155,6 +155,7 @@ + #include <pthread.h> + #include <setjmp.h> + #include <stdio.h> ++#include <stddef.h> + #include "backtrace.h" + + #define FRAME_PTR_OFFSET 1 +@@ -162,11 +163,55 @@ + + int backtrace( void **buffer, int max_frames ) + { +- return 1; ++ struct frame *fp; ++ jmp_buf ctx; ++ int i; ++ /* 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; ++ ptrdiff_t offset; ++ ++ if ( 0 != dladdr( *pFramePtr, &dli ) ) ++ { ++ 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 FREEBSD */ +Only in sal/osl/unx: backtrace.c.orig +diff -ur ../../src/OOo_1.1.5/sal/osl/unx/backtrace.h sal/osl/unx/backtrace.h +--- sal/osl/unx/backtrace.h Tue Jul 6 19:36:01 2004 ++++ sal/osl/unx/backtrace.h Sun Oct 23 12:07:07 2005 +@@ -72,6 +72,16 @@ + + void backtrace_symbols_fd( void **buffer, int size, int fd ); + ++/* no frame.h on FreeBSD */ ++#if defined FREEBSD ++struct frame { ++ long arg0[8]; ++ long arg1[6]; ++ struct frame *fr_savfp; ++ long fr_savpc; ++}; ++#endif ++ + #ifdef __cplusplus + } /* extern "C" */ + #endif +Only in sal/osl/unx: backtrace.h.orig |