aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/python/lib/gdb/FrameDecorator.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/gdb/python/lib/gdb/FrameDecorator.py b/gdb/python/lib/gdb/FrameDecorator.py
index 6773780..7293be8 100644
--- a/gdb/python/lib/gdb/FrameDecorator.py
+++ b/gdb/python/lib/gdb/FrameDecorator.py
@@ -269,6 +269,11 @@ class FrameVars(object):
if self.fetch_b(sym):
lvars.append(SymValueWrapper(sym, None))
+ # Stop when the function itself is seen, to avoid showing
+ # variables from outer functions in a nested function.
+ if block.function is not None:
+ break
+
block = block.superblock
return lvars
@@ -286,14 +291,18 @@ class FrameVars(object):
block = None
while block is not None:
- if block.function is not None:
+ if block.is_global or block.is_static:
break
- block = block.superblock
-
- if block is not None:
for sym in block:
if not sym.is_argument:
continue
args.append(SymValueWrapper(sym, None))
+ # Stop when the function itself is seen, to avoid showing
+ # variables from outer functions in a nested function.
+ if block.function is not None:
+ break
+
+ block = block.superblock
+
return args