From 8477dec61fd9b1b24f22cc486509d4bc900455bf Mon Sep 17 00:00:00 2001 From: Till Straumann Date: Mon, 8 Sep 2014 22:31:11 -0700 Subject: [PATCH] - added windows versions of osdBackTrace.c, osdFindAddr.c; the latter does not implement addr->symbol conversion yet. --- src/libCom/osi/os/WIN32/osdBackTrace.c | 24 ++++++++++++++++++++ src/libCom/osi/os/WIN32/osdFindAddr.c | 31 ++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 src/libCom/osi/os/WIN32/osdBackTrace.c create mode 100644 src/libCom/osi/os/WIN32/osdFindAddr.c diff --git a/src/libCom/osi/os/WIN32/osdBackTrace.c b/src/libCom/osi/os/WIN32/osdBackTrace.c new file mode 100644 index 000000000..4afd8a4f1 --- /dev/null +++ b/src/libCom/osi/os/WIN32/osdBackTrace.c @@ -0,0 +1,24 @@ +/* + * 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 , 2011 + */ + +#include +#include + +#define epicsExportSharedSymbols +#include "epicsStackTracePvt.h" + +int epicsBackTrace(void **buf, int buf_sz) +{ + /* Docs say that (for some windows versions) the sum of + * skipped + captured frames must be less than 63 + */ + if ( buf_sz >= 63 ) + buf_sz = 62; + return CaptureStackBackTrace(0, buf_sz, buf, 0); +} diff --git a/src/libCom/osi/os/WIN32/osdFindAddr.c b/src/libCom/osi/os/WIN32/osdFindAddr.c new file mode 100644 index 000000000..a39654188 --- /dev/null +++ b/src/libCom/osi/os/WIN32/osdFindAddr.c @@ -0,0 +1,31 @@ +/* + * 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 , 2011 + */ + +#define epicsExportSharedSymbols +#include "epicsStackTracePvt.h" +#include "epicsStackTrace.h" + +int epicsFindAddr(void *addr, epicsSymbol *sym_p) +{ + return -1; +} + +int epicsStackTraceGetFeatures(void) +{ +void *test[10]; + + /* If frame-pointer optimization is on then CaptureStackBackTrace + * does not work. Make sure all EPICS is built with -Oy- + */ + if ( 0 == epicsBackTrace(test, sizeof(test)/sizeof(test[0])) ) + return 0; + + /* address->symbol conversion not implemented (yet) */ + return EPICS_STACKTRACE_ADDRESSES; +}