]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: Improve formatting of 'show endian' messages
authorAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 3 Jul 2020 10:22:03 +0000 (11:22 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 14 Jul 2020 12:21:42 +0000 (13:21 +0100)
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
gdb/testsuite/gdb.base/all-architectures.exp.tcl
gdb/testsuite/gdb.base/endian.exp

index f89260a32b77f17ac9fbe2998d690bbb588f2107..13ba50abe610f9aaf208e223233c77b1b50a176e 100644 (file)
@@ -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
index 4c59728b8c09483ff9abfed44c65591301714803..34afa434b1cda3811ddb3091e21fbbcf5574d27f 100644 (file)
@@ -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
                        }
                    }
index 611b0ff5fbcb452c4b44866cfbe6e42e1108a14e..3058e6294aad5c405f125bbeb45a06f7a9d48583 100644 (file)
 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"