My Project
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 11 of file dError.cc.

Function Documentation

◆ dErrorBreak()

void dErrorBreak ( )

Definition at line 139 of file dError.cc.

140{}

◆ dReportError()

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

Definition at line 43 of file dError.cc.

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");
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
129 return 0;
130}
int i
Definition: cfEzgcd.cc:132
static void malloc_free(void *ptr)
Definition: dError.cc:22
void dErrorBreak()
Definition: dError.cc:139
const CanonicalForm int s
Definition: facAbsFact.cc:51
Definition: ap.h:40
#define NULL
Definition: omList.c:12
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
int * status
Definition: si_signals.h:51
#define omPrintCurrentBackTraceMax(A, B)
Definition: xalloc.h:265

◆ malloc_free()

static void malloc_free ( void *  ptr)
inlinestatic

Definition at line 22 of file dError.cc.

23{
24 free(ptr);
25}
#define free
Definition: omAllocFunc.c:14