3

I want to see the application stack trace or crash logs on device. Is there any in built functionality available for Qt?

We can have the app logs by writing to files or doing device debugging. But getting a stack trace is useful when an unknown/fatal error occurs while running the app on the target device.

Mat
  • 202,337
  • 40
  • 393
  • 406
kusumat
  • 31
  • 1
  • 2

2 Answers2

2

There is no built-in solution for this, but (assuming you are using c++), google-breakpad provides a solution. The documentation is a little lacking, and it has trouble playing with Qt's (non-)handling of exceptions thrown in event handlers, but it can take care of most of the heavy lifting.

Responding to questions in other answer:

Gyp should be located in src\tools\gyp\gyp.bat. You will run something like the following:

src\tools\gyp\gyp.bat src\client\windows\breakpad_client.gyp --include=breakpad_include.gypi -Dwin_debug_RuntimeLibrary=3 -Dwin_release_RuntimeLibrary=2 --generator-output=..\build\google_breakpad

The breakpad_include.gypi file sets up special configuration that gyp should use. Mine looks like this:

{
  'target_defaults': {
    'configurations': {
      'Common_Base': {
        'msvs_settings': {
          'VCCLCompilerTool': {
            'TreatWChar_tAsBuiltInType': '0',
          },
        },
      },
    },
  },
}

This gets around a difference in how Qt and VS treat WChar. The other settings specify the runtime library to use. This has to match what Qt is using.

Dave Mateer
  • 17,608
  • 15
  • 96
  • 149
0

You have not specified which OS but on linux you can make it create a core file by this command

set ulimit -c unlimited

Put this into your .bashrc file or where is appropriate and whenever a crash occurs you will get a core dump of your application.

Then you can debug it using gdb.

O.C.
  • 6,711
  • 1
  • 25
  • 26