简体   繁体   中英

Setting breakpoints in release mode in Qt creator

I am using Qt creator and cdb debugger for my c++ project. I need to set some breakpoints in code and see what happens during runtime. Unfortunately because of some third party library I absolutely can not use Debug mode so I have to stick to the release mode.

In visual studio I always do such thing and use breakpoints in the release mode easily but how could I do that in Qt creator?

(Versions: Qt 5.12 / Qt creator 4.8)

Try using a "Profile" build in Qt Creator. That will include separate debugging line information in a "Release" (optimized) build. You can then launch it using the Debug button in Qt Creator and set breakpoints as you need.

Caveats:

  • You may not be able to get the exact line you want because of optimizations by the compiler.

  • You most variables will be optimized into registers, so you can't view them. If you need to view registers, try the good, old fashion method of printing their values out with a qDebug() statement. (When in doubt, print it out.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM