public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug dap/30708] New: [gdb/dap] DAP support and python 3.4
Date: Mon, 31 Jul 2023 16:43:45 +0000	[thread overview]
Message-ID: <bug-30708-4717@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=30708

            Bug ID: 30708
           Summary: [gdb/dap] DAP support and python 3.4
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dap
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

I ran the gdb.dap tests on a system with python 3.4, and ran into a couple of
syntax error issues, which are fixed by:
...
diff --git a/gdb/python/lib/gdb/dap/breakpoint.py
b/gdb/python/lib/gdb/dap/breakpoint.py
index 27745eb..a6465e2 100644
--- a/gdb/python/lib/gdb/dap/breakpoint.py
+++ b/gdb/python/lib/gdb/dap/breakpoint.py
@@ -199,7 +199,7 @@ def _rewrite_src_breakpoint(
     condition: Optional[str] = None,
     hitCondition: Optional[str] = None,
     logMessage: Optional[str] = None,
-    **args,
+    **args
 ):
     return {
         "source": source["path"],
@@ -238,7 +238,7 @@ def _rewrite_fn_breakpoint(
     name: str,
     condition: Optional[str] = None,
     hitCondition: Optional[str] = None,
-    **args,
+    **args
 ):
     return {
         "function": name,
@@ -267,7 +267,7 @@ def _rewrite_insn_breakpoint(
     offset: Optional[int] = None,
     condition: Optional[str] = None,
     hitCondition: Optional[str] = None,
-    **args,
+    **args
 ):
     # There's no way to set an explicit address breakpoint from
     # Python, so we rely on "spec" instead.
@@ -300,7 +300,7 @@ def _catch_exception(filterId, **args):
     elif filterId == "exception":
         cmd = "-catch-exception"
     else:
-        raise Exception(f"Invalid exception filterID: {filterId}")
+        raise Exception("Invalid exception filterID: %s" % filterId)
     result = gdb.execute_mi(cmd)
     # A little lame that there's no more direct way.
     for bp in gdb.breakpoints():
@@ -323,7 +323,7 @@ def _rewrite_exception_breakpoint(
     filterId: str,
     condition: Optional[str] = None,
     # Note that exception breakpoints do not support a hit count.
-    **args,
+    **args
 ):
     return {
         "filterId": filterId,
diff --git a/gdb/python/lib/gdb/dap/evaluate.py
b/gdb/python/lib/gdb/dap/evaluate.py
index 63e8033..9622f3c 100644
--- a/gdb/python/lib/gdb/dap/evaluate.py
+++ b/gdb/python/lib/gdb/dap/evaluate.py
@@ -95,7 +95,7 @@ def eval_request(
     expression: str,
     frameId: Optional[int] = None,
     context: str = "variables",
-    **args,
+    **args
 ):
     if context in ("watch", "variables"):
         # These seem to be expression-like.
...

But then we run into the use of module typing, which is available starting
version 3.5.

Commit 510586589e7 ("Add type-checking to DAP requests") says:
...
    I've tried to make this code compatible with older versions of Python,
    but I've only been able to try it with 3.9 and 3.10.
...

Its use is extensive:
...
breakpoint.py:21:from typing import Optional, Sequence
evaluate.py:19:from typing import Optional
launch.py:19:from typing import Mapping, Optional, Sequence
locations.py:19:from typing import Optional
typecheck.py:20:import typing
...

Maybe we should just require a higher python version for dap?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2023-07-31 16:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-31 16:43 vries at gcc dot gnu.org [this message]
2023-07-31 18:08 ` [Bug dap/30708] " tromey at sourceware dot org
2023-07-31 19:21 ` vries at gcc dot gnu.org
2023-08-02 15:22 ` vries at gcc dot gnu.org
2023-08-02 17:24 ` vries at gcc dot gnu.org
2023-08-02 21:15 ` cvs-commit at gcc dot gnu.org
2023-08-02 21:16 ` vries at gcc dot gnu.org
2023-08-03 16:27 ` cvs-commit at gcc dot gnu.org

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=bug-30708-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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).