[PATCH 0/2] Changes to show architecture/endian message

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 0/2] Changes to show architecture/endian message

Andrew Burgess
I was recently debugging some issues around architecture selection so
had cause to use the 'show architecture' command.

The output from this command seemed ... not ideal to me, for example:

  (gdb) set architecture mips
  The target architecture is assumed to be mips
  (gdb) show architecture
  The target architecture is assumed to be mips
  (gdb)

I don't like the use of 'assumed to be', this (to me) seems to imply
that GDB is making some assumptions on the users behalf.  Even if we
interpret this to mean, GDB is assuming because the user told it, I
don't know why we don't just say:

  (gdb) set architecture mips
  The target architecture is set to "mips".
  (gdb) show architecture
  The target architecture is set to "mips".
  (gdb)

Just say what you mean, the architecture was set to this value.

So, I made this and some other clean ups to the 'show architecture'
output.

Then while I was testing this I noticed that 'show endian' is
basically the same, so I changed that in a similar way.

Does the new output seem like an improvement to anyone else?  Or does
anyone else prefer the old output?

Thanks,
Andrew


---

Andrew Burgess (2):
  gdb: Improve formatting of 'show architecture' messages
  gdb: Improve formatting of 'show endian' messages

 gdb/ChangeLog                                 |  4 +++
 gdb/arch-utils.c                              | 14 ++++----
 gdb/testsuite/ChangeLog                       |  8 +++++
 gdb/testsuite/gdb.arch/amd64-osabi.exp        |  2 +-
 .../gdb.base/all-architectures.exp.tcl        |  6 ++--
 gdb/testsuite/gdb.base/attach-pie-noexec.exp  |  4 +--
 gdb/testsuite/gdb.base/catch-syscall.exp      |  4 +--
 gdb/testsuite/gdb.base/endian.exp             | 34 +++++++++----------
 gdb/testsuite/gdb.xml/tdesc-arch.exp          |  6 ++--
 9 files changed, 47 insertions(+), 35 deletions(-)

--
2.25.4

Reply | Threaded
Open this post in threaded view
|

[PATCH 1/2] gdb: Improve formatting of 'show architecture' messages

Andrew Burgess
This commit changes the output of 'show architecture'.  Here is a
session before this commit:

  (gdb) show architecture
  The target architecture is set automatically (currently i386)
  (gdb) set architecture mips
  The target architecture is assumed to be mips
  (gdb) show architecture
  The target architecture is assumed to be mips
  (gdb)

After this commit the session now looks like this:

  (gdb) show architecture
  The target architecture is set to "auto" (currently i386).
  (gdb) set architecture mips
  The target architecture is set to "mips".
  (gdb) show architecture
  The target architecture is set to "mips".
  (gdb)

The changes are:

  1. The value is now enclosed in quotes,
  2. Each line ends with '.', and
  3. After setting the architecture GDB is now a little more
  assertive; 'architecture is set to' not 'is assumed to be', the user
  did just tell us after all!

gdb/ChangeLog:

        * arch-utils.c (show_architecture): Update formatting of messages.

gdb/testsuite/ChangeLog:

        * gdb.arch/amd64-osabi.exp: Update.
        * gdb.base/all-architectures.exp.tcl: Update.
        * gdb.base/attach-pie-noexec.exp: Update.
        * gdb.base/catch-syscall.exp: Update.
        * gdb.xml/tdesc-arch.exp: Update.
