Skip to content

Commit

Permalink
Remove the execinfo capability
Browse files Browse the repository at this point in the history
re: Issue #2766

This attempt to programmatically dump stack never worked,
so it is time to kill it off.
  • Loading branch information
DennisHeimbigner committed Nov 5, 2023
1 parent 100dca4 commit adea80f
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 66 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
3 changes: 0 additions & 3 deletions config.h.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 0 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
32 changes: 0 additions & 32 deletions libdispatch/nclog.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
#include <unistd.h>
#endif

#ifdef HAVE_EXECINFO_H
#include <execinfo.h>
#endif

#include "netcdf.h"
#include "nclog.h"

Expand Down Expand Up @@ -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);
Expand All @@ -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

/**@}*/
28 changes: 0 additions & 28 deletions libhdf5/hdf5debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit adea80f

Please sign in to comment.