diff options
author | Friedemann Kleint <[email protected]> | 2009-10-19 10:59:46 +0200 |
---|---|---|
committer | Friedemann Kleint <[email protected]> | 2009-10-19 10:59:46 +0200 |
commit | f240ceb4e6f395079c153c6352b508f1a961bec9 (patch) | |
tree | 48265e942bea65d3619846ab21c00f1da849e86d /src/plugins/debugger/watchutils.cpp | |
parent | 074d477fb0e4a244f6e82b8e13092746ca6d6569 (diff) |
CDB: Fix code model scope detection when stopping at function scope.
that is, setting a break point at the opening brace or at function.
Set StackFrame::from correctly.
Diffstat (limited to 'src/plugins/debugger/watchutils.cpp')
-rw-r--r-- | src/plugins/debugger/watchutils.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/plugins/debugger/watchutils.cpp b/src/plugins/debugger/watchutils.cpp index e7d52147aa9..55e03207bdb 100644 --- a/src/plugins/debugger/watchutils.cpp +++ b/src/plugins/debugger/watchutils.cpp @@ -365,16 +365,24 @@ int getUninitializedVariablesI(const CPlusPlus::Snapshot &snapshot, const CPlusPlus::Symbol *symbolAtLine = doc->findSymbolAt(line, 0); if (!symbolAtLine) return 4; - // First figure out the function to do a safety name check. + // First figure out the function to do a safety name check + // and the innermost scope at cursor position const CPlusPlus::Function *function = 0; - const bool hitFunction = symbolAtLine->isFunction(); - if (hitFunction) { + const CPlusPlus::Scope *innerMostScope = 0; + if (symbolAtLine->isFunction()) { function = symbolAtLine->asFunction(); + if (function->memberCount() == 1) // Skip over function block + if (CPlusPlus::Block *block = function->memberAt(0)->asBlock()) + innerMostScope = block->members(); } else { - if (CPlusPlus::Scope *functionScope = symbolAtLine->enclosingFunctionScope()) + if (const CPlusPlus::Scope *functionScope = symbolAtLine->enclosingFunctionScope()) { function = functionScope->owner()->asFunction(); + innerMostScope = symbolAtLine->isBlock() ? + symbolAtLine->asBlock()->members() : + symbolAtLine->enclosingBlockScope(); + } } - if (!function) + if (!function || !innerMostScope) return 7; // Compare function names with a bit off fuzz, // skipping modules from a CDB symbol "lib!foo" or namespaces @@ -388,13 +396,7 @@ int getUninitializedVariablesI(const CPlusPlus::Snapshot &snapshot, if (previousChar != ':' && previousChar != '!' ) return 11; } - // Starting from the innermost block scope, collect - // declarations. - const CPlusPlus::Scope *innerMostScope = hitFunction ? - symbolAtLine->asFunction()->members() : - symbolAtLine->enclosingBlockScope(); - if (!innerMostScope) - return 15; + // Starting from the innermost block scope, collect declarations. SeenHash seenHash; blockRecursion(overview, innerMostScope, line, uninitializedVariables, &seenHash); return 0; |