My Project  debian-1:4.1.2-p1+ds-2
Macros | Functions
dError.cc File Reference
#include "misc/auxiliary.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 137 of file dError.cc.

140 {}

◆ dReportError()

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

Definition at line 41 of file dError.cc.

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

◆ malloc_free()

static void malloc_free ( void *  ptr)
inlinestatic

Definition at line 20 of file dError.cc.

23 {
dErrorBreak
void dErrorBreak()
Definition: dError.cc:137
status
int * status
Definition: si_signals.h:50
omPrintCurrentBackTraceMax
#define omPrintCurrentBackTraceMax(A, B)
Definition: xalloc.h:307
ap
Definition: ap.h:35
i
int i
Definition: cfEzgcd.cc:125
dReportError
int dReportError(const char *fmt,...)
Definition: dError.cc:41
malloc_free
static void malloc_free(void *ptr)
Definition: dError.cc:20
NULL
#define NULL
Definition: omList.c:11
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