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

'Locals & Expressions' bug with vectors of classes with static member(s)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • Qt Creator 4.4.0-beta1
    • Qt Creator 4.3.0
    • Debugger
    • None
    • CentOS 7, using GDB 8.0 (the problem happens also with version 7.x and 5.x)
      QtCreator 4.3.0 (revision7482d8a152)
    • e9491870bd06bfb3137d3c24abd6eca997aca9fa 1a16caf221da6586f429a164656d89509398c625

    Description

      In certain cicrumstances (see the "main.cpp" file included for a very simple repro) the "Locals and Expressions" panel fails to display items in an array :


      The problem seems to come from a static member in the String class. When removing the member, the problem doesn't happen, and we can correctly browse the content of the array.

      I've located the problem in the "dumper.py" file. It's in the "extractField" member of the "Value" class: when we reach the static member, "field.bitpos" is "None". And since this value is then divided by 8 to get the position in bytes, we have an exception, which result in the "<not accessible>" problem.

      A quick and dirty fix was to patch dumper.py and check for "field.bitpos" (around line 3037 with my version of Creator) When None, I just ignore the part dealing with it. It works fine, but I can't browse "m_null_string", so the fix is not complete

      Edit: after the 4.3.1, it no longer displays <not accessible> but instead the address of the static is the same as the address of the instance, which is incorrect.

      And in my opinion, even worse : at least when I see <no accessible> I know something's wrong, whereas now I see something, and if I'm not careful I won't notice that it's erroneous. Debugging is one of the most important thing in development, so trusting what my debugger shows is pretty critical.

      See:

      Attachments

        1. debugging_helper_still_incorrect.png
          21 kB
          Damien Courtois
        2. locals_and_expressions_fix.png
          19 kB
          Damien Courtois
        3. locals_and_expressions.png
          7 kB
          Damien Courtois
        4. main.cpp
          1 kB
          Damien Courtois

        Activity

          People

            hjk hjk
            citron Damien Courtois
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: