public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug server/24751] doc: Can 'm' return partial read?
       [not found] <bug-24751-4717@http.sourceware.org/bugzilla/>
@ 2024-03-14 12:32 ` tankut.baris.aktemur at intel dot com
  2024-03-15 11:58 ` labath at google dot com
  1 sibling, 0 replies; 2+ messages in thread
From: tankut.baris.aktemur at intel dot com @ 2024-03-14 12:32 UTC (permalink / raw)
  To: gdb-prs

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

Baris Aktemur <tankut.baris.aktemur at intel dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tankut.baris.aktemur@intel.
                   |                            |com

--- Comment #1 from Baris Aktemur <tankut.baris.aktemur at intel dot com> ---
The `gdb_read_memory` function's comment reads

```
/* Read trace frame or inferior memory.  Returns the number of bytes
   actually read, zero when no further transfer is possible, and -1 on
   error.  Return of a positive value smaller than LEN does not
   indicate there's no more to be read, only the end of the transfer.
   E.g., when GDB reads memory from a traceframe, a first request may
   be served from a memory block that does not cover the whole request
   length.  A following request gets the rest served from either
   another block (of the same traceframe) or from the read-only
   regions.  */
```

The code that's about the traceframe is

```
      if (traceframe_read_mem (cs.current_traceframe,
                               memaddr, myaddr, len, &nbytes))
        return -1;
      /* Data read from trace buffer, we're done.  */
      if (nbytes > 0)
        return nbytes;
```

I checked the code of `traceframe_read_mem`.  It may indeed return a partial
result, indicated in `nbytes` above.

Based on these, the function comment and the documentation seem mostly accurate
to me.  If the documentation is updated as follows, would it be better?

"The reply may contain fewer addressable memory units than requested if the
server read from a traceframe and was able to read only part of the region of
memory."

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

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

* [Bug server/24751] doc: Can 'm' return partial read?
       [not found] <bug-24751-4717@http.sourceware.org/bugzilla/>
  2024-03-14 12:32 ` [Bug server/24751] doc: Can 'm' return partial read? tankut.baris.aktemur at intel dot com
@ 2024-03-15 11:58 ` labath at google dot com
  1 sibling, 0 replies; 2+ messages in thread
From: labath at google dot com @ 2024-03-15 11:58 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Pavel Labath <labath at google dot com> ---
I think the existing documentation is pretty clear -- if that is indeed what
it's trying to say. Our confusion was coming from the fact that this does not
match existing gdbserver behavior (note that there is no mapping for
0x555555561000 in this example):

(gdb) maintenance packet m555555560ff0,10
sending: m555555560ff0,10
received: "00000000000000000000000000000000"
(gdb) maintenance packet m555555560ff0,11
sending: m555555560ff0,11
received: "E01"

The gdbserver is not necessarily wrong here (the documentations says it "may"
return fewer bytes), but:
- gdbserver is kind of the reference implementation for the protocol, and iirc
we filed this bug when we were looking at whether lldb's implementation is
compatible with that
- This behavior does not seem particularly useful, because it makes it hard for
the client to read everything up to the end of addressable memory (upon getting
an error, it would have to do a binary search or something to make sure it
really got everything).

So if the "specification" really does allow the server to return partial data,
then I think the question becomes: "Why doesn't gdbserver do that"?

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

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

end of thread, other threads:[~2024-03-15 11:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-24751-4717@http.sourceware.org/bugzilla/>
2024-03-14 12:32 ` [Bug server/24751] doc: Can 'm' return partial read? tankut.baris.aktemur at intel dot com
2024-03-15 11:58 ` labath at google dot com

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