My Project
Loading...
Searching...
No Matches
Macros | Functions
dError.cc File Reference
#include "misc/auxiliary.h"
#include "misc/distrib.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,...)
 

Macro Definition Documentation

◆ DERROR_C

#define DERROR_C

Definition at line 11 of file dError.cc.

Function Documentation

◆ dReportError()

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

Definition at line 44 of file dError.cc.

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

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