Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-21836

Mouse overlay display value of C compile-time bitmasks is wrong

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • Qt Creator 4.7.2
    • Debugger
    • Windows

    Description

      Hi, I found a bug using MingW, GDB and Qt Creator on Windows.

      When creating an compile-time C-style bitmask constant like the following:

      #include <stdio.h>
      #define BLA (1 << 0)
      #define BLA2 (1 << 1)
      void main(void) {
      const unsigned int data = BLA | BLA2;
      if(data & BLA) {printf("BLA");}
      if(data & BLA2) {printf("BLA2");}
      printf("%d", data);
      }
      

      It gives the correct result at runtime. However, hovering the constant BLA2 at debug time while stopping at an break point displays the wrong value 0x0010 instead of 0b0010 which would correctly evaluate to 2. So using that value 0x0010 (because for some reason BLA2 is not usable in GDB watches) would always give an incorrect result (which is by no means correct) but I don't really get how Qt Creator gets that value. Looking at the assembly in GCC it does an simpleĀ and $0x2,%eax so I am wondering how that value gets provided to the IDE.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            hjk hjk
            d-eath d-eath
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes