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)?
Forum Updated to NodeBB v4.3 + New Features

QtCreator debugger showing (invalid)?

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
9 Posts 7 Posters 832 Views 1 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.
  • S Offline
    S Offline
    SPlatten
    wrote on 12 Oct 2021, 09:24 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

    J J 2 Replies Last reply 12 Oct 2021, 12:49
    0
    • S SPlatten
      12 Oct 2021, 09:24

      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 Offline
      J Offline
      JonB
      wrote on 12 Oct 2021, 12:49 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
      • J Offline
        J Offline
        JoeCFD
        wrote on 12 Oct 2021, 16:05 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;

        S 1 Reply Last reply 13 Oct 2021, 05:36
        1
        • C Offline
          C Offline
          ChrisW67
          wrote on 13 Oct 2021, 02:40 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
          • J JoeCFD
            12 Oct 2021, 16:05

            @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;

            S Offline
            S Offline
            SPlatten
            wrote on 13 Oct 2021, 05:36 last edited by
            #5

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

            Kind Regards,
            Sy

            J 1 Reply Last reply 13 Oct 2021, 05:46
            0
            • S SPlatten
              13 Oct 2021, 05:36

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

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 13 Oct 2021, 05:46 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

              S 1 Reply Last reply 13 Oct 2021, 05:52
              0
              • J jsulm
                13 Oct 2021, 05:46

                @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?

                S Offline
                S Offline
                SPlatten
                wrote on 13 Oct 2021, 05:52 last edited by
                #7

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

                qDebug() << dtmCreated;
                

                Kind Regards,
                Sy

                1 Reply Last reply
                0
                • S SPlatten
                  12 Oct 2021, 09:24

                  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 Offline
                  J Offline
                  J.Hilk
                  Moderators
                  wrote on 13 Oct 2021, 05:54 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 13 Oct 2021, 05:55 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

                    1/9

                    12 Oct 2021, 09:24

                    • Login

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