- consistent naming: 'StackTrace' everywhere.

This commit is contained in:
Till Straumann
2014-08-28 10:47:59 -07:00
parent 4459ca0ad8
commit 8b2b03482f
9 changed files with 80 additions and 43 deletions

View File

@@ -56,7 +56,7 @@ INC += epicsStdio.h
INC += epicsStdioRedirect.h
INC += epicsTempFile.h
INC += epicsGetopt.h
INC += epicsStacktrace.h
INC += epicsStackTrace.h
INC += devLib.h
INC += devLibVME.h
@@ -142,10 +142,10 @@ Com_SRCS_WIN32 += setThreadName.cpp
#Com_SRCS_WIN32 += dllmain.cpp
Com_SRCS_WIN32 += forceBadAllocException.cpp
#Stacktrace support
Com_SRCS += osdStacktrace.c
Com_SRCS_Linux += execinfoStacktrace.c
Com_SRCS_Darwin += execinfoStacktrace.c
#we could use execinfoStacktrace.c on freebsd, too, but AFAIK
#Stack trace support
Com_SRCS += osdStackTrace.c
Com_SRCS_Linux += execinfoStackTrace.c
Com_SRCS_Darwin += execinfoStackTrace.c
#we could use execinfoStackTrace.c on freebsd, too, but AFAIK
#you need libexecinfo.a and execinfo.h. I don't know if that
#is routinely available so we don't use it for now.

View File

@@ -16,4 +16,4 @@ osdSock$(DEP): $(COMMON_DIR)/epicsVersion.h
execinfoConfig.h:
touch $@
execinfoStacktrace$(OBJ): execinfoConfig.h
execinfoStackTrace$(OBJ): execinfoConfig.h

View File

@@ -0,0 +1,40 @@
/*
* Copyright: Stanford University / SLAC National Laboratory.
*
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*
* Author: Till Straumann <strauman@slac.stanford.edu>, 2011, 2014
*/
#ifndef INC_epicsStackTrace_H
#define INC_epicsStackTrace_H
#include "shareLib.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Dump a stack trace to the errlog */
epicsShareFunc void epicsStackTrace(void);
/* Inquire about functionality implemented on your system */
/* StackTrace is able to lookup local symbols */
#define EPICS_STACKTRACE_LCL_SYMBOLS (1<<0)
/* StackTrace is able to lookup global symbols */
#define EPICS_STACKTRACE_GBL_SYMBOLS (1<<1)
/* StackTrace provides numerical addresses */
#define EPICS_STACKTRACE_ADDRESSES (1<<2)
/* returns ORed bitset of supported features */
epicsShareFunc int epicsStackTraceGetFeatures(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,26 +0,0 @@
/*
* Copyright: Stanford University / SLAC National Laboratory.
*
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*
* Author: Till Straumann <strauman@slac.stanford.edu>, 2011
*/
#ifndef INC_epicsStacktrace_H
#define INC_epicsStacktrace_H
#include "shareLib.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Dump a stacktrace to the errlog */
epicsShareFunc void epicsStackTrace(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -4,10 +4,10 @@
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*
* Author: Till Straumann <strauman@slac.stanford.edu>, 2011
* Author: Till Straumann <strauman@slac.stanford.edu>, 2011, 2014
*/
#include "epicsStacktrace.h"
#include "epicsStackTrace.h"
#include "epicsThread.h"
#include "epicsMutex.h"
#include <execinfo.h>
@@ -560,7 +560,7 @@ uint8_t c;
}
#endif
epicsShareFunc void epicsStacktrace(void)
epicsShareFunc void epicsStackTrace(void)
{
void **buf;
#ifndef USE_ELF
@@ -569,7 +569,7 @@ char **bts;
int i,n;
if ( ! (buf = malloc(sizeof(*buf) * MAXDEPTH)) ) {
errlogPrintf("epicsStacktrace(): not enough memory for backtrace\n");
errlogPrintf("epicsStackTrace(): not enough memory for backtrace\n");
return;
}
@@ -602,3 +602,20 @@ int i,n;
free(buf);
}
epicsShareFunc int epicsStackTraceGetFeatures(void)
{
#ifdef USE_ELF
return EPICS_STACKTRACE_LCL_SYMBOLS
| EPICS_STACKTRACE_GBL_SYMBOLS
| EPICS_STACKTRACE_ADDRESSES;
#elif defined(__linux__) || defined(linux)
return EPICS_STACKTRACE_GBL_SYMBOLS
EPICS_STACKTRACE_ADDRESSES;
#else
return EPICS_STACKTRACE_LCL_SYMBOLS
| EPICS_STACKTRACE_GBL_SYMBOLS
| EPICS_STACKTRACE_ADDRESSES;
#endif
}

View File

@@ -11,7 +11,7 @@
*
* The presence of this file prevents the build
* system from using the no-op implementation of
* epicsStacktrace() in default/osdStacktrace.c.
* epicsStackTrace() in default/osdStackTrace.c.
*
* This OS uses a generic implementation which
* may be used by various OSes. The source file

View File

@@ -11,7 +11,7 @@
*
* The presence of this file prevents the build
* system from using the no-op implementation of
* epicsStacktrace() in default/osdStacktrace.c.
* epicsStackTrace() in default/osdStackTrace.c.
*
* This OS uses a generic implementation which
* may be used by various OSes. The source file

View File

@@ -20,7 +20,7 @@
#include "epicsThread.h"
#include "epicsTime.h"
#include "cantProceed.h"
#include "epicsStacktrace.h"
#include "epicsStackTrace.h"
void epicsAssert (const char *pFile, const unsigned line,
@@ -35,7 +35,7 @@ void epicsAssert (const char *pFile, const unsigned line,
errlogPrintf("\n"
"I'll try to dump a stack trace:\n");
epicsStacktrace();
epicsStackTrace();
errlogPrintf("\n");
errlogPrintf("EPICS Release %s.\n", epicsReleaseVersion);

View File

@@ -7,8 +7,14 @@
* Author: Till Straumann <strauman@slac.stanford.edu>, 2011
*/
#include "epicsStacktrace.h"
#include "epicsStackTrace.h"
epicsShareFunc void epicsStacktrace(void)
epicsShareFunc void epicsStackTrace(void)
{
}
epicsShareFunc int epicsStackTraceGetFeatures(void)
{
return 0;
}