Remove the execinfo capability

re: Issue https://github.com/Unidata/netcdf-c/issues/2766

This attempt to programmatically dump stack never worked,
so it is time to kill it off.
This commit is contained in:
Dennis Heimbigner 2023-11-04 21:32:33 -06:00
parent 100dca4854
commit adea80f376
5 changed files with 1 additions and 66 deletions

View File

@ -7,6 +7,7 @@ This file contains a high-level description of this package's evolution. Release
## 4.9.3 - TBD
* Remove the use of execinfo to programmatically dump the stack; it never worked. See [Github #????](https://github.com/Unidata/netcdf-c/pull/????).
* Fix DAP2 proxy problems. See [Github #2764](https://github.com/Unidata/netcdf-c/pull/2764).
* Cleanup a number of misc issues. See [Github #2763](https://github.com/Unidata/netcdf-c/pull/2763).
* Mitigate the problem of test interference. See [Github #2755](https://github.com/Unidata/netcdf-c/pull/2755).

View File

@ -462,9 +462,6 @@ with zip */
/* if true, HDF5 is at least version 1.10.5 and supports UTF8 paths */
#cmakedefine HDF5_UTF8_PATHS 1
/* if true, backtrace support will be used. */
#cmakedefine HAVE_EXECINFO_H 1
/* if true, include JNA bug fix */
#cmakedefine JNA 1

View File

@ -1305,9 +1305,6 @@ AC_CHECK_HEADERS([sys/resource.h])
# See if we have ftw.h to walk directory trees
AC_CHECK_HEADERS([ftw.h])
# See if we can do stack tracing programmatically
AC_CHECK_HEADERS([execinfo.h])
# Check for these functions...
AC_CHECK_FUNCS([strlcat snprintf strcasecmp fileno \
strdup strtoll strtoull \

View File

@ -21,10 +21,6 @@
#include <unistd.h>
#endif
#ifdef HAVE_EXECINFO_H
#include <execinfo.h>
#endif
#include "netcdf.h"
#include "nclog.h"
@ -278,10 +274,6 @@ ncuntrace(const char* fcn, int err, const char* fmt, ...)
vfprintf(nclog_global.nclogstream, fmt, args);
fprintf(nclog_global.nclogstream, "\n" );
fflush(nclog_global.nclogstream);
#ifdef HAVE_EXECINFO_H
if(err != 0)
ncbacktrace();
#endif
}
done:
va_end(args);
@ -304,28 +296,4 @@ ncbreakpoint(int err)
return err;
}
#ifdef HAVE_EXECINFO_H
#define MAXSTACKDEPTH 100
void
ncbacktrace(void)
{
int j, nptrs;
void* buffer[MAXSTACKDEPTH];
char **strings;
if(getenv("NCBACKTRACE") == NULL) return;
nptrs = backtrace(buffer, MAXSTACKDEPTH);
strings = backtrace_symbols(buffer, nptrs);
if (strings == NULL) {
perror("backtrace_symbols");
errno = 0;
return;
}
fprintf(stderr,"Backtrace:\n");
for(j = 0; j < nptrs; j++)
fprintf(stderr,"%s\n", strings[j]);
free(strings);
}
#endif
/**@}*/

View File

@ -14,37 +14,9 @@
#ifdef H5CATCH
#define STSIZE 1000
#ifdef HAVE_EXECINFO_H
#ifdef H5BACKTRACE
# if !defined _WIN32 && !defined __CYGWIN__
static void* stacktrace[STSIZE];
# endif
#endif
#endif
int
nch5breakpoint(int err)
{
#ifdef HAVE_EXECINFO_H
#ifdef H5BACKTRACE
# if !defined _WIN32 && !defined __CYGWIN__
int count = 0;
char** trace = NULL;
int i;
count = backtrace(stacktrace,STSIZE);
trace = backtrace_symbols(stacktrace, STSIZE);
fprintf(stderr,"backtrace:\n");
for(i=0;i<count;i++)
fprintf(stderr,"[%03d] %s\n",i,trace[i]);
# if 0
if(trace != NULL) free(trace);
# endif
# endif
#endif
#endif
return ncbreakpoint(err);
}