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. Why does valgrind crash
Qt 6.11 is out! See what's new in the release blog

Why does valgrind crash

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 1.4k 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.
  • ocgltdO Offline
    ocgltdO Offline
    ocgltd
    wrote on last edited by
    #1

    I have an app that seems to run fine compiled normally, and with debug. However, when I run it from valgrind I get error:

    17:35:07: Process exited with return value Process crashed
    

    I tried running with Valgrind+GDB but it stops at a line outside of my code. The GDB stops on function ??, with one more line in the backtrace ??, and the first at address 0x50ccb9c. The valgrind window shows "(action on error) vgdb me ..."

    I have ensured I have the latest valgrind and gdb installed. I'm stuck...how do I find the line causing the crash?

    JoeCFDJ 1 Reply Last reply
    0
    • ocgltdO ocgltd

      I have an app that seems to run fine compiled normally, and with debug. However, when I run it from valgrind I get error:

      17:35:07: Process exited with return value Process crashed
      

      I tried running with Valgrind+GDB but it stops at a line outside of my code. The GDB stops on function ??, with one more line in the backtrace ??, and the first at address 0x50ccb9c. The valgrind window shows "(action on error) vgdb me ..."

      I have ensured I have the latest valgrind and gdb installed. I'm stuck...how do I find the line causing the crash?

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

      @ocgltd can you try first with gdb commands:
      gdb app
      r
      to see if your app crashes

      ocgltdO 1 Reply Last reply
      1
      • JoeCFDJ JoeCFD

        @ocgltd can you try first with gdb commands:
        gdb app
        r
        to see if your app crashes

        ocgltdO Offline
        ocgltdO Offline
        ocgltd
        wrote on last edited by ocgltd
        #3

        @JoeCFD It works perfectly if run only from gdb. If I run only with valgrind it crashes, and if with valgrind+gdb it crashes. So valgrind is exposing some flaw...

        I tried to run gdb with record (to play backwards) but it fails due to unsupported instruction.

        This seems to be a Heisenberg bug

        JoeCFDJ 1 Reply Last reply
        0
        • ocgltdO ocgltd

          @JoeCFD It works perfectly if run only from gdb. If I run only with valgrind it crashes, and if with valgrind+gdb it crashes. So valgrind is exposing some flaw...

          I tried to run gdb with record (to play backwards) but it fails due to unsupported instruction.

          This seems to be a Heisenberg bug

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

          @ocgltd do you have a test code? I can try it out on Ubuntu 22.04.

          ocgltdO 1 Reply Last reply
          0
          • JoeCFDJ JoeCFD

            @ocgltd do you have a test code? I can try it out on Ubuntu 22.04.

            ocgltdO Offline
            ocgltdO Offline
            ocgltd
            wrote on last edited by
            #5

            @JoeCFD It's part of a larger system...so not a simple build and test. But I'll try compiling and valgrind on another OS in case that makes a difference

            JonBJ 1 Reply Last reply
            0
            • ocgltdO ocgltd

              @JoeCFD It's part of a larger system...so not a simple build and test. But I'll try compiling and valgrind on another OS in case that makes a difference

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @ocgltd
              I don't know if this will help, but there are clearly "issues" from time to time with valgrind changing behaviour. Just the other day I "valgrinded" a program of mine which opens the Linux "select directory dialog box". The first time it let me select directories; after that most of the time it would show the directories as before in the dialog but everything was disabled and I could not select them. No problem outside of valgrind, and I am 100% sure it was not my code. So, for whatever, reason, here at least valgrind incorrectly caused a behaviour change. I'm not sure whether I have had it "crash" on me, it might have done. So just saying, it's not perfect.

              ocgltdO 1 Reply Last reply
              0
              • JonBJ JonB

                @ocgltd
                I don't know if this will help, but there are clearly "issues" from time to time with valgrind changing behaviour. Just the other day I "valgrinded" a program of mine which opens the Linux "select directory dialog box". The first time it let me select directories; after that most of the time it would show the directories as before in the dialog but everything was disabled and I could not select them. No problem outside of valgrind, and I am 100% sure it was not my code. So, for whatever, reason, here at least valgrind incorrectly caused a behaviour change. I'm not sure whether I have had it "crash" on me, it might have done. So just saying, it's not perfect.

                ocgltdO Offline
                ocgltdO Offline
                ocgltd
                wrote on last edited by
                #7

                I found a clue here:

                Debugging Code that Uses QRegularExpression
                QRegularExpression internally uses a just in time compiler (JIT) to optimize the execution of the matching algorithm. The JIT makes extensive usage of self-modifying code, which can lead debugging tools such as Valgrind to crash. You must enable all checks for self-modifying code if you want to debug programs using QRegularExpression (for instance, Valgrind's --smc-check command line option). The downside of enabling such checks is that your program will run considerably slower.
                
                To avoid that, the JIT is disabled by default if you compile Qt in debug mode. It is possible to override the default and enable or disable the JIT usage (both in debug or release mode) by setting the QT_ENABLE_REGEXP_JIT environment variable to a non-zero or zero value respectively.
                

                I'll refine my question and post something new! and more focused!

                1 Reply Last reply
                2

                • Login

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