Grzenio
Grzenio

Reputation: 36639

How can I make QtCreator break on exceptions?

I am Debugging some BOOST unit tests in QtCreator and it sadly happened that they crash with an exception. How can I make QtCreator automagically break if any exception is raised? In Visual Studio there is a tick box for this one, is it also available in QtCreator?

In my case, BOOST catches the exception, so the program doesn't technically crash. However, the reported message is not really helpful.

I tried the same in KDevelop previuosly, hence I am asking separate questions about both of these IDEs.

Upvotes: 45

Views: 10440

Answers (2)

alireza
alireza

Reputation: 101

In QTcreator 8.0.2, this worked for me without adding any additional breakpoints:

Edit --> preferences --> Debugger --> GDB Extended --> Enable "Stop when aport() is called"

enter image description here

Upvotes: 0

Sergey Shambir
Sergey Shambir

Reputation: 1592

  • Open Debug mode (Ctrl+F4 or just 4th mode on right bar).

    enter image description here

  • Open context menu in breakpoints list at right bottom:

    enter image description here

  • Select "Add Breakpoint" and set the breakpoint type to "Break when C++ exception is thrown":

    enter image description here

Upvotes: 69

Related Questions