jit debugging with qt creator (Windows) - c++

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.

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.

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.

Related

How to make Qt Creator use Rosetta and x86 compiler on Mac M1?

I am using Qt 5.15.2 on my Mac mini with M1 chip. This works fine (due to Rosetta). Below is the list of compilers Qt Creator found on this computer, and among them is the C++, x86 64bit that I use. No problem.
I would like to use the same settings on a (somewhat newer) Mac Book Pro (also with M1 chip). Below is the list of compilers Qt Creator finds on this computer, the x86 is now missing!
I do not know if I have a x86 compiler on the new M1-computer. I have installed Xcode and the command line tools for XCode 13.2.
Can I somewhere tell Qt Creator that the deployment target is x86?
Does /usr/bin/clang++ only compile for the ARM/M1-chip, or can it also produce and link to x86 code?
if not, how can I find out if there is an x86 compiler on my new M1-computer?
If the compiler is missing, how to install it?
Any help would be most appreciated!
A few tips that can help, I just setup a project using Qt 5.15.2 on a 2021 M1 Mac.
Note this will likely be different for Qt >= 6.
Can I somewhere tell Qt Creator that the deployment target is x86?
Yes, you can do this using specific argument in the build settings of your kit.
Add the QMAKE_APPLE_DEVICE_ARCHS="x86_64" additional argument to qmake.
Also, add an additional CMake option: -DCMAKE_OSX_ARCHITECTURES:STRING="x86_64"
ℹ️ Click Manage Kits.. in the projects view to open the preferences editor where you can update your CMake configuration.
Does /usr/bin/clang++ only compile for the ARM/M1-chip, or can it also produce and link to x86 code?
With rosetta installed (/usr/sbin/softwareupdate –install-rosetta –agree-to-license), and the configuration above, yes you can compile and link x86 binaries.

Can't create console application project in QT creator - No valid kits found

I already add a kit in Tool->Options->Kits->ADD
and when im trying to create a console application it says "No valid kits found"
Click the Option hyperlink (or Tools --> Options) in the Kits tab, select the Desktop (default) entry below the Manual. You will see that the Qt version is blank, click the input control and select the right qt version and Apply or OK.
QtCreator did not find and tool chains.
Use the Qt Online Installer for Windows to install MinGW or MSVC tool chains.
If your qt sdk is x64 you need to install x64 mingw compiler. If not than install i686 mingw for compiler. Here is good guideline which you can learn how to install qt creator, qt sdk, and mingw for w8.1 machines.

QT adding compiler

I have QT 5.3.1 for Android (Windows), downloaded from http://qt-project.org/downloads with minGW 4.8.
Now I want to use MinGW 4.9 compiler.
To do so, I download mingw-w64 build [i686, posix, dwarf], and install it to separate folder.
Then, in QT creator, I add compiler in the "Build&Run" options.
Now when I compile something with -std=c++1y flag, in release mode - my program crashes at once (even window does not appear), and in debug mode I get :
During startup program exited with code 0xc0000139
What I do wrong?
I use Qt build from qtx64. It is built using MinGW 4.9 and has dwarf,seh,sjlj builds for x86/x64.
To use it you can create Qt Creator kit with it. You can use Qt Creator from qt-project.org but It should be configured like this:
Configuration images

Mountain Lion no working gdb debugger

I got a new Macbook Air and installed XCode 5 on it. To my surprise Apple does no longer ship gdb with the command line tools. As I am doing lots of c++ coding I am dependent on a good debugger.
What I tried so far:
Install gdb 7.6 via macports and signed the binary.
Debugging from QT-Creator is possible. It stops at the breakpoints but I see no information at all about the stack. Using lldb not possible, I get a weird python error.
Debugging from Netbeans is not possible at all. The Debugger is not stopping at any breakpoint. Apart from that Netbeans is not working with lldb.
Working with XCode is no problem. Everything works as expected.
Problem is I need an IDE that can do remote debugging as I have several Raspberry Pi projects. Developing software directly on the pi with vim is fun but not suitable for bigger projects.
So the question is, has anyone a working debugger on Mountain Lion with XCode 5 installed? IDE in question needs to support remote debugging (eg QT-Creator, Netbeans, Eclipse)
Thank you!
Install Xcode 4.6.3. If you have a developer's account it's available for download at http://developer.apple.com
Encountered the same problem. Finally installed command line tools from xcode 4.6.1 on ML. This package is available on Apple site. It installed GCC-LLVM 4.2.1 and GDB 6.5. Qt Creator was able to build application and start debugging. Debugging is not stable too much; but i can to see call stacks, values and stop on breakpoints. I use it for 32bits build - maybe it matters.
You could also switch from GDB to using the LLDB debugger (although the Qt support is early for this).
See http://stanford.edu/~rawatson/lair/mac.html

Setting Qt Creator to use the latest version of g++ and gdb on Windows

I wish to use the C++11 features in a Qt programs compiled by GNU C++ compiler (MinGW) on Windows. By this reason I can not use a version of compiler provided in Qt SDK.
I decided to use the latest versions of Qt, Qt Creator and MinGW. By this reason, I download and install these software separately. It is easy to set up the Qt Creator to use the version of Qt installed in C:\Qt folder and GNU C++ compiler from MinGW installed to C:\MinGW folder, but a debugging does not work then. More specific, I receive error:
"During startup program exited with code 0x0"
How to fix it? What is a correct setting for the debugger in the toolchain options?
QtCreator requires a patched version of gdb to works. It's a workaround
To make the --tty option work under MinGW and
To prevent gdb from freezing when attaching to a suspended process.
You have 2 alternatives (assuming that you are entirely satisfied with the prior installation of the framework and the compiler):
Download the patched gdb binary from Qt's repository or
Download the patches from Qt's site, apply them and build gdb
Install the debugger to the appropriate directory and finally resume the configuration of the debugger.