QVector instance passed into a method by reference is inaccessible to the debugger
-
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. -
Probably got optimized away or function got inlined. Are you running a Release config by any chance?
-
@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.
-
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?