netcdf-c/libhdf5/hdf5debug.c
Dennis Heimbigner b0e0d81aa9 Fix reclamation of the ->format_XXX_info fields
nc4internal.c contains code to free the format_XXX_info
fields. Since these are format specific, this code
was moved to the dispatch code (libhdf5 and libhdf4
in the current case).

Additionally, there are some fields in nc4internal.h (e.g.
dimscale fields) that are specific to HDF5 and have been moved
to the corresponding HDF5 data structures and code.

Misc. other changes:
1. NC_VAR_INFO_T->hdf5_name renamed to alt_name to avoid
   implying it is necessarily HDF5 specific.
2. prefix NC_FILE_INFO_T with an instance of NC_OBJ for consistency.
   this also requires wrapping move_in_NCList() to keep
   hdr.id consistent.
2020-03-29 12:48:59 -06:00

50 lines
1.0 KiB
C

/*********************************************************************
* Copyright 2018, UCAR/Unidata
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
*********************************************************************/
#include "config.h"
#include <stdarg.h>
#include <stdio.h>
#if !defined _WIN32 && !defined __CYGWIN__
#include <execinfo.h>
#endif
#include "hdf5debug.h"
#ifdef H5CATCH
#define STSIZE 1000
#if !defined _WIN32 && !defined __CYGWIN__
static void* stacktrace[STSIZE];
#endif
int
nch5breakpoint(int err)
{
#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
return err;
}
int
nch5throw(int err)
{
if(err == 0) return err;
return nch5breakpoint(err);
}
#endif