diff options
author | Tom Tromey <tromey@adacore.com> | 2023-06-14 08:31:21 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-07-10 13:17:30 -0600 |
commit | 4a1311ba0c46c673fd933375209da38e058982c6 (patch) | |
tree | 4488d1d6e2f3c019bd00f5bcb1ac34d765598b8c /gdb | |
parent | 70ef91c5aa0626f2aa1ab117b8bd5da4bc6a115f (diff) | |
download | gdb-4a1311ba0c46c673fd933375209da38e058982c6.zip gdb-4a1311ba0c46c673fd933375209da38e058982c6.tar.gz gdb-4a1311ba0c46c673fd933375209da38e058982c6.tar.bz2 |
Fix oversights in frame decorator code
The frame decorator "FrameVars" code misses a couple of cases,
discovered when working on related DAP changes.
First, fetch_frame_locals does not stop when reaching a function
boundary. This means it would return locals from any enclosing
functions.
Second, fetch_frame_args assumes that all arguments are at the
outermost scope, but this doesn't seem to be required by gdb.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/python/lib/gdb/FrameDecorator.py | 17 |
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 |