public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 5/7] Fix a bug in DAP scopes code
Date: Wed, 01 Nov 2023 11:09:37 -0600	[thread overview]
Message-ID: <20231101-dap-nested-function-v1-5-0b0c3b228ac7@adacore.com> (raw)
In-Reply-To: <20231101-dap-nested-function-v1-0-0b0c3b228ac7@adacore.com>

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.
---
 gdb/python/lib/gdb/dap/scopes.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gdb/python/lib/gdb/dap/scopes.py b/gdb/python/lib/gdb/dap/scopes.py
index 87f2ed7547f..13c35817fb6 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))

-- 
2.40.1


  parent reply	other threads:[~2023-11-01 17:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-01 17:09 [PATCH 0/7] Handle nested functions in DAP Tom Tromey
2023-11-01 17:09 ` [PATCH 1/7] Add two convenience methods to block Tom Tromey
2023-11-01 17:09 ` [PATCH 2/7] Add block::function_block Tom Tromey
2023-11-01 17:09 ` [PATCH 3/7] Move follow_static_link to frame.c Tom Tromey
2023-11-01 17:09 ` [PATCH 4/7] Add gdb.Frame.static_link method Tom Tromey
2023-11-01 17:17   ` Eli Zaretskii
2023-11-01 17:09 ` Tom Tromey [this message]
2023-11-01 17:09 ` [PATCH 6/7] Handle the static link in FrameDecorator Tom Tromey
2023-11-15 12:31   ` Tom de Vries
2023-11-15 13:58     ` Tom Tromey
2023-11-15 14:07       ` Tom de Vries
2023-11-15 14:58         ` Tom Tromey
2023-11-01 17:09 ` [PATCH 7/7] Update gdb.Symbol.is_variable documentation Tom Tromey
2023-11-01 17:15   ` Eli Zaretskii
2023-11-14 15:39 ` [PATCH 0/7] Handle nested functions in DAP Tom Tromey
2023-11-14 16:11   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231101-dap-nested-function-v1-5-0b0c3b228ac7@adacore.com \
    --to=tromey@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).