Fix typo in gdb "explore" documentation

Message ID CAPEe5NU5qAbMXiTeaqcM8ycYGFyXq3SDbTgMajX4No419+Zraw@mail.gmail.com
State New, archived
Headers

Commit Message

Mike Percy Jan. 13, 2017, 2:58 a.m. UTC
  Hello,
I have a small gdb.texinfo patch to fix a typo that I noticed when
perusing the "explore" documentation.

Regards,
Mike


commit 6a722aea3357163b770c0e92fec6a71e4a1a62c5
Author: Mike Percy <mpercy@gmail.com>
Date:   Thu Jan 12 18:46:48 2017 -0800

    Fix typo in gdb "explore" documentation

    The value of index 5 = 5 in this example.

    Verified locally in gdb 7.11.1 on Ubuntu xenial.

 @end smallexample
  

Comments

Pedro Alves Jan. 19, 2017, 11:41 a.m. UTC | #1
Hi Mike,

On 01/13/2017 02:58 AM, Mike Percy wrote:

>         * gdb.texinfo (Contributors): Add SRI International and University
> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index 2b6b654..b60643d 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -8687,7 +8687,7 @@ Enter the index of the element you want to
> explore in `cs.arr': 5
> 
>  `(cs.arr)[5]' is a scalar value of type `int'.
> 
> -(cs.arr)[5] = 4
> +(cs.arr)[5] = 5

I agree there's a typo here.  Though, I think the example
would read a little bit better if we make the array's value at
index 5 be != from "5".  Otherwise, it's a "wall of 5"s, and it
may be a bit confusing.

So I would suggest to instead change the arrays values
to keep that property.  E.g.,:

- struct ComplexStruct cs = { &ss, { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } };
+ struct ComplexStruct cs = { &ss, { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 } };

> -(cs.arr)[5] = 4
> +(cs.arr)[5] = 10

WDYT?

Thanks,
Pedro Alves
  

Patch

diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 4c6e718..5b60267 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,7 @@ 
+2017-01-12  Mike Percy  <mpercy@gmail.com>
+
+       * gdb.texinfo (Examining Data): Correct typo in "explore" example.
+
 2017-01-04  John Baldwin  <jhb@FreeBSD.org>

        * gdb.texinfo (Contributors): Add SRI International and University
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 2b6b654..b60643d 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -8687,7 +8687,7 @@  Enter the index of the element you want to
explore in `cs.arr': 5

 `(cs.arr)[5]' is a scalar value of type `int'.

-(cs.arr)[5] = 4
+(cs.arr)[5] = 5

 Press enter to return to parent value: