Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to defect crash on MacOS? Is there call stack?
Qt 6.11 is out! See what's new in the release blog

How to defect crash on MacOS? Is there call stack?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 5 Posters 776 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    angelyouyou
    wrote on last edited by angelyouyou
    #1

    I run my application with running mode, it reported crash.
    But there is no future information to defect?
    Is there some information stored the call stack information.

    When I used debug mode, the application seems running ok.

    Here is some output information:

    debug [2021-07-02 11:30:01] ../Text2Cap/Schedule/timerutils.cpp:77 HandleTimeout enter timeout processing function.

    debug [2021-07-02 11:30:01] ../Text2Cap/Schedule/timerutils.cpp:128 Stop timer(type=1)
    11:30:01: The process was ended forcefully.
    11:30:01: /Users/Constantine/Documents/Work/Archive/KM/Code/Text2Cap/build-Text2Cap-Desktop_Qt_6_1_1_clang_64bit-Debug/Text2Cap.app/Contents/MacOS/Text2Cap crashed.

    CP71C 1 Reply Last reply
    0
    • A angelyouyou

      I run my application with running mode, it reported crash.
      But there is no future information to defect?
      Is there some information stored the call stack information.

      When I used debug mode, the application seems running ok.

      Here is some output information:

      debug [2021-07-02 11:30:01] ../Text2Cap/Schedule/timerutils.cpp:77 HandleTimeout enter timeout processing function.

      debug [2021-07-02 11:30:01] ../Text2Cap/Schedule/timerutils.cpp:128 Stop timer(type=1)
      11:30:01: The process was ended forcefully.
      11:30:01: /Users/Constantine/Documents/Work/Archive/KM/Code/Text2Cap/build-Text2Cap-Desktop_Qt_6_1_1_clang_64bit-Debug/Text2Cap.app/Contents/MacOS/Text2Cap crashed.

      CP71C Offline
      CP71C Offline
      CP71
      wrote on last edited by
      #2

      @angelyouyou
      Hi,
      I had a similar issue on Linux.
      I managed the signals to try to detect my crash.
      I stored the output of the handler function in the file.
      I enable caching of the signals only when I need it ( it is under define that enables catching)

      I did this:
      In my main.cpp

      int main( ... )
      {
      ....
      signal( SIGFPE, handler );
      signal( SIGSEGV, handler );
      signal( SIGILL, handler );
      signal( SIGABRT, handler );
      signal( SIGKILL, handler );
      signal( SIGSTOP, handler );
      signal( SIGSYS, handler );

      ...
      

      }

      #include "signal.h"
      #include "execinfo.h"
      void handler(int a)
      {
      void *array[128];
      char **string;
      int size, i;

      switch( a )
      {
      case SIGFPE:
      case SIGSEGV:
      case SIGILL:
      case SIGABRT:
      case SIGKILL:
      case SIGSTOP:
      case SIGSYS:
          qDebug() << "****** FATAL ERROR: Signal type" << a ;
          size = backtrace(array, 128);
          string = backtrace_symbols(array, size);
          if (string != NULL )
          {
              for ( int i = 0; i < size; i++ )
                  qDebug() << string[i] ;
          }
          abort();
          break;
      
      default:
          qDebug() << "Signal" << a << "- FATAL ERROR";
          break;
      }
      

      }

      1 Reply Last reply
      0
      • A Offline
        A Offline
        anh_ph
        wrote on last edited by
        #3

        Use can try this one. It's good for me
        https://github.com/asmaloney/asmCrashReport

        1 Reply Last reply
        1
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          macOS usually shows you a crash diagnostic when an application crashes.

          If you have a crash only in release mode, it's usually related to an uninitialized pointer.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          JoeCFDJ 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            macOS usually shows you a crash diagnostic when an application crashes.

            If you have a crash only in release mode, it's usually related to an uninitialized pointer.

            JoeCFDJ Offline
            JoeCFDJ Offline
            JoeCFD
            wrote on last edited by JoeCFD
            #5

            @SGaist If this is the case, run cppcheck. It has the following features:

            Dead pointers
            Division by zero
            Integer overflows
            Invalid bit shift operands
            Invalid conversions
            Invalid usage of STL
            Memory management
            Null pointer dereferences
            Out of bounds checking
            Uninitialized variables
            Writing const data
            

            Actually it is a good habit to run cppcheck regularly on the apps.

            Get cppcheck installed on Mac using Brew

            Open Terminal using Spotlight search by pressing <command+space> . Type terminal and hit Enter key.
            Install cppcheck using brew. brew install cppcheck.
            
            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved