My Project  debian-1:4.1.1-p2+ds-4build1
Macros | Functions
dError.cc File Reference
#include "misc/auxiliary.h"
#include "omalloc/omalloc.h"
#include "reporter/reporter.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>

Go to the source code of this file.

Macros

#define DERROR_C
 

Functions

static void malloc_free (void *ptr)
 
int dReportError (const char *fmt,...)
 
void dErrorBreak ()
 

Macro Definition Documentation

◆ DERROR_C

#define DERROR_C

Definition at line 9 of file dError.cc.

Function Documentation

◆ dErrorBreak()

void dErrorBreak ( )

Definition at line 139 of file dError.cc.

142 {}

◆ dReportError()

int dReportError ( const char *  fmt,
  ... 
)

Definition at line 43 of file dError.cc.

43 {
44 
45 int dReportError(const char* fmt, ...)
46 {
47 #if 0
48 #ifdef HAVE_EXECINFO_H
49 #define SIZE 50
50  void *buffer[SIZE+1]; int ret;
51 #endif
52 #endif
53 
54  va_list ap;
55  va_start(ap, fmt);
56 #ifndef MAKE_DISTRIBUTION
57  fprintf(stderr, "\n// ***dError: ");
58  vfprintf(stderr, fmt, ap);
59 #if !defined(OM_NDEBUG)
60  #ifdef omPrintCurrentBackTraceMax
61  fprintf(stderr, " occurred at: \n");
62  omPrintCurrentBackTraceMax(stderr, 8);
63  #endif
64 #endif
65 
66 #if 0
67 #ifdef HAVE_EXECINFO_H
68  ret = backtrace( buffer, SIZE ); // execinfo.h
69  fprintf(stderr, "\nExecinfo backtrace (with %zd stack frames): \n", ret);
70 
71 #ifndef HAVE_GCC_ABI_DEMANGLE
72  backtrace_symbols_fd(buffer, ret, STDERR_FILENO); // execinfo.h
73 #else
74  char **ptr = backtrace_symbols( buffer, ret ); // execinfo.h
75 
76  int status;
77  char *demangledName;
78  char *s;
79  char *ss;
80  for (int i = 0; i < ret; i++)
81  {
82  status = -1;
83 
84  s = ptr[i];
85 // fprintf (stderr, " #%02d: %s\n", i, s);
86 
87  ss = index(s, '(');
88  ss[0] = 0;
89  fprintf (stderr, " #%02d: '%s': ", i, s);
90  ss[0] = '('; s = ss + 1;
91 
92  ss = index(s, '+');
93 
94  if ( ss != NULL )
95  {
96  ss[0] = 0;
97  demangledName = abi::__cxa_demangle( s, NULL, NULL, &status ); // cxxabi.h!
98  if( status == 0 && demangledName != NULL )
99  fprintf (stderr, " '%s'", (demangledName[0] != 0)? demangledName: s);
100  else
101  fprintf (stderr, " '%s'", s);
102 
103  malloc_free( demangledName );
104  ss[0] = '+';
105  s = ss + 1;
106  }
107 
108  ss = index(s, ')');
109  if( s != ss)
110  {
111  ss[0] = 0;
112  fprintf (stderr, " + %s", s);
113  ss[0] = ')';
114  }
115 
116  fprintf (stderr, " %s\n", ss + 2);
117  }
118  malloc_free (ptr);
119 #endif
120 #endif
121 
122 #undef SIZE
123 #endif
124 
125  dErrorBreak();
126 #else
127  fprintf(stderr, "\n// !!! YOU HAVE FOUND A BUG IN SINGULAR.");
128  fprintf(stderr, "// !!! Please, email the input\n// and the following error message to singular@mathematik.uni-kl.de")
129  vfprintf(stderr, fmt, ap);
130 #endif

◆ malloc_free()

static void malloc_free ( void *  ptr)
inlinestatic

Definition at line 22 of file dError.cc.

25 {
dErrorBreak
void dErrorBreak()
Definition: dError.cc:139
status
int * status
Definition: si_signals.h:50
ap
Definition: ap.h:35
i
int i
Definition: cfEzgcd.cc:125
dReportError
int dReportError(const char *fmt,...)
Definition: dError.cc:43
malloc_free
static void malloc_free(void *ptr)
Definition: dError.cc:22
NULL
#define NULL
Definition: omList.c:9
omPrintCurrentBackTraceMax
int omPrintCurrentBackTraceMax(FILE *fd, int max)
Definition: omRet2Info.c:164
s
const CanonicalForm int s
Definition: facAbsFact.cc:55
index
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:585