pike.git / src / error.c

version» Context lines:

pike.git/src/error.c:10:   #include "interpret.h"   #include "stralloc.h"   #include "builtin_functions.h"   #include "array.h"   #include "object.h"   #include "main.h"   #include "builtin_functions.h"   #include "backend.h"   #include "operators.h"   #include "module_support.h" + #include "threads.h"    - RCSID("$Id: error.c,v 1.32 1999/04/02 15:18:05 hubbe Exp $"); + RCSID("$Id: error.c,v 1.33 1999/04/15 19:12:49 hubbe Exp $");      #undef ATTRIBUTE   #define ATTRIBUTE(X)      JMP_BUF *recoveries=0;      #ifdef PIKE_DEBUG   void check_recovery_context(void)   {    char foo;
pike.git/src/error.c:103:      void push_error(char *description)   {    push_text(description);    f_backtrace(0);    f_aggregate(2);   }      struct svalue throw_value = { T_INT };   int throw_severity; -  +    static const char *in_error; -  +  + void low_error(char *buf) + { +  push_error(buf); +  free_svalue(& throw_value); +  throw_value = *--sp; +  throw_severity=THROW_ERROR; +  in_error=0; +  pike_throw(); /* Hope someone is catching, or we will be out of balls. */ + } +    /* FIXME: NOTE: This function uses a static buffer.    * Check sizes of arguments passed!    */   void va_error(const char *fmt, va_list args) ATTRIBUTE((noreturn))   {    char buf[4096]; -  +  SWAP_IN_THREAD_IF_REQUIRED();    if(in_error)    {    const char *tmp=in_error;    in_error=0;    fatal("Recursive error() calls, original error: %s",tmp);    }       in_error=buf;      #ifdef HAVE_VSNPRINTF
pike.git/src/error.c:139:    dump_backlog();   #endif       fprintf(stderr,"No error recovery context!\n%s",buf);    exit(99);    }       if((long)strlen(buf) >= (long)sizeof(buf))    fatal("Buffer overflow in error()\n");    -  push_error(buf); -  free_svalue(& throw_value); -  throw_value = *--sp; -  throw_severity=THROW_ERROR; -  -  in_error=0; -  pike_throw(); /* Hope someone is catching, or we will be out of balls. */ +  low_error(buf);   }      void new_error(const char *name, const char *text, struct svalue *oldsp,    INT32 args, const char *file, int line) ATTRIBUTE((noreturn))   {    int i;    -  +  ASSERT_THREAD_SWAPPED_IN(); +     if(in_error)    {    const char *tmp=in_error;    in_error=0;    fatal("Recursive error() calls, original error: %s",tmp);    }       in_error=text;       if(!recoveries)
pike.git/src/error.c:313:   }      void f_error_backtrace(INT32 args)   {    pop_n_elems(args);    ref_push_array(GENERIC_ERROR_THIS->backtrace);   }      #define INIT_ERROR(FEL)\    va_list foo; \ -  struct object *o=low_clone(PIKE_CONCAT(FEL,_error_program)); \ -  va_start(foo,desc); +  struct object *o; \ +  va_start(foo,desc); \ +  ASSERT_THREAD_SWAPPED_IN(); \ +  o=low_clone(PIKE_CONCAT(FEL,_error_program));      #define ERROR_DONE(FOO) \    PIKE_CONCAT(FOO,_error_va(o,func, \    base_sp, args, \    desc,foo)); \    va_end(foo)      #define ERROR_STRUCT(STRUCT,O) \    ((struct PIKE_CONCAT(STRUCT,_error_struct) *)((O)->storage + PIKE_CONCAT(STRUCT,_error_offset)))