diff options
author | Tom Tromey <tromey@adacore.com> | 2023-10-30 10:23:35 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-11-14 08:49:55 -0700 |
commit | d31566acb7ee6ee8f6a726abe71740eb20a68874 (patch) | |
tree | 14eb206b09c39f4d2a07c64facae2f64d3dfd724 | |
parent | a3ca9693fff76ccddd60dbf00fd9a045726545f9 (diff) | |
download | binutils-d31566acb7ee6ee8f6a726abe71740eb20a68874.zip binutils-d31566acb7ee6ee8f6a726abe71740eb20a68874.tar.gz binutils-d31566acb7ee6ee8f6a726abe71740eb20a68874.tar.bz2 |
Fix a bug in DAP scopes code
While working on static links, I noticed that the DAP scopes code does
not handle the scenario where a frame decorator returns None. This
situation should be handled identically to a frame decorator returning
an empty iterator.
(cherry picked from commit e9dacb1d6caa5770d3e1722adc0ec74ff13a7a89)
-rw-r--r-- | gdb/python/lib/gdb/dap/scopes.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gdb/python/lib/gdb/dap/scopes.py b/gdb/python/lib/gdb/dap/scopes.py index 87f2ed7..13c3581 100644 --- a/gdb/python/lib/gdb/dap/scopes.py +++ b/gdb/python/lib/gdb/dap/scopes.py @@ -107,10 +107,14 @@ def _get_scope(id): else: frame = frame_for_id(id) scopes = [] - args = frame.frame_args() + # Make sure to handle the None case as well as the empty + # iterator case. + args = tuple(frame.frame_args() or ()) if args: scopes.append(_ScopeReference("Arguments", "arguments", frame, args)) - locs = frame.frame_locals() + # Make sure to handle the None case as well as the empty + # iterator case. + locs = tuple(frame.frame_locals() or ()) if locs: scopes.append(_ScopeReference("Locals", "locals", frame, locs)) scopes.append(_RegisterReference("Registers", frame)) |