Can gdb be used to backtrace when exceptions are caught?

后端 未结 2 1198
执笔经年
执笔经年 2021-02-05 07:33

I have just started using c++ exceptions and want to get it right. What I have in mind is to generate some sort of backtrace information when exceptions are caught. Initially I

2条回答
  •  失恋的感觉
    2021-02-05 08:17

    This this:

    http://sourceware.org/gdb/onlinedocs/gdb/Set-Catchpoints.html

    You can use catchpoints to cause the debugger to stop for certain kinds of program events, such as C++ exceptions or the loading of a shared library. Use the catch command to set a catchpoint.

    So the answer should be "yes", and it should avoid the problems with the two links you cited.

    Please post back if it helped! Personally, I've never tried this GDB feature myself :)

提交回复
热议问题