How can I print stack trace for caught exceptions in C++ & code injection in C++

前端 未结 4 452
忘掉有多难
忘掉有多难 2020-12-07 15:16

I want to have stack trace not for my exceptions only but also for any descendants of std::exception

As I understand, stack trace is completely lost whe

4条回答
  •  粉色の甜心
    2020-12-07 15:50

    On Linux this can be implemented by adding a call to backtrace() in the exception constructor to capture the stack trace into an exception's member variable. Unfortunately, it won't work for standard exceptions, only for the ones you define.

提交回复
热议问题