diff mbox

[v2,3/7] Clarify doc about memory read/write and non-8-bits addressable memory unit sizes

Message ID 557B40D5.1050204@ericsson.com
State New
Headers show

Commit Message

Simon Marchi June 12, 2015, 8:28 p.m. UTC
On 15-04-16 10:48 AM, Eli Zaretskii wrote:
> This patch is fine with me, thanks.

Hi Eli,

I added some bits in the Remote Protocol section following the discussion
with Pedro, could you review them? The existing ones are the same.

Thanks!

Simon


From e12f34e5cbfde7861c0f5b4219c31dd27f36ec12 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@ericsson.com>
Date: Thu, 26 Mar 2015 15:04:40 -0400
Subject: [PATCH] Clarify doc about memory read/write and non-8-bits
 addressable memory unit sizes

New in v3:

 * Change RSP documentation as well. The m, M and X packets now use
 lengths in addressable memory units.

New in v2:

 * Change wording: use byte for 8-bits chunks and addressable memory unit
   for the unit of data associated to a single address.
 * Introduce definition of addressable memory unit in the Memory
   section.

This patch modifies the manual to clarify the MI, RSP and Python APIs in
regard to reading/writing memory on architectures with addressable
memory unit that are not 8 bits.

Care is taken to use the word "addressable memory unit" or "memory unit"
when referring to one piece of the smallest addressable size on the
current architecture and the word "byte" when referring to an 8-bits
data piece.

For MI, -data-{read,write}-memory are not modified, since they are
deprecated.

gdb/doc/ChangeLog:

	* gdb.texinfo (GDB/MI Data Manipulation): Clarify usage of
	bytes and memory units for -data-{read,write}-memory-bytes.
	(Packets): Same for m, M and X packets.
	* python.texi (Inferiors In Python): Same for read_memory and
	write_memory.
---
 gdb/doc/gdb.texinfo | 74 ++++++++++++++++++++++++++++++++++-------------------
 gdb/doc/python.texi |  5 ++--
 2 files changed, 50 insertions(+), 29 deletions(-)

Comments

Eli Zaretskii June 13, 2015, 6:49 a.m. UTC | #1
> Date: Fri, 12 Jun 2015 16:28:05 -0400
> From: Simon Marchi <simon.marchi@ericsson.com>
> CC: <gdb-patches@sourceware.org>
> 
> On 15-04-16 10:48 AM, Eli Zaretskii wrote:
> > This patch is fine with me, thanks.
> 
> Hi Eli,
> 
> I added some bits in the Remote Protocol section following the discussion
> with Pedro, could you review them?

Below.

> +@anchor{addressable memory unit}
> +@cindex addressable memory unit
> +Most targets have an addressable memory unit size of 8 bits.  This means
> +that to each memory address are associated 8 bits of data.  Some
> +targets, however, have other addressable memory unit sizes.
> +Within @value{GDBN} and this document, the term
> +@dfn{addressable memory unit} (or @dfn{memory unit} for short) is used
> +when explicitely referring to a chunk of data of that size.  The word
        ^^^^^^^^^^^
"explicitly"

> +Read @var{length} addressable memory units starting at address @var{addr}
> +(@pxref{addressable memory unit}). Note that @var{addr} may not be aligned to
> +any particular boundary.         ^^

Two spaces between sentences, please.

> +Write @var{length} addressable memory units starting at address @var{addr}
> +(@pxref{addressable memory unit}). The data is given by @var{XX@dots{}}; each
                                    ^^
Likewise.

Thanks.
diff mbox

Patch

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 65c9d4f..dc8a6c9 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -9009,6 +9009,18 @@  If the @code{x} command has a repeat count, the address and contents saved
 are from the last memory unit printed; this is not the same as the last
 address printed if several units were printed on the last line of output.

+@anchor{addressable memory unit}
+@cindex addressable memory unit
+Most targets have an addressable memory unit size of 8 bits.  This means
+that to each memory address are associated 8 bits of data.  Some
+targets, however, have other addressable memory unit sizes.
+Within @value{GDBN} and this document, the term
+@dfn{addressable memory unit} (or @dfn{memory unit} for short) is used
+when explicitely referring to a chunk of data of that size.  The word
+@dfn{byte} is used to refer to a chunk of data of 8 bits, regardless of
+the addressable memory unit size of the target.  For most systems,
+addressable memory unit is a synonym of byte.
+
 @cindex remote memory comparison
 @cindex target memory comparison
 @cindex verify remote memory image
@@ -29572,6 +29584,9 @@  can be used to instantiate this class for a varobj:
 This section describes the @sc{gdb/mi} commands that manipulate data:
 examine memory and registers, evaluate expressions, etc.

+For details about what an addressable memory unit is,
+@pxref{addressable memory unit}.
+
 @c REMOVED FROM THE INTERFACE.
 @c @subheading -data-assign
 @c Change the value of a program variable. Plenty of side effects.
