zoukankan      html  css  js  c++  java
  • mudos源码分析

    错误捕捉相关的代码在simulate.c

    void throw_error()
    {
        if (((current_error_context->save_csp + 1)->framekind & FRAME_MASK) == FRAME_CATCH) {
            LONGJMP(current_error_context->context, 1);
            fatal("Throw_error failed!");
        }
        error("Throw with no catch.
    ");
    }
    
    static void debug_message_with_location P1(char *, err) {
        if (current_object && current_prog) {
                debug_message("%sprogram: /%s, object: /%s, file: %s
    ",
                  err,
                  current_prog->name,
                  current_object->name,
                  get_line_number(pc, current_prog));
        } else if (current_object) {
                debug_message("%sprogram: (none), object: /%s, file: (none)
    ",
                  err,
                  current_object->name);
        } else {
                debug_message("%sprogram: (none), object: (none), file: (none)
    ",
                  err);
        }
    }
    void fatal P1V(char *, fmt)
    {
        static int in_fatal = 0;
        char msg_buf[2049];
        va_list args;
        V_DCL(char *fmt);
    
        if (in_fatal) {
            debug_message("Fatal error while shutting down.  Aborting.
    ");
        } else {
            in_fatal = 1;
            V_START(args, fmt);
            V_VAR(char *, fmt, args);
            vsprintf(msg_buf, fmt, args);
            va_end(args);
            debug_message("******** FATAL ERROR: %s
    MudOS driver attempting to exit gracefully.
    ", msg_buf);
            if (current_file)
                debug_message("(occured during compilation of %s at line %d)
    ", current_file, current_line);
            if (current_object)
                debug_message("(current object was /%s)
    ", current_object->name);
            
            dump_trace(1);
            
    #ifdef PACKAGE_MUDLIB_STATS
            save_stat_files();
    #endif
            copy_and_push_string(msg_buf);
            if (command_giver) {
                push_object(command_giver);
            } else {
                push_undefined();
            }
            if (current_object) {
                push_object(current_object);
            } else {
                push_undefined();
            }
            apply_master_ob(APPLY_CRASH, 3);
            debug_message("crash() in master called successfully.  Aborting.
    ");
        }
        /* Make sure we don't trap our abort() */
    #ifdef SIGABRT
        signal(SIGABRT, SIG_DFL);
    #endif
    #ifdef SIGILL
        signal(SIGILL, SIG_DFL);
    #endif
    #ifdef SIGIOT
        signal(SIGIOT, SIG_DFL);
    #endif
        
    #if !defined(DEBUG_NON_FATAL) || !defined(MDEBUG)
    #ifdef WIN32
        exit(0);
    #endif
        abort();
    #endif
        in_fatal = 0;
    }
  • 相关阅读:
    进程和线程
    jQuery闭包理解
    数据库设计
    DevOps概念
    DevOps实践指南-何处开始(5-8)
    DevOps实践指南-DevOps介绍(1-4)
    iNeuOS工业互联平台,设备容器(物联网)改版,并且实现设备数据点的实时计算和预警。发布3.2版本
    iNeuOS工业互联平台,在“智慧”楼宇、园区等领域的应用
    iNeuOS工业互联平台,机床&PLC硬件网关与平台无缝对接,进行数据交互
    参观2020年上海工业博览会几点感受及判断
  • 原文地址:https://www.cnblogs.com/cfas/p/7901905.html
Copyright © 2011-2022 走看看