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.
This commit is contained in:
Andrew Burgess 2020-06-25 17:59:34 +01:00
parent 570b0ed6d5
commit ccb9eba6a2
12 changed files with 36 additions and 20 deletions

View File

@ -1,3 +1,7 @@
2020-07-14 Andrew Burgess <andrew.burgess@embecosm.com>
* arch-utils.c (show_architecture): Update formatting of messages.
2020-07-12 Simon Marchi <simon.marchi@efficios.com>
* gdbtypes.h (struct type) <bounds>: Handle array and string

View File

@ -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);
}

View File

@ -1,3 +1,15 @@
2020-07-14 Andrew Burgess <andrew.burgess@embecosm.com>
* 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 <tdevries@suse.de>
* gdb.threads/clone-new-thread-event.c (gettid): Rename to ...

View File

@ -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"

View File

@ -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" \

View File

@ -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" \

View File

@ -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"
}
}

View File

@ -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" \

View File

@ -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 $" {

View File

@ -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

View File

@ -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}\\\]\\)" \

View File

@ -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