---
 gdb/ChangeLog                                    | 4 ++++
 gdb/arch-utils.c                                 | 6 +++---
 gdb/testsuite/ChangeLog                          | 8 ++++++++
 gdb/testsuite/gdb.arch/amd64-osabi.exp           | 2 +-
 gdb/testsuite/gdb.base/all-architectures.exp.tcl | 2 +-
 gdb/testsuite/gdb.base/attach-pie-noexec.exp     | 4 ++--
 gdb/testsuite/gdb.base/catch-syscall.exp         | 4 ++--
 gdb/testsuite/gdb.xml/tdesc-arch.exp             | 6 +++---
 8 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 04955ea847b..a19fc026623 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -476,11 +476,11 @@ show_architecture (struct ui_file *file, int from_tty,
    struct cmd_list_element *c, const char *value)
 {
   if (target_architecture_user == NULL)
-    fprintf_filtered (file, _("The target architecture is set "
-      "automatically (currently %s)\n"),
+    fprintf_filtered (file, _("The target architecture is set to "
+      "\"auto\" (currently %s).\n"),
       gdbarch_bfd_arch_info (get_current_arch ())->printable_name);
   else
-    fprintf_filtered (file, _("The target architecture is assumed to be %s\n"),
+    fprintf_filtered (file, _("The target architecture is set to \"%s\".\n"),
       set_architecture_string);
 }
 
diff --git a/gdb/testsuite/gdb.arch/amd64-osabi.exp b/gdb/testsuite/gdb.arch/amd64-osabi.exp
index aebaaffeeae..7702af99bc8 100644
--- a/gdb/testsuite/gdb.arch/amd64-osabi.exp
+++ b/gdb/testsuite/gdb.arch/amd64-osabi.exp
@@ -24,7 +24,7 @@ if { ![istarget x86_64-*-* ] } {
 proc test_osabi_none { arch void_ptr_size long_double_size } {
     clean_restart
 
-    gdb_test "set architecture i386:x86-64" "The target architecture is assumed to be i386:x86-64"
+    gdb_test "set architecture i386:x86-64" "The target architecture is set to \"i386:x86-64\"\\."
     gdb_test_no_output "set osabi none" "set osabi none"
     gdb_test "print sizeof (void*)" " = 8"
     gdb_test "print sizeof (long double)" " = 16"
diff --git a/gdb/testsuite/gdb.base/all-architectures.exp.tcl b/gdb/testsuite/gdb.base/all-architectures.exp.tcl
index ebdd3444540..4c59728b8c0 100644
--- a/gdb/testsuite/gdb.base/all-architectures.exp.tcl
+++ b/gdb/testsuite/gdb.base/all-architectures.exp.tcl
@@ -246,7 +246,7 @@ with_test_prefix "tests" {
     set arch_re [string_to_regexp $arch]
     set test "set architecture $arch"
     gdb_test_multiple $test $test {
- -re "^set architecture $arch_re\r\n(${osabi_warning})?The target architecture is assumed to be $arch_re\r\n$gdb_prompt $" {
+ -re "^set architecture $arch_re\r\n(${osabi_warning})?The target architecture is set to \"$arch_re\"\\.\r\n$gdb_prompt $" {
     internal_pass $test
  }
  -re "Architecture .* not recognized.*$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.base/attach-pie-noexec.exp b/gdb/testsuite/gdb.base/attach-pie-noexec.exp
index 08573a1c21f..f0d1aab101d 100644
--- a/gdb/testsuite/gdb.base/attach-pie-noexec.exp
+++ b/gdb/testsuite/gdb.base/attach-pie-noexec.exp
@@ -28,7 +28,7 @@ clean_restart $executable
 set arch ""
 set test "show architecture"
 gdb_test_multiple $test $test {
-    -re "The target architecture is set automatically \\(currently (.*)\\)\r\n$gdb_prompt $" {
+    -re "The target architecture is set to \"auto\" \\(currently (.*)\\)\\.\r\n$gdb_prompt $" {
  set arch $expect_out(1,string)
  pass $test
     }
@@ -61,7 +61,7 @@ set testpid [spawn_id_get_pid $test_spawn_id]
 gdb_start
 file delete -- $binfile
 gdb_test "attach $testpid" "Attaching to process $testpid\r\n.*" "attach"
-gdb_test "set architecture $arch" "The target architecture is assumed to be $arch"
+gdb_test "set architecture $arch" "The target architecture is set to \"$arch\"\\."
 gdb_test "info shared" "From\[ \t\]+To\[ \t\]+Syms Read\[ \t\]+Shared Object Library\r\n0x.*"
 
 kill_wait_spawned_process $test_spawn_id
diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp
index d5f5862c5c1..eb4fdb5e7c1 100644
--- a/gdb/testsuite/gdb.base/catch-syscall.exp
+++ b/gdb/testsuite/gdb.base/catch-syscall.exp
@@ -593,14 +593,14 @@ proc test_catch_syscall_multi_arch {} {
  gdb_start
 
  gdb_test "set architecture $arch1" \
-    "The target architecture is assumed to be $arch1"
+    "The target architecture is set to \"$arch1\"\\."
 
  gdb_test "catch syscall $syscall_number" \
     "Catchpoint $decimal \\(syscall .${syscall1_name}. \\\[${syscall_number}\\\]\\)" \
     "insert catch syscall on syscall $syscall_number -- $syscall1_name on $arch1"
 
  gdb_test "set architecture $arch2" \
-    "The target architecture is assumed to be $arch2"
+    "The target architecture is set to \"$arch2\"\\."
 
  gdb_test "catch syscall $syscall_number" \
     "Catchpoint $decimal \\(syscall .${syscall2_name}. \\\[${syscall_number}\\\]\\)" \
diff --git a/gdb/testsuite/gdb.xml/tdesc-arch.exp b/gdb/testsuite/gdb.xml/tdesc-arch.exp
index 386435dd171..144ff8b2672 100644
--- a/gdb/testsuite/gdb.xml/tdesc-arch.exp
+++ b/gdb/testsuite/gdb.xml/tdesc-arch.exp
@@ -41,7 +41,7 @@ gdb_test_multiple "set architecture" $msg {
 set default_arch ""
 set msg "read default architecture"
 gdb_test_multiple "show architecture" $msg {
-    -re "The target architecture is set automatically \\(currently (\[^ \]*)\\)\r\n$gdb_prompt $" {
+    -re "The target architecture is set to \"auto\" \\(currently (\[^ \]*)\\)\\.\r\n$gdb_prompt $" {
  set default_arch $expect_out(1,string)
  pass $msg
     }
@@ -89,7 +89,7 @@ proc set_arch { arch which trans_mode } {
 
     set cmd "show architecture"
     gdb_test $cmd \
- "The target architecture is set automatically \\(currently $arch\\)" \
+ "The target architecture is set to \"auto\" \\(currently $arch\\)\\." \
  "$cmd ($which architecture)"
 
     remote_file host delete $filename
@@ -122,7 +122,7 @@ gdb_test $cmd \
 
 set cmd "show architecture"
 gdb_test $cmd \
-    "The target architecture is set automatically \\(currently $default_arch\\)" \
+    "The target architecture is set to \"auto\" \\(currently $default_arch\\)\\." \
     "$cmd (invalid architecture)"
 
 remote_file host delete $filename
--
2.25.4

Reply | Threaded
Open this post in threaded view
|

[PATCH 2/2] gdb: Improve formatting of 'show endian' messages

Andrew Burgess
In reply to this post by Andrew Burgess
This commit changes the output of 'show endian'.  Here is a
session before this commit:

    (gdb) show endian
    The target endianness is set automatically (currently little endian)
    (gdb) set endian big
    The target is assumed to be big endian
    (gdb) show endian
    The target is assumed to be big endian
    (gdb)

After this commit the session now looks like this:

    (gdb) show endian
    The target endianness is set automatically (currently little endian).
    (gdb) set endian big
    The target is set to big endian.
    (gdb) show endian
    The target is set to big endian.
    (gdb)

The changes are:

  1. Each line ends with '.', and
  2. After setting the endianness GDB is now a little more assertive;
  'target is set to' not 'target is assumed to be', the user did just
  tell us after all!
---
 gdb/arch-utils.c                              |  8 ++---
 .../gdb.base/all-architectures.exp.tcl        |  4 +--
 gdb/testsuite/gdb.base/endian.exp             | 34 +++++++++----------
 3 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index a19fc026623..4ed26cf49b5 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -317,17 +317,17 @@ show_endian (struct ui_file *file, int from_tty, struct cmd_list_element *c,
   if (target_byte_order_user == BFD_ENDIAN_UNKNOWN)
     if (gdbarch_byte_order (get_current_arch ()) == BFD_ENDIAN_BIG)
       fprintf_unfiltered (file, _("The target endianness is set automatically "
-  "(currently big endian)\n"));
+  "(currently big endian).\n"));
     else
       fprintf_unfiltered (file, _("The target endianness is set automatically "
-  "(currently little endian)\n"));
+  "(currently little endian).\n"));
   else
     if (target_byte_order_user == BFD_ENDIAN_BIG)
       fprintf_unfiltered (file,
-  _("The target is assumed to be big endian\n"));
+  _("The target is set to big endian.\n"));
     else
       fprintf_unfiltered (file,
-  _("The target is assumed to be little endian\n"));
+  _("The target is set to little endian.\n"));
 }
 
 static void
diff --git a/gdb/testsuite/gdb.base/all-architectures.exp.tcl b/gdb/testsuite/gdb.base/all-architectures.exp.tcl
index 4c59728b8c0..34afa434b1c 100644
--- a/gdb/testsuite/gdb.base/all-architectures.exp.tcl
+++ b/gdb/testsuite/gdb.base/all-architectures.exp.tcl
@@ -225,7 +225,7 @@ with_test_prefix "tests" {
     continue
  } elseif {$endian == "auto"} {
     gdb_test_multiple "set endian $endian" $test {
- -re "^set endian $endian\r\n(${osabi_warning})?The target endianness is set automatically \\(currently .* endian\\)\r\n$gdb_prompt $" {
+ -re "^set endian $endian\r\n(${osabi_warning})?The target endianness is set automatically \\(currently .* endian\\)\\.\r\n$gdb_prompt $" {
     internal_pass $test
  }
     }
@@ -235,7 +235,7 @@ with_test_prefix "tests" {
     internal_pass $test
     continue
  }
- -re "^set endian $endian\r\n(${osabi_warning})?The target is assumed to be $endian endian\r\n$gdb_prompt $" {
+ -re "^set endian $endian\r\n(${osabi_warning})?The target is set to $endian endian\\.\r\n$gdb_prompt $" {
     internal_pass $test
  }
     }
diff --git a/gdb/testsuite/gdb.base/endian.exp b/gdb/testsuite/gdb.base/endian.exp
index 611b0ff5fbc..3058e6294aa 100644
--- a/gdb/testsuite/gdb.base/endian.exp
+++ b/gdb/testsuite/gdb.base/endian.exp
@@ -18,26 +18,26 @@
 standard_testfile
 
 set en_auto "The target endianness is set automatically"
-set en_set "The target is assumed to be"
+set en_set "The target is set to"
 
 clean_restart
 
 # First check that the automatic endianness is updated
 # with the `set endian' command.
 gdb_test "set endian auto" \
-    "$en_auto \\\(currently \(\?:big\|little\) endian\\\)" \
+    "$en_auto \\\(currently \(\?:big\|little\) endian\\\)\\." \
     "default target endianness"
-gdb_test "set endian big" "$en_set big endian" \
+gdb_test "set endian big" "$en_set big endian\\." \
     "set target endianness"
-gdb_test "set endian auto" "$en_auto \\\(currently big endian\\\)" \
+gdb_test "set endian auto" "$en_auto \\\(currently big endian\\\)\\." \
     "auto target endianness"
-gdb_test "set endian little" "$en_set little endian" \
+gdb_test "set endian little" "$en_set little endian\\." \
     "set target endianness little"
-gdb_test "set endian auto" "$en_auto \\\(currently little endian\\\)" \
+gdb_test "set endian auto" "$en_auto \\\(currently little endian\\\)\\." \
     "auto target endianness little"
-gdb_test "set endian big" "$en_set big endian" \
+gdb_test "set endian big" "$en_set big endian\\." \
     "set target endianness big"
-gdb_test "set endian auto" "$en_auto \\\(currently big endian\\\)" \
+gdb_test "set endian auto" "$en_auto \\\(currently big endian\\\)\\." \
     "auto target endianness big"
 
 if { [build_executable ${testfile}.exp $testfile] } {
@@ -49,7 +49,7 @@ if { [gdb_file_cmd $binfile] } {
 }
 set test "get target endianness"
 if { [gdb_test_multiple "show endian" "$test" {
-    -re "$en_auto \\\(currently \(big\|little\) endian\\\).*$gdb_prompt" {
+    -re "$en_auto \\\(currently \(big\|little\) endian\\\)\\..*$gdb_prompt" {
  set endian $expect_out(1,string)
  pass "$test"
     }
@@ -64,31 +64,31 @@ if { [gdb_test_multiple "show endian" "$test" {
 if { [gdb_unload] } {
     gdb_suppress_entire_file "$pf_prefix cannot unselect executable"
 }
-gdb_test "set endian big" "$en_set big endian" \
+gdb_test "set endian big" "$en_set big endian\\." \
     "override target endianness big"
-gdb_test "set endian auto" "$en_auto \\\(currently big endian\\\)" \
+gdb_test "set endian auto" "$en_auto \\\(currently big endian\\\)\\." \
     "override auto target endianness big"
 if { [gdb_file_cmd $binfile] } {
     gdb_suppress_entire_file "$pf_prefix cannot select executable"
 }
-gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)" \
+gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)\\." \
     "previously big default executable endianness"
 if { [gdb_unload] } {
     gdb_suppress_entire_file "$pf_prefix cannot unselect executable"
 }
-gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)" \
+gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)\\." \
     "previously big default no executable endianness"
-gdb_test "set endian little" "$en_set little endian" \
+gdb_test "set endian little" "$en_set little endian\\." \
     "override target endianness little"
-gdb_test "set endian auto" "$en_auto \\\(currently little endian\\\)" \
+gdb_test "set endian auto" "$en_auto \\\(currently little endian\\\)\\." \
     "override auto target endianness little"
 if { [gdb_file_cmd $binfile] } {
     gdb_suppress_entire_file "$pf_prefix cannot select executable"
 }
-gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)" \
+gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)\\." \
     "previously little default executable endianness"
 if { [gdb_unload] } {
     gdb_suppress_entire_file "$pf_prefix cannot unselect executable"
 }
-gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)" \
+gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)\\." \
     "previously little default no executable endianness"
--
2.25.4

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/2] gdb: Improve formatting of 'show architecture' messages

Sourceware - gdb-patches mailing list
In reply to this post by Andrew Burgess
Andrew Burgess wrote:

> This commit changes the output of 'show architecture'.  Here is a
> session before this commit:
>
>   (gdb) show architecture
>   The target architecture is set automatically (currently i386)
>   (gdb) set architecture mips
>   The target architecture is assumed to be mips
>   (gdb) show architecture
>   The target architecture is assumed to be mips
>   (gdb)
>
> After this commit the session now looks like this:
>
>   (gdb) show architecture
>   The target architecture is set to "auto" (currently i386).

This is potentially bikeshedding, but should the i386 in this
line be enclosed in quotes also?

Otherwise this LGTM.

Cheers,
Gary

--
Gary Benson - he / him / his
Principal Software Engineer, Red Hat

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 2/2] gdb: Improve formatting of 'show endian' messages

Sourceware - gdb-patches mailing list
In reply to this post by Andrew Burgess
Andrew Burgess wrote:

> This commit changes the output of 'show endian'.  Here is a
> session before this commit:
>
>     (gdb) show endian
>     The target endianness is set automatically (currently little endian)
>     (gdb) set endian big
>     The target is assumed to be big endian
>     (gdb) show endian
>     The target is assumed to be big endian
>     (gdb)
>
> After this commit the session now looks like this:
>
>     (gdb) show endian
>     The target endianness is set automatically (currently little endian).
>     (gdb) set endian big
>     The target is set to big endian.
>     (gdb) show endian
>     The target is set to big endian.
>     (gdb)
>
> The changes are:
>
>   1. Each line ends with '.', and
>   2. After setting the endianness GDB is now a little more assertive;
>   'target is set to' not 'target is assumed to be', the user did just
>   tell us after all!

LGTM.

Cheers,
Gary

--
Gary Benson - he / him / his
Principal Software Engineer, Red Hat

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 0/2] Changes to show architecture/endian message

Tom Tromey-2
In reply to this post by Andrew Burgess
>>>>> "Andrew" == Andrew Burgess <[hidden email]> writes:

Andrew> So, I made this and some other clean ups to the 'show architecture'
Andrew> output.

Andrew> Then while I was testing this I noticed that 'show endian' is
Andrew> basically the same, so I changed that in a similar way.

Andrew> Does the new output seem like an improvement to anyone else?  Or does
Andrew> anyone else prefer the old output?

FWIW I think your change is an improvement.

Tom
Reply | Threaded
Open this post in threaded view
|

[PUSHED 0/2] Changes to show architecture/endian message

Andrew Burgess
In reply to this post by Andrew Burgess
Thanks for the reviews.  This is the version that I pushed.

Differences since V1:

  - Added the extra quotes as suggest by Gary, so we now see:
      The target architecture is set to "auto" (currently "i386").

  - I spotted some more tests that needed their results updated.
    These are tests that I can't run (ppc, s390, arm), but the changes
    are pretty mechanical.

Thanks,
Andrew

---

Andrew Burgess (2):
  gdb: Improve formatting of 'show architecture' messages
  gdb: Improve formatting of 'show endian' messages

 gdb/ChangeLog                                 |  4 +++
 gdb/arch-utils.c                              | 14 ++++----
 gdb/testsuite/ChangeLog                       | 12 +++++++
 gdb/testsuite/gdb.arch/amd64-osabi.exp        |  2 +-
 .../gdb.arch/arm-disassembler-options.exp     |  4 +--
 .../gdb.arch/powerpc-disassembler-options.exp |  4 +--
 .../gdb.arch/ppc64-symtab-cordic.exp          |  4 +--
 .../gdb.arch/s390-disassembler-options.exp    |  4 +--
 .../gdb.base/all-architectures.exp.tcl        |  6 ++--
 gdb/testsuite/gdb.base/attach-pie-noexec.exp  |  4 +--
 gdb/testsuite/gdb.base/catch-syscall.exp      |  4 +--
 gdb/testsuite/gdb.base/endian.exp             | 34 +++++++++----------
 gdb/testsuite/gdb.xml/tdesc-arch.exp          |  6 ++--
 13 files changed, 59 insertions(+), 43 deletions(-)

--
2.25.4

Reply | Threaded
Open this post in threaded view
|

[PUSHED 1/2] gdb: Improve formatting of 'show architecture' messages

Andrew Burgess
This commit changes the output of 'show architecture'.  Here is a
session before this commit:

  (gdb) show architecture
  The target architecture is set automatically (currently i386)
  (gdb) set architecture mips
  The target architecture is assumed to be mips
  (gdb) show architecture
  The target architecture is assumed to be mips
  (gdb)

After this commit the session now looks like this:

  (gdb) show architecture
  The target architecture is set to "auto" (currently "i386").
  (gdb) set architecture mips
  The target architecture is set to "mips".
  (gdb) show architecture
  The target architecture is set to "mips".
  (gdb)

The changes are:

  1. The value is now enclosed in quotes,
  2. Each line ends with '.', and
  3. After setting the architecture GDB is now a little more
  assertive; 'architecture is set to' not 'is assumed to be', the user
  did just tell us after all!

gdb/ChangeLog:

        * arch-utils.c (show_architecture): Update formatting of messages.

gdb/testsuite/ChangeLog:

        * gdb.arch/amd64-osabi.exp: Update.
        * gdb.arch/arm-disassembler-options.exp: Update.
        * gdb.arch/powerpc-disassembler-options.exp: Update.
        * gdb.arch/ppc64-symtab-cordic.exp: Update.
        * gdb.arch/s390-disassembler-options.exp: Update.
        * gdb.base/all-architectures.exp.tcl: Update.
        * gdb.base/attach-pie-noexec.exp: Update.
        * gdb.base/catch-syscall.exp: Update.
        * gdb.xml/tdesc-arch.exp: Update.
---
 gdb/ChangeLog                                        |  4 ++++
 gdb/arch-utils.c                                     |  6 +++---
 gdb/testsuite/ChangeLog                              | 12 ++++++++++++
 gdb/testsuite/gdb.arch/amd64-osabi.exp               |  2 +-
 gdb/testsuite/gdb.arch/arm-disassembler-options.exp  |  4 ++--
 .../gdb.arch/powerpc-disassembler-options.exp        |  4 ++--
 gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp       |  4 ++--
 gdb/testsuite/gdb.arch/s390-disassembler-options.exp |  4 ++--
 gdb/testsuite/gdb.base/all-architectures.exp.tcl     |  2 +-
 gdb/testsuite/gdb.base/attach-pie-noexec.exp         |  4 ++--
 gdb/testsuite/gdb.base/catch-syscall.exp             |  4 ++--
 gdb/testsuite/gdb.xml/tdesc-arch.exp                 |  6 +++---
 12 files changed, 36 insertions(+), 20 deletions(-)

diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 04955ea847b..f89260a32b7 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -476,11 +476,11 @@ show_architecture (struct ui_file *file, int from_tty,
    struct cmd_list_element *c, const char *value)
 {
   if (target_architecture_user == NULL)
-    fprintf_filtered (file, _("The target architecture is set "
-      "automatically (currently %s)\n"),
+    fprintf_filtered (file, _("The target architecture is set to "
+      "\"auto\" (currently \"%s\").\n"),
       gdbarch_bfd_arch_info (get_current_arch ())->printable_name);
   else
-    fprintf_filtered (file, _("The target architecture is assumed to be %s\n"),
+    fprintf_filtered (file, _("The target architecture is set to \"%s\".\n"),
       set_architecture_string);
 }
 
diff --git a/gdb/testsuite/gdb.arch/amd64-osabi.exp b/gdb/testsuite/gdb.arch/amd64-osabi.exp
index aebaaffeeae..7702af99bc8 100644
--- a/gdb/testsuite/gdb.arch/amd64-osabi.exp
+++ b/gdb/testsuite/gdb.arch/amd64-osabi.exp
@@ -24,7 +24,7 @@ if { ![istarget x86_64-*-* ] } {
 proc test_osabi_none { arch void_ptr_size long_double_size } {
     clean_restart
 
-    gdb_test "set architecture i386:x86-64" "The target architecture is assumed to be i386:x86-64"
+    gdb_test "set architecture i386:x86-64" "The target architecture is set to \"i386:x86-64\"\\."
     gdb_test_no_output "set osabi none" "set osabi none"
     gdb_test "print sizeof (void*)" " = 8"
     gdb_test "print sizeof (long double)" " = 16"
diff --git a/gdb/testsuite/gdb.arch/arm-disassembler-options.exp b/gdb/testsuite/gdb.arch/arm-disassembler-options.exp
index b347cc5270d..ac1d8a8bdaa 100644
--- a/gdb/testsuite/gdb.arch/arm-disassembler-options.exp
+++ b/gdb/testsuite/gdb.arch/arm-disassembler-options.exp
@@ -31,7 +31,7 @@ set arch1 "armv2"
 set arch2 "armv5"
 
 gdb_test "set architecture $arch1" \
- "The target architecture is assumed to be $arch1" \
+ "The target architecture is set to \"$arch1\"" \
  "set architecture $arch1"
 
 gdb_test_no_output "set disassembler-options"
@@ -47,7 +47,7 @@ gdb_test "show disassembler-options" \
 # Change architectures and verify the disassembler options have been preserved.
 
 gdb_test "set architecture $arch2" \
- "The target architecture is assumed to be $arch2" \
+ "The target architecture is set to \"$arch2\"" \
  "set architecture $arch2"
 
 gdb_test "show disassembler-options" \
diff --git a/gdb/testsuite/gdb.arch/powerpc-disassembler-options.exp b/gdb/testsuite/gdb.arch/powerpc-disassembler-options.exp
index 5d77fd7048c..68d9bf61e17 100644
--- a/gdb/testsuite/gdb.arch/powerpc-disassembler-options.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-disassembler-options.exp
@@ -31,7 +31,7 @@ set arch1 "rs6000:6000"
 set arch2 "powerpc:common64"
 
 gdb_test "set architecture $arch1" \
- "The target architecture is assumed to be $arch1" \
+ "The target architecture is set to \"$arch1\"" \
  "set architecture $arch1"
 
 gdb_test_no_output "set disassembler-options"
@@ -47,7 +47,7 @@ gdb_test "show disassembler-options" \
 # Change architectures and verify the disassembler options have been preserved.
 
 gdb_test "set architecture $arch2" \
- "The target architecture is assumed to be $arch2" \
+ "The target architecture is set to \"$arch2\"" \
  "set architecture $arch2"
 
 gdb_test "show disassembler-options" \
diff --git a/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp b/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp
index 207c50893ac..fa5bff9cebf 100644
--- a/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp
+++ b/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp
@@ -47,10 +47,10 @@ gdb_load ${kofile}
 
 set test "show architecture"
 gdb_test_multiple $test $test {
-    -re "\r\nThe target architecture is set automatically \\(currently powerpc:common64\\)\r\n$gdb_prompt $" {
+    -re "\r\nThe target architecture is set to \"auto\" \\(currently \"powerpc:common64\"\\)\r\n$gdb_prompt $" {
  pass $test
     }
-    -re "\r\nThe target architecture is set automatically \\(currently .*\\)\r\n$gdb_prompt $" {
+    -re "\r\nThe target architecture is set to \"auto\" \\(currently \".*\"\\)\r\n$gdb_prompt $" {
  untested "powerpc:common64 is not supported"
     }
 }
diff --git a/gdb/testsuite/gdb.arch/s390-disassembler-options.exp b/gdb/testsuite/gdb.arch/s390-disassembler-options.exp
index 72fb00bb07c..a9ae230aa05 100644
--- a/gdb/testsuite/gdb.arch/s390-disassembler-options.exp
+++ b/gdb/testsuite/gdb.arch/s390-disassembler-options.exp
@@ -31,7 +31,7 @@ set arch1 "s390:64-bit"
 set arch2 "s390:31-bit"
 
 gdb_test "set architecture $arch1" \
- "The target architecture is assumed to be $arch1" \
+ "The target architecture is set to \"$arch1\"" \
  "set architecture $arch1"
 
 gdb_test_no_output "set disassembler-options"
@@ -47,7 +47,7 @@ gdb_test "show disassembler-options" \
 # Change architectures and verify the disassembler options have been preserved.
 
 gdb_test "set architecture $arch2" \
- "The target architecture is assumed to be $arch2" \
+ "The target architecture is set to \"$arch2\"" \
  "set architecture $arch2"
 
 gdb_test "show disassembler-options" \
diff --git a/gdb/testsuite/gdb.base/all-architectures.exp.tcl b/gdb/testsuite/gdb.base/all-architectures.exp.tcl
index ebdd3444540..4c59728b8c0 100644
--- a/gdb/testsuite/gdb.base/all-architectures.exp.tcl
+++ b/gdb/testsuite/gdb.base/all-architectures.exp.tcl
@@ -246,7 +246,7 @@ with_test_prefix "tests" {
     set arch_re [string_to_regexp $arch]
     set test "set architecture $arch"
     gdb_test_multiple $test $test {
- -re "^set architecture $arch_re\r\n(${osabi_warning})?The target architecture is assumed to be $arch_re\r\n$gdb_prompt $" {
+ -re "^set architecture $arch_re\r\n(${osabi_warning})?The target architecture is set to \"$arch_re\"\\.\r\n$gdb_prompt $" {
     internal_pass $test
  }
  -re "Architecture .* not recognized.*$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.base/attach-pie-noexec.exp b/gdb/testsuite/gdb.base/attach-pie-noexec.exp
index 08573a1c21f..43d9e3c5fa7 100644
--- a/gdb/testsuite/gdb.base/attach-pie-noexec.exp
+++ b/gdb/testsuite/gdb.base/attach-pie-noexec.exp
@@ -28,7 +28,7 @@ clean_restart $executable
 set arch ""
 set test "show architecture"
 gdb_test_multiple $test $test {
-    -re "The target architecture is set automatically \\(currently (.*)\\)\r\n$gdb_prompt $" {
+    -re "The target architecture is set to \"auto\" \\(currently \"(.*)\"\\)\\.\r\n$gdb_prompt $" {
  set arch $expect_out(1,string)
  pass $test
     }
@@ -61,7 +61,7 @@ set testpid [spawn_id_get_pid $test_spawn_id]
 gdb_start
 file delete -- $binfile
 gdb_test "attach $testpid" "Attaching to process $testpid\r\n.*" "attach"
-gdb_test "set architecture $arch" "The target architecture is assumed to be $arch"
+gdb_test "set architecture $arch" "The target architecture is set to \"$arch\"\\."
 gdb_test "info shared" "From\[ \t\]+To\[ \t\]+Syms Read\[ \t\]+Shared Object Library\r\n0x.*"
 
 kill_wait_spawned_process $test_spawn_id
diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp
index d5f5862c5c1..eb4fdb5e7c1 100644
--- a/gdb/testsuite/gdb.base/catch-syscall.exp
+++ b/gdb/testsuite/gdb.base/catch-syscall.exp
@@ -593,14 +593,14 @@ proc test_catch_syscall_multi_arch {} {
  gdb_start
 
  gdb_test "set architecture $arch1" \
-    "The target architecture is assumed to be $arch1"
+    "The target architecture is set to \"$arch1\"\\."
 
  gdb_test "catch syscall $syscall_number" \
     "Catchpoint $decimal \\(syscall .${syscall1_name}. \\\[${syscall_number}\\\]\\)" \
     "insert catch syscall on syscall $syscall_number -- $syscall1_name on $arch1"
 
  gdb_test "set architecture $arch2" \
-    "The target architecture is assumed to be $arch2"
+    "The target architecture is set to \"$arch2\"\\."
 
  gdb_test "catch syscall $syscall_number" \
     "Catchpoint $decimal \\(syscall .${syscall2_name}. \\\[${syscall_number}\\\]\\)" \
diff --git a/gdb/testsuite/gdb.xml/tdesc-arch.exp b/gdb/testsuite/gdb.xml/tdesc-arch.exp
index 386435dd171..3da40810984 100644
--- a/gdb/testsuite/gdb.xml/tdesc-arch.exp
+++ b/gdb/testsuite/gdb.xml/tdesc-arch.exp
@@ -41,7 +41,7 @@ gdb_test_multiple "set architecture" $msg {
 set default_arch ""
 set msg "read default architecture"
 gdb_test_multiple "show architecture" $msg {
-    -re "The target architecture is set automatically \\(currently (\[^ \]*)\\)\r\n$gdb_prompt $" {
+    -re "The target architecture is set to \"auto\" \\(currently \"(\[^ \]*)\"\\)\\.\r\n$gdb_prompt $" {
  set default_arch $expect_out(1,string)
  pass $msg
     }
@@ -89,7 +89,7 @@ proc set_arch { arch which trans_mode } {
 
     set cmd "show architecture"
     gdb_test $cmd \
- "The target architecture is set automatically \\(currently $arch\\)" \
+ "The target architecture is set to \"auto\" \\(currently \"$arch\"\\)\\." \
  "$cmd ($which architecture)"
 
     remote_file host delete $filename
@@ -122,7 +122,7 @@ gdb_test $cmd \
 
 set cmd "show architecture"
 gdb_test $cmd \
-    "The target architecture is set automatically \\(currently $default_arch\\)" \
+    "The target architecture is set to \"auto\" \\(currently \"$default_arch\"\\)\\." \
     "$cmd (invalid architecture)"
 
 remote_file host delete $filename
--
2.25.4

Reply | Threaded
Open this post in threaded view
|

[PUSHED 2/2] gdb: Improve formatting of 'show endian' messages

Andrew Burgess
In reply to this post by Andrew Burgess
This commit changes the output of 'show endian'.  Here is a
session before this commit:

    (gdb) show endian
    The target endianness is set automatically (currently little endian)
    (gdb) set endian big
    The target is assumed to be big endian
    (gdb) show endian
    The target is assumed to be big endian
    (gdb)

After this commit the session now looks like this:

    (gdb) show endian
    The target endianness is set automatically (currently little endian).
    (gdb) set endian big
    The target is set to big endian.
    (gdb) show endian
    The target is set to big endian.
    (gdb)

The changes are:

  1. Each line ends with '.', and
  2. After setting the endianness GDB is now a little more assertive;
  'target is set to' not 'target is assumed to be', the user did just
  tell us after all!
---
 gdb/arch-utils.c                              |  8 ++---
 .../gdb.base/all-architectures.exp.tcl        |  4 +--
 gdb/testsuite/gdb.base/endian.exp             | 34 +++++++++----------
 3 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index f89260a32b7..13ba50abe61 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -317,17 +317,17 @@ show_endian (struct ui_file *file, int from_tty, struct cmd_list_element *c,
   if (target_byte_order_user == BFD_ENDIAN_UNKNOWN)
     if (gdbarch_byte_order (get_current_arch ()) == BFD_ENDIAN_BIG)
       fprintf_unfiltered (file, _("The target endianness is set automatically "
-  "(currently big endian)\n"));
+  "(currently big endian).\n"));
     else
       fprintf_unfiltered (file, _("The target endianness is set automatically "
-  "(currently little endian)\n"));
+  "(currently little endian).\n"));
   else
     if (target_byte_order_user == BFD_ENDIAN_BIG)
       fprintf_unfiltered (file,
-  _("The target is assumed to be big endian\n"));
+  _("The target is set to big endian.\n"));
     else
       fprintf_unfiltered (file,
-  _("The target is assumed to be little endian\n"));
+  _("The target is set to little endian.\n"));
 }
 
 static void
diff --git a/gdb/testsuite/gdb.base/all-architectures.exp.tcl b/gdb/testsuite/gdb.base/all-architectures.exp.tcl
index 4c59728b8c0..34afa434b1c 100644
--- a/gdb/testsuite/gdb.base/all-architectures.exp.tcl
+++ b/gdb/testsuite/gdb.base/all-architectures.exp.tcl
@@ -225,7 +225,7 @@ with_test_prefix "tests" {
     continue
  } elseif {$endian == "auto"} {
     gdb_test_multiple "set endian $endian" $test {
- -re "^set endian $endian\r\n(${osabi_warning})?The target endianness is set automatically \\(currently .* endian\\)\r\n$gdb_prompt $" {
+ -re "^set endian $endian\r\n(${osabi_warning})?The target endianness is set automatically \\(currently .* endian\\)\\.\r\n$gdb_prompt $" {
     internal_pass $test
  }
     }
@@ -235,7 +235,7 @@ with_test_prefix "tests" {
     internal_pass $test
     continue
  }
- -re "^set endian $endian\r\n(${osabi_warning})?The target is assumed to be $endian endian\r\n$gdb_prompt $" {
+ -re "^set endian $endian\r\n(${osabi_warning})?The target is set to $endian endian\\.\r\n$gdb_prompt $" {
     internal_pass $test
  }
     }
diff --git a/gdb/testsuite/gdb.base/endian.exp b/gdb/testsuite/gdb.base/endian.exp
index 611b0ff5fbc..3058e6294aa 100644
--- a/gdb/testsuite/gdb.base/endian.exp
+++ b/gdb/testsuite/gdb.base/endian.exp
@@ -18,26 +18,26 @@
 standard_testfile
 
 set en_auto "The target endianness is set automatically"
-set en_set "The target is assumed to be"
+set en_set "The target is set to"
 
 clean_restart
 
 # First check that the automatic endianness is updated
 # with the `set endian' command.
 gdb_test "set endian auto" \
-    "$en_auto \\\(currently \(\?:big\|little\) endian\\\)" \
+    "$en_auto \\\(currently \(\?:big\|little\) endian\\\)\\." \
     "default target endianness"
-gdb_test "set endian big" "$en_set big endian" \
+gdb_test "set endian big" "$en_set big endian\\." \
     "set target endianness"
-gdb_test "set endian auto" "$en_auto \\\(currently big endian\\\)" \
+gdb_test "set endian auto" "$en_auto \\\(currently big endian\\\)\\." \
     "auto target endianness"
-gdb_test "set endian little" "$en_set little endian" \
+gdb_test "set endian little" "$en_set little endian\\." \
     "set target endianness little"
-gdb_test "set endian auto" "$en_auto \\\(currently little endian\\\)" \
+gdb_test "set endian auto" "$en_auto \\\(currently little endian\\\)\\." \
     "auto target endianness little"
-gdb_test "set endian big" "$en_set big endian" \
+gdb_test "set endian big" "$en_set big endian\\." \
     "set target endianness big"
-gdb_test "set endian auto" "$en_auto \\\(currently big endian\\\)" \
+gdb_test "set endian auto" "$en_auto \\\(currently big endian\\\)\\." \
     "auto target endianness big"
 
 if { [build_executable ${testfile}.exp $testfile] } {
@@ -49,7 +49,7 @@ if { [gdb_file_cmd $binfile] } {
 }
 set test "get target endianness"
 if { [gdb_test_multiple "show endian" "$test" {
-    -re "$en_auto \\\(currently \(big\|little\) endian\\\).*$gdb_prompt" {
+    -re "$en_auto \\\(currently \(big\|little\) endian\\\)\\..*$gdb_prompt" {
  set endian $expect_out(1,string)
  pass "$test"
     }
@@ -64,31 +64,31 @@ if { [gdb_test_multiple "show endian" "$test" {
 if { [gdb_unload] } {
     gdb_suppress_entire_file "$pf_prefix cannot unselect executable"
 }
-gdb_test "set endian big" "$en_set big endian" \
+gdb_test "set endian big" "$en_set big endian\\." \
     "override target endianness big"
-gdb_test "set endian auto" "$en_auto \\\(currently big endian\\\)" \
+gdb_test "set endian auto" "$en_auto \\\(currently big endian\\\)\\." \
     "override auto target endianness big"
 if { [gdb_file_cmd $binfile] } {
     gdb_suppress_entire_file "$pf_prefix cannot select executable"
 }
-gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)" \
+gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)\\." \
     "previously big default executable endianness"
 if { [gdb_unload] } {
     gdb_suppress_entire_file "$pf_prefix cannot unselect executable"
 }
-gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)" \
+gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)\\." \
     "previously big default no executable endianness"
-gdb_test "set endian little" "$en_set little endian" \
+gdb_test "set endian little" "$en_set little endian\\." \
     "override target endianness little"
-gdb_test "set endian auto" "$en_auto \\\(currently little endian\\\)" \
+gdb_test "set endian auto" "$en_auto \\\(currently little endian\\\)\\." \
     "override auto target endianness little"
 if { [gdb_file_cmd $binfile] } {
     gdb_suppress_entire_file "$pf_prefix cannot select executable"
 }
-gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)" \
+gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)\\." \
     "previously little default executable endianness"
 if { [gdb_unload] } {
     gdb_suppress_entire_file "$pf_prefix cannot unselect executable"
 }
-gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)" \
+gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)\\." \
     "previously little default no executable endianness"
--
2.25.4

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/2] gdb: Improve formatting of 'show architecture' messages

Simon Marchi-4
In reply to this post by Sourceware - gdb-patches mailing list
On 2020-07-08 6:06 a.m., Gary Benson via Gdb-patches wrote:
> This is potentially bikeshedding, but should the i386 in this
> line be enclosed in quotes also?

This is not bikeshedding, IMO.  Consistency and attention to details make a tool look much better!

Simon
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/2] gdb: Improve formatting of 'show architecture' messages

Andrew Burgess
* Simon Marchi <[hidden email]> [2020-07-14 22:06:05 -0400]:

> On 2020-07-08 6:06 a.m., Gary Benson via Gdb-patches wrote:
> > This is potentially bikeshedding, but should the i386 in this
> > line be enclosed in quotes also?
>
> This is not bikeshedding, IMO.  Consistency and attention to details make a tool look much better!

I agree, and I'm always happy to get feedback like this.

FYI - this change made it into the final patch I merged.

Thanks,
Andrew
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/2] gdb: Improve formatting of 'show architecture' messages

Sourceware - gdb-patches mailing list
Andrew Burgess wrote:

> * Simon Marchi <[hidden email]> [2020-07-14 22:06:05 -0400]:
> > On 2020-07-08 6:06 a.m., Gary Benson via Gdb-patches wrote:
> > > This is potentially bikeshedding, but should the i386 in this
> > > line be enclosed in quotes also?
> >
> > This is not bikeshedding, IMO.  Consistency and attention to
> > details make a tool look much better!
>
> I agree, and I'm always happy to get feedback like this.
>
> FYI - this change made it into the final patch I merged.

Oh, awesome, thank you!

Cheers,
Gary

--
Gary Benson - he / him / his
Principal Software Engineer, Red Hat