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. QtCreator debugger showing (invalid)?

QtCreator debugger showing (invalid)?

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
9 Posts 7 Posters 699 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.
  • SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by
    #1

    I am debugging an application and when I single step:

            QDateTime dtmCreated(QDateTime::fromString(strValue,
                                                       Qt::ISODateWithMs));
            if ( dtmCreated.isValid() == true )
            {
                rdtmCreated = dtmCreated;
    qDebug() << "dtmCreate.isValid: " << dtmCreated.isValid();
            }
    

    The output is:

    2021-10-12T07:36:14
    

    The debugger shows:

    dtmCreated    (invalid)
    

    However it clearly isn't invalid as the call to isValid returns true and the console output displays the date, so what is going on?

    I'm using Qt Creator version 4.4.1 Based on Qt 5.9.2 (MSVC 2015, 32bit) Built on Oct 4 2017 04:12:53.

    I have no choice on the version I'm using, the hardware and software is provided by the client I am contracting to. Is this a known bug?

    Kind Regards,
    Sy

    JonBJ J.HilkJ 2 Replies Last reply
    0
    • SPlattenS SPlatten

      I am debugging an application and when I single step:

              QDateTime dtmCreated(QDateTime::fromString(strValue,
                                                         Qt::ISODateWithMs));
              if ( dtmCreated.isValid() == true )
              {
                  rdtmCreated = dtmCreated;
      qDebug() << "dtmCreate.isValid: " << dtmCreated.isValid();
              }
      

      The output is:

      2021-10-12T07:36:14
      

      The debugger shows:

      dtmCreated    (invalid)
      

      However it clearly isn't invalid as the call to isValid returns true and the console output displays the date, so what is going on?

      I'm using Qt Creator version 4.4.1 Based on Qt 5.9.2 (MSVC 2015, 32bit) Built on Oct 4 2017 04:12:53.

      I have no choice on the version I'm using, the hardware and software is provided by the client I am contracting to. Is this a known bug?

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

      @SPlatten
      Whatever it is, I would have thought it is an MSVC compiler/debugger issue, not a Qt Creator one.

      I always find occasionally a debugger shows this sort of thing due to code generation/optimization details. Since you say the program behaves correctly I wouldn't worry about it. If you absolutely have to know and the debugger is not playing ball, try temporarily passing it as a parameter to another tiny function and look at value there, that usually forces code/debugger to sort itself out.

      1 Reply Last reply
      3
      • JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by
        #3

        @SPlatten said in QtCreator debugger showing (invalid)?:

        qDebug() << "dtmCreate.isValid: " << dtmCreated.isValid();

        Try std output to see if it is the same:
        std::cout << "dtmCreate.isValid: " << dtmCreated.isValid() << std::endl;

        SPlattenS 1 Reply Last reply
        1
        • C Offline
          C Offline
          ChrisW67
          wrote on last edited by
          #4

          @SPlatten said in QtCreator debugger showing (invalid)?:

          However it clearly isn't invalid as the call to isValid returns true and the console output displays the date, so what is going on?

          Your code snippet does not output the date, so its unclear what code you are running/debugging.

          1 Reply Last reply
          1
          • JoeCFDJ JoeCFD

            @SPlatten said in QtCreator debugger showing (invalid)?:

            qDebug() << "dtmCreate.isValid: " << dtmCreated.isValid();

            Try std output to see if it is the same:
            std::cout << "dtmCreate.isValid: " << dtmCreated.isValid() << std::endl;

            SPlattenS Offline
            SPlattenS Offline
            SPlatten
            wrote on last edited by
            #5

            @JoeCFD , the output can only be performed if isValid is returning true.

            Kind Regards,
            Sy

            jsulmJ 1 Reply Last reply
            0
            • SPlattenS SPlatten

              @JoeCFD , the output can only be performed if isValid is returning true.

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @SPlatten As @ChrisW67 pointed out the code you posted does not output any date, not even if dtmCreated.isValid() returns true! So which code do you debug and at which exact place dtmCreated is shown as invalid?

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              SPlattenS 1 Reply Last reply
              0
              • jsulmJ jsulm

                @SPlatten As @ChrisW67 pointed out the code you posted does not output any date, not even if dtmCreated.isValid() returns true! So which code do you debug and at which exact place dtmCreated is shown as invalid?

                SPlattenS Offline
                SPlattenS Offline
                SPlatten
                wrote on last edited by
                #7

                @jsulm , I didn't post that line, but its simply:

                qDebug() << dtmCreated;
                

                Kind Regards,
                Sy

                1 Reply Last reply
                0
                • SPlattenS SPlatten

                  I am debugging an application and when I single step:

                          QDateTime dtmCreated(QDateTime::fromString(strValue,
                                                                     Qt::ISODateWithMs));
                          if ( dtmCreated.isValid() == true )
                          {
                              rdtmCreated = dtmCreated;
                  qDebug() << "dtmCreate.isValid: " << dtmCreated.isValid();
                          }
                  

                  The output is:

                  2021-10-12T07:36:14
                  

                  The debugger shows:

                  dtmCreated    (invalid)
                  

                  However it clearly isn't invalid as the call to isValid returns true and the console output displays the date, so what is going on?

                  I'm using Qt Creator version 4.4.1 Based on Qt 5.9.2 (MSVC 2015, 32bit) Built on Oct 4 2017 04:12:53.

                  I have no choice on the version I'm using, the hardware and software is provided by the client I am contracting to. Is this a known bug?

                  J.HilkJ Offline
                  J.HilkJ Offline
                  J.Hilk
                  Moderators
                  wrote on last edited by
                  #8

                  @SPlatten said in QtCreator debugger showing (invalid)?:

                  dtmCreated (invalid)

                  sadly not unusual. That happens when the debugger/the python interface can't really dissolve the code.

                  Happens frequently if you're for example inside a lambda body, deep inside nested classes or compiled with optimisation levels != O0


                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                  Q: What's that?
                  A: It's blue light.
                  Q: What does it do?
                  A: It turns blue.

                  1 Reply Last reply
                  3
                  • AxelViennaA Offline
                    AxelViennaA Offline
                    AxelVienna
                    wrote on last edited by
                    #9

                    The debugger behavior is a frequent issue, which results from trading speed for accuracy: the variable‘s display is initialized at an earlier point of time when the variable itself was uninitialized. Forcing all displays to be always current would slow down your debugger. Creating a small submethod and calling it with the variable in question as explained by @JonB usually forces correct displays if you really need it.

                    C++ and Python walk into a bar. C++ reuses the first glass.

                    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