-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[gdbremote] Document MultiMemRead packet in protocol extensions #162675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[gdbremote] Document MultiMemRead packet in protocol extensions #162675
Conversation
This adds a specification for the new packet discussed in the RFC [1]. [1]: https://discourse.llvm.org/t/rfc-a-new-vectorized-memory-read-packet/88441/12
@llvm/pr-subscribers-lldb Author: Felipe de Azevedo Piovezan (felipepiovezan) ChangesThis adds a specification for the new packet discussed in the RFC 1. Full diff: https://github.com/llvm/llvm-project/pull/162675.diff 1 Files Affected:
diff --git a/lldb/docs/resources/lldbgdbremote.md b/lldb/docs/resources/lldbgdbremote.md
index 36b95f1073ebc..d5e42890e14b1 100644
--- a/lldb/docs/resources/lldbgdbremote.md
+++ b/lldb/docs/resources/lldbgdbremote.md
@@ -2530,3 +2530,41 @@ read packet: $e0030100#b9
**Priority to Implement:** Only required for Wasm support. Necessary to show
variables.
+
+### MultiMemRead
+
+Read memory from multiple memory addresses.
+
+There are two arguments to the request:
+
+* `ranges`: a list of base-16 pairs of numbers. Each pair is separated by a
+`,`, as is each number in the pair. The first number of the pair denotes the
+base address of the memory read, the second denotes the number of bytes to be
+read.
+* `options`: an optional string of options. If present, it may be empty. If
+present, it is the last argument of the request.
+
+Both arguments must end with a `;`.
+
+The reply packet starts with a comma-separated list of base-16 numbers,
+denoting how many bytes were read from each address, followed by a `;`,
+followed by a sequence of bytes containing the memory data. The length of this
+sequence must be equal to the sum of the numbers provided at the start of the
+reply.
+
+If the stub is unable to read from any individual address, it should return a
+length of "zero" for that address in the reply packet.
+
+A stub that supports this packet should return `MultiMemRead+` in the reply to
+`qSupported`.
+
+```
+send packet: $MultiMemRead:ranges:100a00,4,200200,a0,400000,4;
+read packet: $4,0,2;<binary encoding of abcd1000><binary encoding of eeff>
+```
+
+In the example above, the first read produced `abcd1000`, the read of `a0`
+bytes from address `200200` failed, and the third read produced two bytes –
+`eeff` – out of the four requested.
+
+**Priority to Implement:** Only required for performance.
|
I chatted with Felipe. I hadn't followed the original RFC very well after it went up and missed the discussion about an Extensibility can come in two forms: adding additional behaviors, or changing existing behaviors. The gdb remote serial protocol packets with key-value pairs or JSON arguments can add additional behaviors well. They do not handle changing existing behaviors well -- or at all, usually, without adding some additional hint like in An example of where this has been a problem in the past would be the The documentation here (and impementation in the other PR) are trying to use the In short, this is a versioning field. If we want to do this, we might as well stick a And as a far less important aside, don't hardcode the order of key-values. It's a dictionary/map/hash/KV array, order is not significant. |
I think we should remove this field entirely and let extensions be done through extra information in the reply to qSupported |
e3ee436
to
5acd418
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed review comments. Please have a look again!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me with the edits, but David's feedback was more critical, I'd like to get his sign-off.
lldb/docs/resources/lldbgdbremote.md
Outdated
If an entire range is not readable, the stub may perform a partial read of a | ||
prefix of the range. | ||
If the stub is unable to read any bytes from a particular range, it must return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit ambiguous because "unable to read any" could mean they all failed or just one.
You need a way to say "if by applying the rules above, the stub has read 0 bytes from the range...".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I'm the one that said to say "any" but I was wrong :) Zero is clearer.
Addressed review comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This adds a specification for the new packet discussed in the RFC 1.