论坛首页 综合技术论坛

erl CTRL+C do_break 的功能

浏览 2831 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2007-08-16  
在erl shell下按下CTRL+C的时候
  erts_printf("\n"        "BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded\n"      "       (v)ersion (k)ill (D)b-tables (d)istribution\n");
但是实际上可以有更多功能 看代码:

  while (1) {
    if ((i = sys_get_key(0)) <= 0)
        erl_exit(0, "");
    switch (i) {
    case 'q':
    case 'a':
    case '*': /*
           * The asterisk is an read error on windows,
           * where sys_get_key isn't that great in console mode.
           * The usual reason for a read error is Ctrl-C. Treat this as
           * 'a' to avoid infinite loop.
           */
        erl_exit(0, "");
    case 'A':        /* Halt generating crash dump */
        erl_exit(1, "Crash dump requested by user");
    case 'c':
        return;
    case 'p':
        process_info(ERTS_PRINT_STDOUT, NULL);
        return;
    case 'm':
        return;
    case 'o':
        port_info(ERTS_PRINT_STDOUT, NULL);
        return;
    case 'i':
        info(ERTS_PRINT_STDOUT, NULL);
        return;
    case 'l':
        loaded(ERTS_PRINT_STDOUT, NULL);
        return;
    case 'v':
        erts_printf("Erlang (%s) emulator version "
               ERLANG_VERSION "\n",
               EMULATOR);
        erts_printf("Compiled on " ERLANG_COMPILE_DATE "\n");
        return;
    case 'd':
        distribution_info(ERTS_PRINT_STDOUT, NULL);
        return;
    case 'D':
        db_info(ERTS_PRINT_STDOUT, NULL, 1);
        return;
    case 'k':
        process_killer();
        return;
#ifdef OPPROF
    case 'X':
        dump_frequencies();
        return;
    case 'x':
        {
        int i;
        for (i = 0; i <= HIGHEST_OP; i++) {
            if (opc[i].name != NULL) {
            erts_printf("%-16s %8d\n", opc[i].name, opc[i].count);
            }
        }
        }
        return;
    case 'z':
        {
        int i;
        for (i = 0; i <= HIGHEST_OP; i++)
            opc[i].count = 0;
        }
        return;
#endif
#ifdef DEBUG
    case 't':
        p_slpq();
        return;
    case 'b':
        bin_check();
        return;
    case 'C':
        abort();
#endif
    case '\n':
        continue;
    default:
        erts_printf("Eh?\n\n");
    }
    }


好多调试用的功能 希望对大家有用。
论坛首页 综合技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics