public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH] Filter out types from DAP scopes request
Date: Mon, 10 Apr 2023 08:19:08 -0600	[thread overview]
Message-ID: <20230410141908.2921047-1-tromey@adacore.com> (raw)

The DAP scopes request examines the symbols in a block tree, but
neglects to omit types.  This patch fixes the problem.
---
 gdb/python/lib/gdb/dap/scopes.py |  2 +-
 gdb/testsuite/gdb.dap/scopes.c   | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/gdb/python/lib/gdb/dap/scopes.py b/gdb/python/lib/gdb/dap/scopes.py
index 9ab454aa57b..be4f8fc28a0 100644
--- a/gdb/python/lib/gdb/dap/scopes.py
+++ b/gdb/python/lib/gdb/dap/scopes.py
@@ -41,7 +41,7 @@ def _block_vars(block):
         for var in block:
             if var.is_argument:
                 args.append(var)
-            else:
+            elif var.is_variable or var.is_constant:
                 locs.append(var)
         if block.function is not None:
             break
diff --git a/gdb/testsuite/gdb.dap/scopes.c b/gdb/testsuite/gdb.dap/scopes.c
index 7b35036cce1..ce87db1f13d 100644
--- a/gdb/testsuite/gdb.dap/scopes.c
+++ b/gdb/testsuite/gdb.dap/scopes.c
@@ -15,14 +15,14 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-struct dei_struct
-{
-  int x;
-  int more[5];
-};
-
 int main ()
 {
+  struct dei_struct
+  {
+    int x;
+    int more[5];
+  };
+
   struct dei_struct dei = { 2, { 3, 5, 7, 11, 13 } };
 
   static int scalar = 23;
-- 
2.39.1


             reply	other threads:[~2023-04-10 14:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-10 14:19 Tom Tromey [this message]
2023-05-05 19:55 ` 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=20230410141908.2921047-1-tromey@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).