1

Is it possible to use Qt Creator (MinGW build) as just-in-time debugder? Instead of VS on windows.

Every time, when my application crush, Windows propose me to use Visual Studio as debugger.

tower120
  • 5,007
  • 6
  • 40
  • 88
  • For example - make simple QT console app, then divide on 0. Build with debug info. Run it. Catch error (jit). Debug with QT creator instead of VS. – tower120 Jan 02 '14 at 09:41
  • @Laszlo Papp - I can debug with VS. But what I have to do to debug with QT Creator? When error occurs - I can see only VS as debugger in "JIT select debugger" dialog. – tower120 Jan 04 '14 at 17:22

2 Answers2

2

From QtCreator : Launching the Debugger article:

The post-mortem mode is available only on Windows, if you have installed the debugging tools for Windows.

The Qt Creator installation program asks you whether you want to register Qt Creator as a post-mortem debugger. To change the setting, select Tools > Options > Debugger > Common > Use Qt Creator for post-mortem debugging.

dawid
  • 190
  • 1
  • 12
0

You will need to set it up as per documentation:

GDB On Linux and Windows, use the Python-enabled GDB versions that are installed when you install Qt Creator and Qt SDK. On Mac OS X, use the GDB provided with Xcode. You can also build your own Python-enabled GDB. Follow the instructions in Building GDB.

Here you can find the wiki for building GDB yourself:

Building GDB

I am attaching a screenshot from my QtCreator on Linux where you can configure your debugger related options if it is not recognized by default.

enter image description here

László Papp
  • 51,870
  • 39
  • 111
  • 135
  • This will not use gdb, the GNU Debugger user with MinGW. – rubenvb Jan 04 '14 at 19:27
  • Now it's relevant, but this won't set up the post mortem debugger or whatever people call it. I do remember at one point Qt Creator can do it, I'm just not sure how it did it. Downvote removed :-) – rubenvb Jan 04 '14 at 19:44
  • @rubenvb: what do you mean by post mortem debugger? – László Papp Jan 04 '14 at 19:45
  • When an app crashes, and you have VS installed, Windows asks you if you want to debug the crash, at that moment. I fear though only Qt Creator with CDB will do this, not GDB. But I'm not sure. – rubenvb Jan 04 '14 at 20:11
  • @rubenvb: I would not understand why mix up those two environments... I think someone should stick to either of them for a happier life. M$ can go messy when those are mixed. :) – László Papp Jan 04 '14 at 20:13
  • I think the OP just wants a MinGW compiled program to trigger this debugging feature. You can't debug a MinGW program with Visual Studio. But then again, I don't see the reason for not running the crashing app in the debugger in the first place... – rubenvb Jan 04 '14 at 20:22
  • @rubenvb: yes, I agree, just use the QtCreator debugger. – László Papp Jan 04 '14 at 20:23
  • I'm clarify a little. I have VS installed, and I need it. I have Qt installed, I made my app with it, and I want "post mortem" debug with it for that app. I'm using windows build http://qt-project.org/downloads with MinGW. I have GDB in that list, but that does not help me. – tower120 Jan 04 '14 at 20:56
  • @tower120: Just use the QtCreator debugger for debugging with QtCreator. Also, you will have a _lot_ of trouble with mixing radically different environments like these. Just stick to MSVC if you need VS, really. – László Papp Jan 04 '14 at 20:58
  • When error occurs I got something like this http://s12.postimg.org/v2enhnugt/HANSMER_VLC_media_player_2014_01_04_23_02_32.png . I Just HAVE NO GDB/CDB debugger in that list. – tower120 Jan 04 '14 at 21:05
  • I have error that encours only if debugger is not attached. Probably some time depended or threaded error. – tower120 Jan 04 '14 at 21:14
  • @tower120: I am not sure why you make it difficult for yourself. Let me ask the Xth time: why don't you just use the QtCreator debugger for debugging as opposed to running the executable separately when you actually want to debug the application. – László Papp Jan 04 '14 at 21:15
  • 1
    I want to figure out why my app crushes, and it not crushes when I start it with attached debugger ("debug" button). And afterall, what's so wrong with this JIT? – tower120 Jan 04 '14 at 21:18
  • @tower120: provide a self-contained app reproducing this issue. Please refer to sscce.org for details. – László Papp Jan 04 '14 at 21:19
  • 1
    The question is - how to use QT creator for JIT (post mortem debug) on windows. Not how to fix my app. – tower120 Jan 04 '14 at 21:24
  • @tower120: please provide an example that crashes without the debugger, and does not with. If it is not true, your use case is moot, and you should use the QtCreator debugger right from the beginning. So, you would need to prove that your use case is existing. – László Papp Jan 04 '14 at 21:33
  • 1
    I fixed my case, so I can't show it now. But I found http://stackoverflow.com/questions/186237/program-only-crashes-as-release-build-how-to-debug/18513077#18513077 - so my case is not the only one. If JIT exists I want to use it. If it is not possible to use it with QT Creator in Windows this is one thing, if you say me how I should debug this is another thing. – tower120 Jan 04 '14 at 22:14
  • If you cannot prove such a use caes exits, why would you like to solve that use case? There is no point in solving theoretical problems. Either way, I already wrote it would not work for even imaginary issues. I do not know what is left to be resolved. – László Papp Jan 05 '14 at 00:51
  • @Laszlo Papp - example of application work incorrect in release mode, but correct in debug. If value be pointer - this will cause segmentation fault. http://coliru.stacked-crooked.com/a/7d7bada1dacf5352 and http://coliru.stacked-crooked.com/a/f29a8469ec179046 from http://stackoverflow.com/questions/23710910/c11-rvalue-object-field/ – tower120 May 17 '14 at 11:57