Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <andrew.burgess@embecosm.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/2] gdb: Improve formatting of 'show architecture' messages
Date: Wed,  8 Jul 2020 09:54:54 +0100	[thread overview]
Message-ID: <2d73efe4dc489f06fd4e67aa18979e5b655b7100.1594198122.git.andrew.burgess@embecosm.com> (raw)
In-Reply-To: <cover.1594198122.git.andrew.burgess@embecosm.com>

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	other threads:[~2020-07-08  8:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-08  8:54 [PATCH 0/2] Changes to show architecture/endian message Andrew Burgess
2020-07-08  8:54 ` Andrew Burgess [this message]
2020-07-08 10:06   ` [PATCH 1/2] gdb: Improve formatting of 'show architecture' messages Gary Benson
2020-07-15  2:06     ` Simon Marchi
2020-07-15  9:36       ` Andrew Burgess
2020-07-17 15:52         ` Gary Benson
2020-07-08  8:54 ` [PATCH 2/2] gdb: Improve formatting of 'show endian' messages Andrew Burgess
2020-07-08 10:06   ` Gary Benson
2020-07-13 18:24 ` [PATCH 0/2] Changes to show architecture/endian message Tom Tromey
2020-07-14 12:27 ` [PUSHED " Andrew Burgess
2020-07-14 12:27   ` [PUSHED 1/2] gdb: Improve formatting of 'show architecture' messages Andrew Burgess
2020-07-14 12:27   ` [PUSHED 2/2] gdb: Improve formatting of 'show endian' messages Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2d73efe4dc489f06fd4e67aa18979e5b655b7100.1594198122.git.andrew.burgess@embecosm.com \
    --to=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox