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 debugger displaying incorrect value for variable (false instead of true)
Forum Updated to NodeBB v4.3 + New Features

QT debugger displaying incorrect value for variable (false instead of true)

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
3 Posts 3 Posters 839 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.
  • A Offline
    A Offline
    asqt
    wrote on last edited by
    #1

    I'm using QT Creator 3.5.1. I have QT 5.5.1 (MSVC 2013, 32 bit). Revision e548635a24. I also have Debugging Tools for Windows/CDB installed and auto detected by QT Creator.

    While debugging I encountered this situation:

    alt text

    Notice that isUdp is shown as being false, even though the current line arrow shows that we entered the true portion of the if statement.

    What's going on?

    1 Reply Last reply
    0
    • hskoglundH Offline
      hskoglundH Offline
      hskoglund
      wrote on last edited by
      #2

      Hi, tooltips showing values in the code before the current breakpoint are not so trustworthy (maybe the compiler has optimized something for you). You could instead perhaps check by inserting a qDebug() << isUdp; between line 142 and 143,

      1 Reply Last reply
      0
      • R Offline
        R Offline
        raspe88
        wrote on last edited by
        #3

        Observed something similar myself once. The reason was that the compiler recognized that the variable (in your case isUdp), was set to true in every case and that it was not used anywhere else. So code was optimized in a way that the initialized value (false) was never overridden and it automatically jumped in the if-branch without checking the variable.

        If you have something similar and you print the value of isUdp before entering the if-branch to std:out, it should have the correct value (if the compiler doesn't optimize it in a way that it hardcodes the true-value at the output-command).

        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