Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt Creator crashes (SIGABRT) on expression error

Qt Creator crashes (SIGABRT) on expression error

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
10 Posts 3 Posters 361 Views
  • 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.
  • J Offline
    J Offline
    James Murray
    wrote on 1 Apr 2025, 10:46 last edited by
    #1

    When debugging and stopping at a breakpoint, if an existing expression is invalid (subscript out of range) it causes a SIGABRT.

    This can be really confusing. While I have learned to expect it now and can work around it, the first time I encountered it I lost a number of hours trying to understand why my code was crashing at this point when it was not.

    Code example:

    #include <QApplication>
    
    int main(int argc, char *argv[])
    {
        QList<int> testList;
    
        fprintf(stderr, "Size of list = %lld\n", testList.count()); // Set breakpoint on this line
    
        for (int x = 0; x < 5; x++) {
            testList.append(x);
        }
    
        for (int x = 0; x < 5; x++) {
            fprintf(stderr, "testList[x] = %d\n", testList[x]);
        }
    }
    

    Add an expression evaluator for testList[2]
    Debug the code and receive a SIGABRT

    Is this a known issue? Should I submit a bug report?
    I did search and didn't immediately find existing reference to this.

    James

    J 1 Reply Last reply 1 Apr 2025, 11:11
    0
    • C Christian Ehrlicher moved this topic from General and Desktop on 1 Apr 2025, 10:59
    • A Offline
      A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on 1 Apr 2025, 11:08 last edited by
      #2

      Hi @James-Murray,

      Yes, crashes can always be reported as bugs. Please go to bugreports.qt.io (you can add a link to the report here so others can follow).

      Please also specify the Creator version you are using, the operating system and the underlying debugger (and version) you are using. If you are using a Qt Creator older than 16.x, you will probably be asked to update and re-test.

      Regards

      Qt has to stay free or it will die.

      1 Reply Last reply
      0
      • J James Murray
        1 Apr 2025, 10:46

        When debugging and stopping at a breakpoint, if an existing expression is invalid (subscript out of range) it causes a SIGABRT.

        This can be really confusing. While I have learned to expect it now and can work around it, the first time I encountered it I lost a number of hours trying to understand why my code was crashing at this point when it was not.

        Code example:

        #include <QApplication>
        
        int main(int argc, char *argv[])
        {
            QList<int> testList;
        
            fprintf(stderr, "Size of list = %lld\n", testList.count()); // Set breakpoint on this line
        
            for (int x = 0; x < 5; x++) {
                testList.append(x);
            }
        
            for (int x = 0; x < 5; x++) {
                fprintf(stderr, "testList[x] = %d\n", testList[x]);
            }
        }
        

        Add an expression evaluator for testList[2]
        Debug the code and receive a SIGABRT

        Is this a known issue? Should I submit a bug report?
        I did search and didn't immediately find existing reference to this.

        James

        J Offline
        J Offline
        JonB
        wrote on 1 Apr 2025, 11:11 last edited by JonB 4 Jan 2025, 11:16
        #3

        @James-Murray
        You do not say platform, compiler, debugger or Creator version.

        For me under Ubuntu 24.04, Creator 13.0, gdb 15.0. I do not get a SIGABRT per se. Compiled for debug at least, in the terminal opened for a console application it outputs

        ASSERT failure in QList::operator[]: "index out of range", file /usr/include/x86_64-linux-gnu/qt6/QtCore/qlist.h, line 428

        at least until the element gets created while stepping through.

        But it does not stop my debugging, I can continue fine in the debugging session.

        I get similar behaviour if I use that expression for the conditional on a conditional breakpoint.

        I am not quite sure this can be avoided. It's irritating but not fatal so long as it does not stop you debugging. Are you saying it does that to you?

        However, so long as I change array expressions to use at(2) instead of [2] it goes through fine and no complaints for me? You should never use array operator [] in an expression in debugger anyway, think about why! :)

        Oh, LOL, testList.at(2) "works" in that it does not error, but it never evaluates to anything. So not much use. I have found trouble with array accesses trying to use Qt's [].

        1 Reply Last reply
        0
        • J Offline
          J Offline
          James Murray
          wrote on 1 Apr 2025, 12:17 last edited by
          #4

          Ubuntu 22.04.5
          QtCreator 16.0.0
          gdb 12.1

          At each single-step, I get a popup message about the SIGABRT.
          qtcreator2.jpg

          Yes, I realise why this occurs as [2] is beyond the end of the QList, but initially I found it really confusing and went around in circles thinking there was a problem with my application code - even as a reasonably experienced programmer.

          Perhaps if QtCreator at least mentioned that it was an expression evaluation problem then it would be more obvious to find the problem?

          James

          J 1 Reply Last reply 1 Apr 2025, 12:51
          0
          • A Offline
            A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on 1 Apr 2025, 12:39 last edited by
            #5

            @James-Murray: Ah, that's a crash of your debugged app, not a crash of Qt Creator.

            Nevertheless, you could report it (maybe as suggestion) as I agree the result is a bit surprising.

            Regards

            Qt has to stay free or it will die.

            J 1 Reply Last reply 1 Apr 2025, 12:47
            0
            • A aha_1980
              1 Apr 2025, 12:39

              @James-Murray: Ah, that's a crash of your debugged app, not a crash of Qt Creator.

              Nevertheless, you could report it (maybe as suggestion) as I agree the result is a bit surprising.

              Regards

              J Offline
              J Offline
              JonB
              wrote on 1 Apr 2025, 12:47 last edited by
              #6

              @aha_1980 said in Qt Creator crashes (SIGABRT) on expression error:

              @James-Murray: Ah, that's a crash of your debugged app, not a crash of Qt Creator.

              No, it is not. The only thing which causes the crash is having Creator have a Watch Expression (or same if condition on a breakpoint) on testList[2]. It is Creator/gdb evaluating that which causes the error, not OP's code.

              1 Reply Last reply
              0
              • J James Murray
                1 Apr 2025, 12:17

                Ubuntu 22.04.5
                QtCreator 16.0.0
                gdb 12.1

                At each single-step, I get a popup message about the SIGABRT.
                qtcreator2.jpg

                Yes, I realise why this occurs as [2] is beyond the end of the QList, but initially I found it really confusing and went around in circles thinking there was a problem with my application code - even as a reasonably experienced programmer.

                Perhaps if QtCreator at least mentioned that it was an expression evaluation problem then it would be more obvious to find the problem?

                James

                J Offline
                J Offline
                JonB
                wrote on 1 Apr 2025, 12:51 last edited by JonB 4 Jan 2025, 12:52
                #7

                @James-Murray
                As I wrote, I do not get any such SIGABRT dialog or interruption. It may be coming from the ASSERT(), which can do something like an abort() call at its end.

                If you press OK in yours, (a) do you get a stack trace which shows an actual trace from your program (as opposed to inside Creator/gdb)? and (b) can you continue with the debugging session afterwards or does it terminate?

                Either our Craetors are different or you have a different setting from me? I can't recall whether I did a gdb setting to do with ignoring signals....

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  James Murray
                  wrote on 1 Apr 2025, 18:34 last edited by James Murray 4 Jan 2025, 18:35
                  #8

                  There's no stack trace as my application hasn't crashed.

                  The Application Output shows:
                  ASSERT failure in QList::operator[]: "index out of range", file /home/jsm/Qt/6.8.3/gcc_64/include/QtCore/qlist.h, line 458

                  I click ok, then Step, then the message pops up again. (As expressions are evaluated on each step.)
                  Neither QtCreator nor my application terminate. (My post title is slightly misleading, it isn't a full crash.)

                  James

                  J 1 Reply Last reply 1 Apr 2025, 19:13
                  0
                  • J James Murray
                    1 Apr 2025, 18:34

                    There's no stack trace as my application hasn't crashed.

                    The Application Output shows:
                    ASSERT failure in QList::operator[]: "index out of range", file /home/jsm/Qt/6.8.3/gcc_64/include/QtCore/qlist.h, line 458

                    I click ok, then Step, then the message pops up again. (As expressions are evaluated on each step.)
                    Neither QtCreator nor my application terminate. (My post title is slightly misleading, it isn't a full crash.)

                    James

                    J Offline
                    J Offline
                    JonB
                    wrote on 1 Apr 2025, 19:13 last edited by JonB 4 Jan 2025, 19:14
                    #9

                    @James-Murray OK, so just the same as I wrote in my first post. Same behaviour, but I don't get the message box.

                    1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      James Murray
                      wrote on 7 Apr 2025, 15:31 last edited by
                      #10

                      I created an issue: https://bugreports.qt.io/browse/QTCREATORBUG-32747

                      1 Reply Last reply
                      1

                      1/10

                      1 Apr 2025, 10:46

                      • Login

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