pike.git / src / error.c

version» Context lines:

pike.git/src/error.c:14:   #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"   #include "gc.h"    - RCSID("$Id: error.c,v 1.55 2000/07/07 01:46:21 hubbe Exp $"); + RCSID("$Id: error.c,v 1.56 2000/07/28 17:16:54 hubbe Exp $");      #undef ATTRIBUTE   #define ATTRIBUTE(X)         #ifdef PIKE_DEBUG - void check_recovery_context(void) + PMOD_EXPORT void check_recovery_context(void)   {    char foo;   #define TESTILITEST ((((char *)Pike_interpreter.recoveries)-((char *)&foo))*STACK_DIRECTION)    if(Pike_interpreter.recoveries && TESTILITEST > 0)    fatal("Recoveries is out biking (Pike_interpreter.recoveries=%p, Pike_sp=%p, %d)!\n",Pike_interpreter.recoveries, &foo,TESTILITEST);       /* Add more stuff here when required */   }    - void pike_gdb_breakpoint(void) + PMOD_EXPORT void pike_gdb_breakpoint(void)   {   }   #endif    - JMP_BUF *init_recovery(JMP_BUF *r DEBUG_LINE_ARGS) + PMOD_EXPORT JMP_BUF *init_recovery(JMP_BUF *r DEBUG_LINE_ARGS)   {    check_recovery_context();   #ifdef PIKE_DEBUG    r->line=line;    r->file=file;    OED_FPRINTF((stderr, "init_recovery(%p) %s:%d\n", r, file, line));   #endif    r->frame_pointer=Pike_fp;    r->stack_pointer=Pike_sp-Pike_interpreter.evaluator_stack;    r->mark_sp=Pike_mark_sp - Pike_interpreter.mark_stack;    r->previous=Pike_interpreter.recoveries;    r->onerror=0;    r->severity=THROW_ERROR;    Pike_interpreter.recoveries=r;    check_recovery_context();    return r;   }    - void pike_throw(void) ATTRIBUTE((noreturn)) + PMOD_EXPORT void pike_throw(void) ATTRIBUTE((noreturn))   {    while(Pike_interpreter.recoveries && throw_severity > Pike_interpreter.recoveries->severity)    {    while(Pike_interpreter.recoveries->onerror)    {    (*Pike_interpreter.recoveries->onerror->func)(Pike_interpreter.recoveries->onerror->arg);    Pike_interpreter.recoveries->onerror=Pike_interpreter.recoveries->onerror->previous;    }       Pike_interpreter.recoveries=Pike_interpreter.recoveries->previous;
pike.git/src/error.c:97:       while(Pike_interpreter.recoveries->onerror)    {    (*Pike_interpreter.recoveries->onerror->func)(Pike_interpreter.recoveries->onerror->arg);    Pike_interpreter.recoveries->onerror=Pike_interpreter.recoveries->onerror->previous;    }       longjmp(Pike_interpreter.recoveries->recovery,1);   }    - void push_error(char *description) + PMOD_EXPORT void push_error(char *description)   {    push_text(description);    f_backtrace(0);    f_aggregate(2);   }      struct svalue throw_value = { PIKE_T_INT };   int throw_severity;   static const char *in_error;    - void low_error(char *buf) ATTRIBUTE((noreturn)) + PMOD_EXPORT void low_error(char *buf) ATTRIBUTE((noreturn))   {    push_error(buf);    free_svalue(& throw_value);    throw_value = *--Pike_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.
pike.git/src/error.c:156:    fprintf(stderr,"No error recovery context!\n%s",buf);    exit(99);    }       if((long)strlen(buf) >= (long)sizeof(buf))    fatal("Buffer overflow in error()\n");       low_error(buf);   }    - void new_error(const char *name, const char *text, struct svalue *oldsp, + PMOD_EXPORT 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;
pike.git/src/error.c:216:    f_aggregate(2);       free_svalue(& throw_value);    throw_value = *--Pike_sp;    throw_severity=THROW_ERROR;       in_error=0;    pike_throw(); /* Hope someone is catching, or we will be out of balls. */   }    - void exit_on_error(void *msg) + PMOD_EXPORT void exit_on_error(void *msg)   {    ONERROR tmp;    SET_ONERROR(tmp,fatal_on_error,"Fatal in exit_on_error!");    d_flag=0;       fprintf(stderr,"%s\n",(char *)msg);   #ifdef PIKE_DEBUG    dump_backlog();   #endif    fprintf(stderr,"%s\n",(char *)msg);
pike.git/src/error.c:241: Inside #if defined(PIKE_DEBUG)
   init_buf();    describe_svalue(&throw_value,0,0);    s=simple_free_buf();    fprintf(stderr,"%s\n",s);    free(s);    }   #endif    exit(1);   }    - void fatal_on_error(void *msg) + PMOD_EXPORT void fatal_on_error(void *msg)   {   #ifdef PIKE_DEBUG    dump_backlog();   #endif    fprintf(stderr,"%s\n",(char *)msg);    abort();   }    - void error(const char *fmt,...) ATTRIBUTE((noreturn,format (printf, 1, 2))) + PMOD_EXPORT void error(const char *fmt,...) ATTRIBUTE((noreturn,format (printf, 1, 2)))   {    va_list args;    va_start(args,fmt);    va_error(fmt,args);    va_end(args);   }    - void debug_fatal(const char *fmt, ...) ATTRIBUTE((noreturn,format (printf, 1, 2))) + PMOD_EXPORT void debug_fatal(const char *fmt, ...) ATTRIBUTE((noreturn,format (printf, 1, 2)))   {    va_list args;    static int in_fatal = 0;       va_start(args,fmt);    /* Prevent double fatal. */    if (in_fatal)    {    (void)VFPRINTF(stderr, fmt, args);    abort();
