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

QJson* structs in debug not parse properly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • Qt Creator 4.12.1, Qt Creator 4.12.2
    • Debugger
    • None
    • Windows

    Description

      After update to Creator 4.12.1/4.12.2 from 4.9.2 or earlier, content of the QJson objects (arrays, strings, etc.) in debug always shown as "not accesible", sometimes QJsonValue (QString) shown as struct of incorrect types with incorrect keys name and value, but the code itself works completely correctly.

      static QJsonObject test;
      test["123"]="qwerty";
      qDebug() << test["123"];
      
      --debug output--
      QJsonValue(string, "qwerty")
      
      --debug view--
      test <8 items> QJsonObject
      [0] <not accessible>
      [1] <not accessible>
      [2] <not accessible>
      [3] <not accessible>
      [4] <not accessible>
      [5] <not accessible>
      [6] <not accessible>
      [7] <not accessible>
      test@1 <8 items> QJsonObject
      [0] <not accessible>
      [1] <not accessible>
      [2] <not accessible>
      [3] <not accessible>
      [4] <not accessible>
      [5] <not accessible>
      [6] <not accessible>
      [7] <not accessible> 
      
      --debug log--
      >&"python theDumper.fetchVariables({\"autoderef\":1,\"context\":\"\",\"displaystringlimit\":\"100\",\"dyntype\":1,\"expanded\":[\"local\",\"inspect\",\"return\",\"watch\"],\"fancy\":1,\"formats\":{},\"nativemixed\":0,\"partialvar\":\"\",\"passexceptions\":0,\"qobjectnames\":1,\"resultvarname\":\"\",\"stringcutoff\":\"10000\",\"timestamps\":0,\"token\":396,\"typeformats\":{},\"watchers\":[]})\n"
      >~"result={token=\"0\",data=[{iname=\"local.test\",name=\"test\",numchild=\"8\",address=\"0x40a030\",type=\"QJsonObject\",valueencoded=\"itemcount\",value=\"8\",},{iname=\"local.this\",name=\"this\",origaddr=\"0x77fd00\",address=\"0x77fd20\",address=\"0x77fd20\",numchild=\"1\",type=\"MainWindow\",valueencoded=\"utf16\",value=\"4d00610069006e00570069006e0064006f007700\",},{iname=\"local.parent\",name=\"parent\",origaddr=\"0x77fd08\",address=\"0x0\",numchild=\"0\",type=\"QWidget*\",value=\"0x0\",},{iname=\"local.test@1\",name=\"test@1\",numchild=\"8\",address=\"0x40a030\",type=\"QJsonObject\",valueencoded=\"itemcount\",value=\"8\",},],typeinfo=[],partial=\"0\",counts={},timings=[]}\n"
      >396^done
       <Rebuild Watchmodel 39 @ 13:28:05.816 [383971ms] >
       Finished retrieving data.<397python theDumper.fetchVariables({"autoderef":1,"context":"","displaystringlimit":"100","dyntype":1,"expanded":["local","inspect","return","local.test@1","watch"],"fancy":1,"formats":{},"nativemixed":0,"partialvar":"local.test@1","passexceptions":0,"qobjectnames":1,"resultvarname":"","stringcutoff":"10000","timestamps":0,"token":397,"typeformats":{},"watchers":[]})
      >&"python theDumper.fetchVariables({\"autoderef\":1,\"context\":\"\",\"displaystringlimit\":\"100\",\"dyntype\":1,\"expanded\":[\"local\",\"inspect\",\"return\",\"local.test@1\",\"watch\"],\"fancy\":1,\"formats\":{},\"nativemixed\":0,\"partialvar\":\"local.test@1\",\"passexceptions\":0,\"qobjectnames\":1,\"resultvarname\":\"\",\"stringcutoff\":\"10000\",\"timestamps\":0,\"token\":397,\"typeformats\":{},\"watchers\":[]})\n"
      >~"result={token=\"0\",data=[{iname=\"local.test\",name=\"test\",numchild=\"8\",address=\"0x40a030\",type=\"QJsonObject\",valueencoded=\"itemcount\",value=\"8\",},{iname=\"local.test@1\",name=\"test@1\",numchild=\"8\",children=[{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},],address=\"0x40a030\",type=\"QJsonObject\",valueencoded=\"itemcount\",value=\"8\",},],typeinfo=[],partial=\"1\",counts={},timings=[]}\n"
      >397^done
       <Rebuild Watchmodel 40 @ 13:28:19.652 [13836ms] >
       Finished retrieving data.
      dADJUSTING CHILD EXPECTATION FOR local.test@1<398python theDumper.fetchVariables({"autoderef":1,"context":"","displaystringlimit":"100","dyntype":1,"expanded":["local","inspect","return","local.test","local.test@1","watch"],"fancy":1,"formats":{},"nativemixed":0,"partialvar":"local.test","passexceptions":0,"qobjectnames":1,"resultvarname":"","stringcutoff":"10000","timestamps":0,"token":398,"typeformats":{},"watchers":[]})
      >&"python theDumper.fetchVariables({\"autoderef\":1,\"context\":\"\",\"displaystringlimit\":\"100\",\"dyntype\":1,\"expanded\":[\"local\",\"inspect\",\"return\",\"local.test\",\"local.test@1\",\"watch\"],\"fancy\":1,\"formats\":{},\"nativemixed\":0,\"partialvar\":\"local.test\",\"passexceptions\":0,\"qobjectnames\":1,\"resultvarname\":\"\",\"stringcutoff\":\"10000\",\"timestamps\":0,\"token\":398,\"typeformats\":{},\"watchers\":[]})\n"
      >~"result={token=\"0\",data=[{iname=\"local.test\",name=\"test\",numchild=\"8\",children=[{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},],address=\"0x40a030\",type=\"QJsonObject\",valueencoded=\"itemcount\",value=\"8\",},{iname=\"local.test@1\",name=\"test@1\",numchild=\"8\",children=[{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},{numchild=\"0\",valueencoded=\"notaccessible\",value=\"\",},],address=\"0x40a030\",type=\"QJsonObject\",valueencoded=\"itemcount\",value=\"8\",},],typeinfo=[],partial=\"1\",counts={},timings=[]}\n"
      >398^done
       <Rebuild Watchmodel 41 @ 13:28:20.097 [445ms] >
       Finished retrieving data.
      dADJUSTING CHILD EXPECTATION FOR local.test
      dADJUSTING CHILD EXPECTATION FOR local.test@1

       

      Repeats on 8.1.0 (x32 & x64), 7.3.0 (x32 & x64) versions of MinGW, on different versions of windows including completely clean system and clean qt with different settings of CDB/GDB and different optimizations, with new clean Qt Widgets Application and this code in mainwindow.cpp:

      #include "mainwindow.h"
      #include "ui_mainwindow.h"
      #include <QJsonObject>
      
      MainWindow::MainWindow(QWidget *parent)
         : QMainWindow(parent)
         , ui(new Ui::MainWindow)
      {
         ui->setupUi(this);
      
         static QJsonObject test;
         test["123"]="qwerty";
      
         asm("NOP");
         asm("NOP"); // breakpoint
         asm("NOP");
      }
      
      MainWindow::~MainWindow()
      {
         delete ui;
      }

       

      Now the only way to see the json contents in debug - use toVariantMap()/toVariantList() methods and view the content of temp variables.

      Attachments

        Issue Links

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

          Activity

            People

              hjk hjk
              nebster Dmitrii Permiakov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes