Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved QVector instance passed into a method by reference is inaccessible to the debugger

    Tools
    3
    6
    251
    Loading More Posts
    • 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.
    • I
      In Fo last edited by

      I pass an instance of QVector into my method

      const QVector<quint32>& vec
      

      but when I hover above the variable, the debugger says

      vec <not accessible>

      and if I add an expression evaluator, it does not evaluate.
      I am in QT Creator 4.7.2 under QT 5.11.3 in Windows with Win SDK 10 CDB for a debugger.

      1 Reply Last reply Reply Quote 0
      • Chris Kawa
        Chris Kawa Moderators last edited by

        Probably got optimized away or function got inlined. Are you running a Release config by any chance?

        1 Reply Last reply Reply Quote 4
        • I
          In Fo last edited by In Fo

          I do not believe it is possible to debug a release config. At least it does not occur to me to try. I am in a debug config.
          How can a compiler optimize away an instance of a class?

          JonB Chris Kawa 2 Replies Last reply Reply Quote 0
          • JonB
            JonB @In Fo last edited by JonB

            @In-Fo
            We could have a long discussion about how & why compilers can indeed optimize this and many other statements away. (Even in debug: I recall being surprised and having a conversation about this a long time ago.)

            In terms of practical, from where you are now. You could fiddle with code to try to introduce another variable or statement to resurrect your debugging ability on this symbol. But I'm just thinking: since it's a reference parameter, does your CDB allow you to go up to the calling frame simply and display the vector passed in there? Which may suffice for your debugging experience, if this is not a huge issue.

            1 Reply Last reply Reply Quote 2
            • Chris Kawa
              Chris Kawa Moderators @In Fo last edited by

              I do not believe it is possible to debug a release config

              You better believe it :) release configs are just optimized. They can have debug info just the same as Debug builds.

              How can a compiler optimize away an instance of a class?

              Easily ;) CPUs don't have a notion of classes. It's all just bytes to them.

              It sounds a bit weird in a Debug build though. Could you provide a minimal compilable example of that problem?

              1 Reply Last reply Reply Quote 2
              • I
                In Fo last edited by

                I am trying plain old pointers and none of the buf[0] kind of inspectors work.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post