pike.git/src/error.c:456:    dmalloc_touch_svalue(Pike_sp);       free_svalue(& throw_value);    throw_value.type=PIKE_T_OBJECT;    throw_value.u.object=o;    throw_severity = THROW_ERROR;    in_error=0;    pike_throw(); /* Hope someone is catching, or we will be out of balls. */   }    - void generic_error( + PMOD_EXPORT void generic_error(    char *func,    struct svalue *base_sp, int args,    char *desc, ...) ATTRIBUTE((noreturn,format (printf, 4, 5)))   {    INIT_ERROR(generic);    ERROR_DONE(generic);   }    - void index_error( + PMOD_EXPORT void index_error(    char *func,    struct svalue *base_sp, int args,    struct svalue *val,    struct svalue *ind,    char *desc, ...) ATTRIBUTE((noreturn,format (printf, 6, 7)))   {    INIT_ERROR(index);    ERROR_COPY_SVALUE(index, val);    ERROR_COPY_SVALUE(index, ind);    ERROR_DONE(generic);   }    - void bad_arg_error( + PMOD_EXPORT void bad_arg_error(    char *func,    struct svalue *base_sp, int args,    int which_arg,    char *expected_type,    struct svalue *got,    char *desc, ...) ATTRIBUTE((noreturn,format (printf, 7, 8)))   {    INIT_ERROR(bad_arg);    ERROR_COPY(bad_arg, which_arg);    ERROR_STRUCT(bad_arg,o)->expected_type=make_shared_string(expected_type);
pike.git/src/error.c:502:    }else{    ERROR_STRUCT(bad_arg,o)->got.type=PIKE_T_INT;    ERROR_STRUCT(bad_arg,o)->got.subtype=NUMBER_UNDEFINED;    ERROR_STRUCT(bad_arg,o)->got.u.integer=0;    }    DWERROR((stderr, "%s():Bad arg %d (expected %s)\n",    func, which_arg, expected_type));    ERROR_DONE(generic);   }    - void math_error( + PMOD_EXPORT void math_error(    char *func,    struct svalue *base_sp, int args,    struct svalue *number,    char *desc, ...) ATTRIBUTE((noreturn,format (printf, 5, 6)))   {    INIT_ERROR(math);    if(number)    {    ERROR_COPY_SVALUE(math, number);    }else{    ERROR_STRUCT(math,o)->number.type=PIKE_T_INT;    ERROR_STRUCT(math,o)->number.subtype=NUMBER_UNDEFINED;    ERROR_STRUCT(math,o)->number.u.integer=0;    }    ERROR_DONE(generic);   }    - void resource_error( + PMOD_EXPORT void resource_error(    char *func,    struct svalue *base_sp, int args,    char *resource_type,    long howmuch,    char *desc, ...) ATTRIBUTE((noreturn,format (printf, 6, 7)))   {    INIT_ERROR(resource);    ERROR_COPY(resource,howmuch);    ERROR_STRUCT(resource,o)->resource_type=make_shared_string(resource_type);    ERROR_DONE(generic);   }    - void permission_error( + PMOD_EXPORT void permission_error(    char *func,    struct svalue *base_sp, int args,    char *permission_type,    char *desc, ...) ATTRIBUTE((noreturn, format(printf, 5, 6)))   {    INIT_ERROR(permission);    ERROR_STRUCT(permission,o)->permission_type=    make_shared_string(permission_type);    ERROR_DONE(generic);   }    - void wrong_number_of_args_error(char *name, int args, int expected) + PMOD_EXPORT void wrong_number_of_args_error(char *name, int args, int expected)   {    char *msg;    if(expected>args)    {    msg="Too few arguments";    }else{    msg="Too many arguments";    }       new_error(name, msg, Pike_sp-args, args, 0,0);