try catch finally block

a simple pure C exception handling mechanism maybe NOT thread safe.

  • catch block 可继续向上抛出异常, a env stack holds the try contexts (jmp_buf).

    stack trace

    A backtrace is a list of the function calls that are currently active in a thread. The usual way to inspect a backtrace of a program is to use an external debugger such as gdb. However, sometimes it is useful to obtain a backtrace programmatically from within a program, e.g., for the purposes of logging or diagnostics.

    print call stack in C or C++

How can one grab a stack trace in C?

clean

嵌套的try实现

使用栈保存各层的上下文

Implementation

  • ctrycatch
  • exception4c