public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug dap/30708] New: [gdb/dap] DAP support and python 3.4
@ 2023-07-31 16:43 vries at gcc dot gnu.org
  2023-07-31 18:08 ` [Bug dap/30708] " tromey at sourceware dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2023-07-31 16:43 UTC (permalink / raw)
  To: gdb-prs

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug dap/30708] [gdb/dap] DAP support and python 3.4
  2023-07-31 16:43 [Bug dap/30708] New: [gdb/dap] DAP support and python 3.4 vries at gcc dot gnu.org
@ 2023-07-31 18:08 ` tromey at sourceware dot org
  2023-07-31 19:21 ` vries at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2023-07-31 18:08 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Tom de Vries from comment #0)

> -    **args,
> +    **args

I suspect black will just add these back.

> -        raise Exception(f"Invalid exception filterID: {filterId}")
> +        raise Exception("Invalid exception filterID: %s" % filterId)

Sorry, I thought I got rid of all of these.

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

We can maybe work around this if it's important.

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

I wonder if any DAP client runs on whatever platform this is.

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug dap/30708] [gdb/dap] DAP support and python 3.4
  2023-07-31 16:43 [Bug dap/30708] New: [gdb/dap] DAP support and python 3.4 vries at gcc dot gnu.org
  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
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2023-07-31 19:21 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom Tromey from comment #1)
> > Maybe we should just require a higher python version for dap?
> 
> I wonder if any DAP client runs on whatever platform this is.

FTR, this is ubuntu 14.04.6 i686.

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug dap/30708] [gdb/dap] DAP support and python 3.4
  2023-07-31 16:43 [Bug dap/30708] New: [gdb/dap] DAP support and python 3.4 vries at gcc dot gnu.org
  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
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-02 15:22 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Something like this would work:
...
diff --git a/gdb/python/py-dap.c b/gdb/python/py-dap.c
index 52188406982..7289c5ec25c 100644
--- a/gdb/python/py-dap.c
+++ b/gdb/python/py-dap.c
@@ -91,8 +91,11 @@ void _initialize_py_interp ();
 void
 _initialize_py_interp ()
 {
+  /* Dap requires the types module, introduced in python 3.5.  */
+#if PY_VERSION_HEX >= 0x03050000
   interp_factory_register ("dap", [] (const char *name) -> interp *
     {
       return new dap_interp (name);
     });
+#endif
 }
...
and if there's a command to list available interpreters, we can check that one
in allow_dap_tests.

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug dap/30708] [gdb/dap] DAP support and python 3.4
  2023-07-31 16:43 [Bug dap/30708] New: [gdb/dap] DAP support and python 3.4 vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-02 17:24 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2023-August/201293.html

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug dap/30708] [gdb/dap] DAP support and python 3.4
  2023-07-31 16:43 [Bug dap/30708] New: [gdb/dap] DAP support and python 3.4 vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-02 21:15 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3c3e54d7b5f7da003292710fe810e670d45832d8

commit 3c3e54d7b5f7da003292710fe810e670d45832d8
Author: Tom de Vries <tdevries@suse.de>
Date:   Wed Aug 2 23:14:58 2023 +0200

    [gdb/dap] Disable DAP for python <= 3.5

    DAP requires python module typing, which is supported starting python 3.5.

    Make this formal by:
    - disabling the dap interpreter for python version < 3.5
    - returning 0 in allow_dap_tests for python version < 3.5

    Approved-By: Tom Tromey <tom@tromey.com>

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

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug dap/30708] [gdb/dap] DAP support and python 3.4
  2023-07-31 16:43 [Bug dap/30708] New: [gdb/dap] DAP support and python 3.4 vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-02 21:16 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.1
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed by commit.

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug dap/30708] [gdb/dap] DAP support and python 3.4
  2023-07-31 16:43 [Bug dap/30708] New: [gdb/dap] DAP support and python 3.4 vries at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-08-02 21:16 ` vries at gcc dot gnu.org
@ 2023-08-03 16:27 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-03 16:27 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #7 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5c9adb880eb1ed259007a376b305027d397948e8

commit 5c9adb880eb1ed259007a376b305027d397948e8
Author: Tom Tromey <tromey@adacore.com>
Date:   Thu Aug 3 10:25:18 2023 -0600

    Remove f-string from DAP

    One more f-string snuck into the DAP code, in breakpoint.py.  Most of
    them were removed here:

        https://sourceware.org/pipermail/gdb-patches/2023-June/200023.html

    but I think this one landed after that patch.

    While DAP only supports Python 3.5 and later, f-strings were added in
    3.6, so remove this.

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

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-08-03 16:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-31 16:43 [Bug dap/30708] New: [gdb/dap] DAP support and python 3.4 vries at gcc dot gnu.org
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

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).