forked from qt-creator/qt-creator
Debugger[CDB]: Fix handling of shadowed variables.
Fix name formatting and algorithm to find uninitialized variables to use reverse order in case locals of the same name occur in a scope. Reviewed-by: hjk Task-number: QTCREATORBUG-4475
This commit is contained in:
@@ -1432,19 +1432,21 @@ void CdbEngine::updateLocals(bool forNewStackFrame)
|
||||
}
|
||||
}
|
||||
addLocalsOptions(str);
|
||||
// Uninitialized variables if desired
|
||||
// Uninitialized variables if desired. Quote as safeguard against shadowed
|
||||
// variables in case of errors in uninitializedVariables().
|
||||
if (debuggerCore()->boolSetting(UseCodeModel)) {
|
||||
QStringList uninitializedVariables;
|
||||
getUninitializedVariables(debuggerCore()->cppCodeModelSnapshot(),
|
||||
frame.function, frame.file, frame.line, &uninitializedVariables);
|
||||
if (!uninitializedVariables.isEmpty()) {
|
||||
str << blankSeparator << "-u ";
|
||||
str << blankSeparator << "-u \"";
|
||||
int i = 0;
|
||||
foreach(const QString &u, uninitializedVariables) {
|
||||
if (i++)
|
||||
str << ',';
|
||||
str << localsPrefixC << u;
|
||||
}
|
||||
str << '"';
|
||||
}
|
||||
}
|
||||
// Perform watches synchronization
|
||||
|
Reference in New Issue
Block a user