@@ -30096,7 +30111,7 @@  next-page="0x000013c0",prev-page="0x00001380",memory=[
 @subsubheading Synopsis

 @smallexample
- -data-read-memory-bytes [ -o @var{byte-offset} ]
+ -data-read-memory-bytes [ -o @var{offset} ]
    @var{address} @var{count}
 @end smallexample

@@ -30105,18 +30120,19 @@  where:

 @table @samp
 @item @var{address}
-An expression specifying the address of the first memory word to be
-read.  Complex expressions containing embedded white space should be
+An expression specifying the address of the first addressable memory unit
+to be read.  Complex expressions containing embedded white space should be
 quoted using the C convention.

 @item @var{count}
-The number of bytes to read.  This should be an integer literal.
+The number of addressable memory units to read.  This should be an integer
+literal.

-@item @var{byte-offset}
-The offsets in bytes relative to @var{address} at which to start
-reading.  This should be an integer literal.  This option is provided
-so that a frontend is not required to first evaluate address and then
-perform address arithmetics itself.
+@item @var{offset}
+The offset relative to @var{address} at which to start reading.  This
+should be an integer literal.  This option is provided so that a frontend
+is not required to first evaluate address and then perform address
+arithmetics itself.

 @end table

@@ -30127,10 +30143,10 @@  Attributes}.  Second, @value{GDBN} will attempt to read the remaining
 regions.  For each one, if reading full region results in an errors,
 @value{GDBN} will try to read a subset of the region.

-In general, every single byte in the region may be readable or not,
-and the only way to read every readable byte is to try a read at
+In general, every single memory unit in the region may be readable or not,
+and the only way to read every readable unit is to try a read at
 every address, which is not practical.   Therefore, @value{GDBN} will
-attempt to read all accessible bytes at either beginning or the end
+attempt to read all accessible memory units at either beginning or the end
 of the region, using a binary division scheme.  This heuristic works
 well for reading accross a memory map boundary.  Note that if a region
 has a readable range that is neither at the beginning or the end,
@@ -30190,17 +30206,19 @@  where:

 @table @samp
 @item @var{address}
-An expression specifying the address of the first memory word to be
-written.  Complex expressions containing embedded white space should be
-quoted using the C convention.
+An expression specifying the address of the first addressable memory unit
+to be written.  Complex expressions containing embedded white space should
+be quoted using the C convention.

 @item @var{contents}
-The hex-encoded bytes to write.
+The hex-encoded data to write.  It is an error if @var{contents} does
+not represent an integral number of addressable memory units.

 @item @var{count}
-Optional argument indicating the number of bytes to be written.  If @var{count}
-is greater than @var{contents}' length, @value{GDBN} will repeatedly
-write @var{contents} until it fills @var{count} bytes.
+Optional argument indicating the number of addressable memory units to be
+written.  If @var{count} is greater than @var{contents}' length,
+@value{GDBN} will repeatedly write @var{contents} until it fills
+@var{count} memory units.

 @end table

@@ -34835,8 +34853,9 @@  probes the target state as if a new connection was opened

 @item m @var{addr},@var{length}
 @cindex @samp{m} packet
-Read @var{length} bytes of memory starting at address @var{addr}.
-Note that @var{addr} may not be aligned to any particular boundary.
+Read @var{length} addressable memory units starting at address @var{addr}
+(@pxref{addressable memory unit}). Note that @var{addr} may not be aligned to
+any particular boundary.

 The stub need not use any particular size or alignment when gathering
 data from memory for the response; even if @var{addr} is word-aligned
@@ -34850,8 +34869,8 @@  suitable for accessing memory-mapped I/O devices.
 Reply:
 @table @samp
 @item @var{XX@dots{}}
-Memory contents; each byte is transmitted as a two-digit hexadecimal
-number.  The reply may contain fewer bytes than requested if the
+Memory contents; each byte is transmitted as a two-digit hexadecimal number.
+The reply may contain fewer addressable memory units than requested if the
 server was able to read only part of the region of memory.
 @item E @var{NN}
 @var{NN} is errno
@@ -34859,9 +34878,9 @@  server was able to read only part of the region of memory.

 @item M @var{addr},@var{length}:@var{XX@dots{}}
 @cindex @samp{M} packet
-Write @var{length} bytes of memory starting at address @var{addr}.
-The data is given by @var{XX@dots{}}; each byte is transmitted as a two-digit
-hexadecimal number.
+Write @var{length} addressable memory units starting at address @var{addr}
+(@pxref{addressable memory unit}). The data is given by @var{XX@dots{}}; each
+byte is transmitted as a two-digit hexadecimal number.

 Reply:
 @table @samp
@@ -35175,7 +35194,8 @@  for success (@pxref{Stop Reply Packets})
 @anchor{X packet}
 @cindex @samp{X} packet
 Write data to memory, where the data is transmitted in binary.
-Memory is specified by its address @var{addr} and number of bytes @var{length};
+Memory is specified by its address @var{addr} and number of addressable memory
+units @var{length} (@pxref{addressable memory unit});
 @samp{@var{XX}@dots{}} is binary data (@pxref{Binary Data}).

 Reply:
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index 57ec22e..a2df254 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -2749,7 +2749,7 @@  return an empty tuple.

 @findex Inferior.read_memory
 @defun Inferior.read_memory (address, length)
-Read @var{length} bytes of memory from the inferior, starting at
+Read @var{length} addressable memory units from the inferior, starting at
 @var{address}.  Returns a buffer object, which behaves much like an array
 or a string.  It can be modified and given to the
 @code{Inferior.write_memory} function.  In @code{Python} 3, the return
@@ -2762,7 +2762,8 @@  Write the contents of @var{buffer} to the inferior, starting at
 @var{address}.  The @var{buffer} parameter must be a Python object
 which supports the buffer protocol, i.e., a string, an array or the
 object returned from @code{Inferior.read_memory}.  If given, @var{length}
-determines the number of bytes from @var{buffer} to be written.
+determines the number of addressable memory units from @var{buffer} to be
+written.
 @end defun

 @findex gdb.search_memory