From ccb9eba6a254f8d5e593972a73504c94a009c729 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Thu, 25 Jun 2020 17:59:34 +0100 Subject: gdb: Improve formatting of 'show architecture' messages 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/testsuite/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(-) (limited to 'gdb') diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 57b37b8..675aee6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2020-07-14 Andrew Burgess + + * arch-utils.c (show_architecture): Update formatting of messages. + 2020-07-12 Simon Marchi * gdbtypes.h (struct type) : Handle array and string diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 04955ea..f89260a 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/ChangeLog b/gdb/testsuite/ChangeLog index 7690acf..6126048 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,15 @@ +2020-07-14 Andrew Burgess + + * 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. + 2020-07-14 Tom de Vries * gdb.threads/clone-new-thread-event.c (gettid): Rename to ... diff --git a/gdb/testsuite/gdb.arch/amd64-osabi.exp b/gdb/testsuite/gdb.arch/amd64-osabi.exp index aebaaff..7702af9 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 b347cc5..ac1d8a8 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 5d77fd7..68d9bf6 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 207c508..fa5bff9 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 72fb00b..a9ae230 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 ebdd344..4c59728 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 08573a1..43d9e3c 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 d5f5862..eb4fdb5 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 386435d..3da4081 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 -- cgit v1.1