diagnose.c (647f063d) | diagnose.c (5258b990) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 12 unchanged lines hidden (view full) --- 21 22 23 24#include "osl/diagnose.h" 25#include "system.h" 26 27#ifndef HAVE_DLFCN_H 28 | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 12 unchanged lines hidden (view full) --- 21 22 23 24#include "osl/diagnose.h" 25#include "system.h" 26 27#ifndef HAVE_DLFCN_H 28 |
29#if defined(LINUX) || defined(SOLARIS) | 29#if defined(LINUX) || defined(SOLARIS) || defined(FREEBSD) |
30#define HAVE_DLFCN_H | 30#define HAVE_DLFCN_H |
31#endif /* LINUX || SOLARIS */ | 31#endif /* LINUX || SOLARIS || FREEBSD */ |
32 33#endif /* HAVE_DLFCN_H */ 34 35 36#ifdef HAVE_DLFCN_H 37 38#ifndef INCLUDED_DLFCN_H 39#include <dlfcn.h> --- 28 unchanged lines hidden (view full) --- 68static oslDetailedDebugMessageFunc volatile g_pDetailedDebugMessageFunc = 0; 69 70static void osl_diagnose_backtrace_Impl ( 71 oslDebugMessageFunc f); 72 73#define OSL_DIAGNOSE_OUTPUTMESSAGE(f, s) \ 74((f != 0) ? (*(f))((s)) : (void)fprintf(stderr, "%s", (s))) 75 | 32 33#endif /* HAVE_DLFCN_H */ 34 35 36#ifdef HAVE_DLFCN_H 37 38#ifndef INCLUDED_DLFCN_H 39#include <dlfcn.h> --- 28 unchanged lines hidden (view full) --- 68static oslDetailedDebugMessageFunc volatile g_pDetailedDebugMessageFunc = 0; 69 70static void osl_diagnose_backtrace_Impl ( 71 oslDebugMessageFunc f); 72 73#define OSL_DIAGNOSE_OUTPUTMESSAGE(f, s) \ 74((f != 0) ? (*(f))((s)) : (void)fprintf(stderr, "%s", (s))) 75 |
76#if defined (LINUX) || defined (SOLARIS) | 76#if defined (LINUX) || defined (SOLARIS) || defined(FREEBSD) |
77/************************************************************************/ 78/* osl_diagnose_frame_Impl */ 79/************************************************************************/ 80static void osl_diagnose_frame_Impl ( 81 oslDebugMessageFunc f, 82 int depth, 83 void * pc) 84{ --- 104 unchanged lines hidden (view full) --- 189 for (i = 0; (fp != 0) && (fp->fr_savpc != 0); i++) 190 { 191 struct frame * prev = (struct frame*)((char*)(fp->fr_savfp) + STACK_BIAS); 192 osl_diagnose_frame_Impl (f, i, (void*)(fp->fr_savpc)); 193 fp = (prev > fp) ? prev : 0; 194 } 195} 196 | 77/************************************************************************/ 78/* osl_diagnose_frame_Impl */ 79/************************************************************************/ 80static void osl_diagnose_frame_Impl ( 81 oslDebugMessageFunc f, 82 int depth, 83 void * pc) 84{ --- 104 unchanged lines hidden (view full) --- 189 for (i = 0; (fp != 0) && (fp->fr_savpc != 0); i++) 190 { 191 struct frame * prev = (struct frame*)((char*)(fp->fr_savfp) + STACK_BIAS); 192 osl_diagnose_frame_Impl (f, i, (void*)(fp->fr_savpc)); 193 fp = (prev > fp) ? prev : 0; 194 } 195} 196 |
197#else /* (LINUX || SOLARIS) */ | 197#elif defined(FREEBSD) |
198 | 198 |
199#include <setjmp.h> 200#include "backtrace.h" /* for struct frame */ 201 202#if defined(X86) || defined(X86_64) 203 204#define FRAME_PTR_OFFSET 3 205#define FRAME_OFFSET 0 206 207#endif /* (X86 || X86_64) */ 208 |
|
199static void osl_diagnose_backtrace_Impl (oslDebugMessageFunc f) 200{ | 209static void osl_diagnose_backtrace_Impl (oslDebugMessageFunc f) 210{ |
211 struct frame * fp; 212 jmp_buf ctx; 213 int i; 214 215 setjmp (ctx); 216 fp = (struct frame*)(((long*)(ctx))[FRAME_PTR_OFFSET]); 217 218 for (i = 0; (i < FRAME_OFFSET) && (fp != 0); i++) 219 fp = fp->fr_savfp; 220 221 for (i = 0; (fp != 0) && (fp->fr_savpc != 0); i++) 222 { 223 struct frame * prev = fp->fr_savfp; 224 osl_diagnose_frame_Impl (f, i, (void*)(fp->fr_savpc)); 225 fp = (prev > fp) ? prev : 0; 226 } 227} 228 229#else /* (LINUX || SOLARIS || FREEBSD) */ 230 231static void osl_diagnose_backtrace_Impl (oslDebugMessageFunc f) 232{ |
|
201 /* not yet implemented */ 202} 203 | 233 /* not yet implemented */ 234} 235 |
204#endif /* (LINUX || SOLARIS) */ | 236#endif /* (LINUX || SOLARIS || FREEBSD) */ |
205 206/************************************************************************/ 207/* osl_assertFailedLine */ 208/************************************************************************/ 209sal_Bool SAL_CALL osl_assertFailedLine ( 210 const sal_Char* pszFileName, 211 sal_Int32 nLine, 212 const sal_Char* pszMessage) --- 100 unchanged lines hidden --- | 237 238/************************************************************************/ 239/* osl_assertFailedLine */ 240/************************************************************************/ 241sal_Bool SAL_CALL osl_assertFailedLine ( 242 const sal_Char* pszFileName, 243 sal_Int32 nLine, 244 const sal_Char* pszMessage) --- 100 unchanged lines hidden --- |