Update the 'g' packet documentation

Message ID 20230111183725.2902496-1-tromey@adacore.com
State New
Headers
Series Update the 'g' packet documentation |

Commit Message

Tom Tromey Jan. 11, 2023, 6:37 p.m. UTC
  The 'g' packet documentation references a macro that no longer exists,
and it also claims that the 'x' response for an unavailable register
is limited to trace frames.  This patch updates the documentation to
reflect what I think is currently correct.
---
 gdb/doc/gdb.texinfo | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
  

Comments

Eli Zaretskii Jan. 11, 2023, 7:56 p.m. UTC | #1
> Cc: Tom Tromey <tromey@adacore.com>
> Date: Wed, 11 Jan 2023 11:37:25 -0700
> From: Tom Tromey via Gdb-patches <gdb-patches@sourceware.org>
> 
> The 'g' packet documentation references a macro that no longer exists,
> and it also claims that the 'x' response for an unavailable register
> is limited to trace frames.  This patch updates the documentation to
> reflect what I think is currently correct.
> ---
>  gdb/doc/gdb.texinfo | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)

OK, thanks.
  
Pedro Alves Jan. 13, 2023, 12:09 p.m. UTC | #2
Hi Tom,

On 2023-01-11 6:37 p.m., Tom Tromey via Gdb-patches wrote:
> The 'g' packet documentation references a macro that no longer exists,
> and it also claims that the 'x' response for an unavailable register
> is limited to trace frames.  This patch updates the documentation to
> reflect what I think is currently correct.
> ---
>  gdb/doc/gdb.texinfo | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index 9c0018ea5c1..80584241870 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -41318,11 +41318,12 @@ Reply:
>  Each byte of register data is described by two hex digits.  The bytes
>  with the register are transmitted in target byte order.  The size of
>  each register and their position within the @samp{g} packet are
> -determined by the @value{GDBN} internal gdbarch functions
> -@code{DEPRECATED_REGISTER_RAW_SIZE} and @code{gdbarch_register_name}.
> +determined by the target description (@pxref{Target Descriptions}); in
> +the absence of a target description, this is done using code internal
> +to @value{GDBN}; typically this is some customary register layout for
> +the architecture in question.
>  

This part seems fine.

> -When reading registers from a trace frame (@pxref{Analyze Collected
> -Data,,Using the Collected Data}), the stub may also return a string of
> +When reading registers, the stub may also return a string of
>  literal @samp{x}'s in place of the register data digits, to indicate
>  that the corresponding register has not been collected, thus its value
>  is unavailable.  For example, for an architecture with 4 registers of
> 

Here, the new text still uses "collected", but lost the reference to trace frames.
It seems to me that that will result in people not knowing what "collected"
means in this context.  I suggest flipping things around a little, like:

 When reading registers, the stub may also return a string of
 literal @samp{x}'s in place of the register data digits, to indicate
 that the corresponding register's value is unavailable.  For example,
 when reading registers from a trace frame (@pxref{Analyze Collected
 Data,,Using the Collected Data}), this means that the register has
 not been collected.

and then the following sentence, where it reads

 For example, for an architecture with 4 registers of
 4 bytes each, the following reply indicates to @value{GDBN} that
 registers 0 and 2 have not been collected, while registers 1 and 3
 have been collected, and both have zero value:

it may be better to tweak it to say something like:

 For example, for an architecture with 4 registers of
 4 bytes each, the following reply indicates to @value{GDBN} that
 registers 0 and 2 are unavailable, while registers 1 and 3
 are available, and both have zero value:
  
Tom Tromey Jan. 13, 2023, 6:58 p.m. UTC | #3
>> -When reading registers from a trace frame (@pxref{Analyze Collected
>> -Data,,Using the Collected Data}), the stub may also return a string of
>> +When reading registers, the stub may also return a string of
>> literal @samp{x}'s in place of the register data digits, to indicate
>> that the corresponding register has not been collected, thus its value
>> is unavailable.  For example, for an architecture with 4 registers of
>> 

Pedro> Here, the new text still uses "collected", but lost the reference to trace frames.
Pedro> It seems to me that that will result in people not knowing what "collected"
Pedro> means in this context.

Yeah, I wanted to get rid of the trace frame note, because it's
confusing -- 'x' can be sent any time, not just a trace frame.

Tom
  

Patch

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 9c0018ea5c1..80584241870 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -41318,11 +41318,12 @@  Reply:
 Each byte of register data is described by two hex digits.  The bytes
 with the register are transmitted in target byte order.  The size of
 each register and their position within the @samp{g} packet are
-determined by the @value{GDBN} internal gdbarch functions
-@code{DEPRECATED_REGISTER_RAW_SIZE} and @code{gdbarch_register_name}.
+determined by the target description (@pxref{Target Descriptions}); in
+the absence of a target description, this is done using code internal
+to @value{GDBN}; typically this is some customary register layout for
+the architecture in question.
 
-When reading registers from a trace frame (@pxref{Analyze Collected
-Data,,Using the Collected Data}), the stub may also return a string of
+When reading registers, the stub may also return a string of
 literal @samp{x}'s in place of the register data digits, to indicate
 that the corresponding register has not been collected, thus its value
 is unavailable.  For example, for an architecture with 4 registers of