How do I get the value and type of the current exception in C++ in gdb?

Earlier answers were correct when written (in 2013), but since then gdb and libstdc++ have changed.

libstdc++ now has some hooks that let gdb interact more nicely with the exception system. In particular, there is now enough information exposed for gdb to provide a $_exception convenience variable to the user. This variable holds the exception being thrown. It is only valid at exactly the spot where the exception is being caught; which you can stop at using catch catch.

See the page from the manual for details.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)