From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [pushed] Report supportsBreakpointLocationsRequest
Date: Thu, 27 Jul 2023 10:35:59 -0600 [thread overview]
Message-ID: <20230727163559.2459578-1-tromey@adacore.com> (raw)
While looking at the DAP spec, I noticed that the breakpointLocations
request is gated behind a capability. This patch changes gdb to
report this capability.
I've also added a comment to explain the fact that arguments to
breakpointLocations are not optional, even though the spec says they
are.
---
gdb/python/lib/gdb/dap/locations.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/gdb/python/lib/gdb/dap/locations.py b/gdb/python/lib/gdb/dap/locations.py
index 6c591579920..594f1bad45b 100644
--- a/gdb/python/lib/gdb/dap/locations.py
+++ b/gdb/python/lib/gdb/dap/locations.py
@@ -18,7 +18,7 @@ import gdb
# This is deprecated in 3.9, but required in older versions.
from typing import Optional
-from .server import request
+from .server import capability, request
from .startup import in_gdb_thread, send_gdb_with_response
@@ -32,7 +32,15 @@ def _find_lines(filename, start_line, end_line):
return {"breakpoints": [{"line": x} for x in sorted(lines)]}
+# Note that the spec says that the arguments to this are optional.
+# However, calling this without arguments is nonsensical. This is
+# discussed in:
+# https://github.com/microsoft/debug-adapter-protocol/issues/266
+# This points out that fixing this would be an incompatibility but
+# goes on to propose "if arguments property is missing, debug adapters
+# should return an error".
@request("breakpointLocations")
+@capability("supportsBreakpointLocationsRequest")
def breakpoint_locations(*, source, line: int, endLine: Optional[int] = None, **extra):
if endLine is None:
endLine = line
--
2.40.1
reply other threads:[~2023-07-27 16:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230727163559.2459578-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).