[4/5] gdb/testsuite/: Use "-qualified" in explicit "break main", etc.

Message ID 20201012004732.22999-5-pedro@palves.net
State New
Headers show
Series
  • runto_main and -qualified
Related show

Commit Message

Pedro Alves Oct. 12, 2020, 12:47 a.m.
Similar to the previous patch, but this time add "-q" to tests that do
"break main", "list main", etc. explicitly.

gdb/testsuite/ChangeLog:

	* config/monitor.exp: Use "list -q".
	* gdb.arch/gdb1558.exp: Use "break -q".
	* gdb.arch/i386-permbkpt.exp: Use "break -q".
	* gdb.arch/i386-prologue-skip-cf-protection.exp: Use "break -q".
	* gdb.base/break.exp: Use "break -q", "list -q" and "tbreak -q".
	* gdb.base/commands.exp: Use "break -q".
	* gdb.base/condbreak.exp: Use "break -q".
	* gdb.base/ctf-ptype.exp: Use "list -q".
	* gdb.base/define.exp: Use "break -q".
	* gdb.base/del.exp: Use "break -q".
	* gdb.base/fullname.exp: Use "break -q".
	* gdb.base/hbreak-in-shr-unsupported.exp: Use "hbreak -q".
	* gdb.base/hbreak-unmapped.exp: Use "hbreak -q".
	* gdb.base/hbreak2.exp: Use "hbreak -q" and "list -q".
	* gdb.base/hw-sw-break-same-address.exp: Use "break -q" and
	"hbreak -q".
	* gdb.base/included.exp: Use "list -q".
	* gdb.base/label.exp: Use "break -q".
	* gdb.base/lineinc.exp: Use "break -q".
	* gdb.base/list.exp: Use "list -q".
	* gdb.base/macscp.exp: Use "list -q".
	* gdb.base/pending.exp: Use "break -q".
	* gdb.base/prologue-include.exp: Use "break -q".
	* gdb.base/ptype.exp: Use "list -q".
	* gdb.base/sepdebug.exp: Use "break -q", "list -q" and "tbreak -q".
	* gdb.base/server-del-break.exp: Use "break -q".
	* gdb.base/style.exp: Use "break -q".
	* gdb.base/symbol-without-target_section.exp: Use "list -q".
	* gdb.base/watchpoint-reuse-slot.exp: Use "hbreak -q".
	* gdb.cp/exception.exp: Use "tbreak -q".
	* gdb.dwarf2/dw2-error.exp: Use "break -q".
	* gdb.dwarf2/fission-mix.exp: Use "break -q".
	* gdb.dwarf2/fission-reread.exp: Use "break -q".
	* gdb.dwarf2/pr13961.exp: Use "break -q".
	* gdb.linespec/explicit.exp: Use "list -q".
	* gdb.linespec/linespec.exp: Use "break -q".
	* gdb.mi/mi-simplerun.exp: Use "--qualified".
	* gdb.python/py-mi-objfile-gdb.py: Use "list -q".
	* gdb.server/bkpt-other-inferior.exp: Use "break -q".
	* gdb.server/connect-without-multi-process.exp: Use "break -q".
	* gdb.trace/change-loc.exp: Use "break -q".
	* gdb.trace/pending.exp: Use "break -q".
	* gdb.tui/basic.exp: Use "list -q".
	* gdb.tui/list-before.exp: Use "list -q".
	* gdb.tui/list.exp: Use "list -q".
	* lib/gdb.exp (gdb_has_argv0): Use "break -q".

Change-Id: Iab9408e90ed71cbb111cd737d2d81b5ba8adb108
---
 gdb/testsuite/config/monitor.exp                            |  2 +-
 gdb/testsuite/gdb.arch/gdb1558.exp                          |  6 +++---
 gdb/testsuite/gdb.arch/i386-permbkpt.exp                    |  4 ++--
 gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp |  2 +-
 gdb/testsuite/gdb.base/break.exp                            |  8 ++++----
 gdb/testsuite/gdb.base/commands.exp                         |  6 +++---
 gdb/testsuite/gdb.base/condbreak.exp                        |  6 +++---
 gdb/testsuite/gdb.base/ctf-ptype.exp                        |  2 +-
 gdb/testsuite/gdb.base/define.exp                           |  2 +-
 gdb/testsuite/gdb.base/del.exp                              |  2 +-
 gdb/testsuite/gdb.base/fullname.exp                         |  6 +++---
 gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.exp        |  2 +-
 gdb/testsuite/gdb.base/hbreak-unmapped.exp                  |  2 +-
 gdb/testsuite/gdb.base/hbreak2.exp                          | 12 ++++++------
 gdb/testsuite/gdb.base/hw-sw-break-same-address.exp         |  8 ++++----
 gdb/testsuite/gdb.base/included.exp                         |  2 +-
 gdb/testsuite/gdb.base/label.exp                            |  4 ++--
 gdb/testsuite/gdb.base/lineinc.exp                          |  2 +-
 gdb/testsuite/gdb.base/list.exp                             |  6 +++---
 gdb/testsuite/gdb.base/macscp.exp                           |  2 +-
 gdb/testsuite/gdb.base/pending.exp                          |  2 +-
 gdb/testsuite/gdb.base/prologue-include.exp                 |  2 +-
 gdb/testsuite/gdb.base/ptype.exp                            |  2 +-
 gdb/testsuite/gdb.base/sepdebug.exp                         | 10 +++++-----
 gdb/testsuite/gdb.base/server-del-break.exp                 |  2 +-
 gdb/testsuite/gdb.base/style.exp                            |  2 +-
 gdb/testsuite/gdb.base/symbol-without-target_section.exp    |  4 ++--
 gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp            |  2 +-
 gdb/testsuite/gdb.cp/exception.exp                          |  2 +-
 gdb/testsuite/gdb.dwarf2/dw2-error.exp                      |  2 +-
 gdb/testsuite/gdb.dwarf2/fission-mix.exp                    |  2 +-
 gdb/testsuite/gdb.dwarf2/fission-reread.exp                 |  2 +-
 gdb/testsuite/gdb.dwarf2/pr13961.exp                        |  2 +-
 gdb/testsuite/gdb.linespec/explicit.exp                     |  8 ++++----
 gdb/testsuite/gdb.linespec/linespec.exp                     |  4 ++--
 gdb/testsuite/gdb.mi/mi-simplerun.exp                       |  2 +-
 gdb/testsuite/gdb.python/py-mi-objfile-gdb.py               |  2 +-
 gdb/testsuite/gdb.server/bkpt-other-inferior.exp            |  4 ++--
 gdb/testsuite/gdb.server/connect-without-multi-process.exp  |  2 +-
 gdb/testsuite/gdb.trace/change-loc.exp                      |  2 +-
 gdb/testsuite/gdb.trace/pending.exp                         |  4 ++--
 gdb/testsuite/gdb.tui/basic.exp                             |  4 ++--
 gdb/testsuite/gdb.tui/list-before.exp                       |  2 +-
 gdb/testsuite/gdb.tui/list.exp                              |  8 ++++----
 gdb/testsuite/lib/gdb.exp                                   |  2 +-
 45 files changed, 83 insertions(+), 83 deletions(-)

-- 
2.14.5

Comments

Simon Marchi Oct. 13, 2020, 6:07 p.m. | #1
On 2020-10-11 8:47 p.m., Pedro Alves wrote:
> Similar to the previous patch, but this time add "-q" to tests that do

> "break main", "list main", etc. explicitly.


This LGTM.

Simon

Patch

diff --git a/gdb/testsuite/config/monitor.exp b/gdb/testsuite/config/monitor.exp
index 7e74dad100c..fb0736c582c 100644
--- a/gdb/testsuite/config/monitor.exp
+++ b/gdb/testsuite/config/monitor.exp
@@ -169,7 +169,7 @@  proc gdb_load { arg } {
 	    }
 	    if { $state == "pass" } {
 		if [gdb_target_monitor $arg] { return -1 }
-		gdb_test "list main" ".*" ""
+		gdb_test "list -q main" ".*" ""
 		verbose "Loaded $arg into $GDB\n"
 		return 0
 	    }
diff --git a/gdb/testsuite/gdb.arch/gdb1558.exp b/gdb/testsuite/gdb.arch/gdb1558.exp
index 47b64cf6b39..9748e2e9b39 100644
--- a/gdb/testsuite/gdb.arch/gdb1558.exp
+++ b/gdb/testsuite/gdb.arch/gdb1558.exp
@@ -41,9 +41,9 @@  gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
-gdb_test "b main" "Breakpoint 1.*" "set breakpoint at main"
-gdb_test "b sub1" "Breakpoint 2.*" "set breakpoint at sub1"
-gdb_test "b sub2" "Breakpoint 3.*" "set breakpoint at sub2"
+gdb_test "b -q main" "Breakpoint 1.*" "set breakpoint at main"
+gdb_test "b -q sub1" "Breakpoint 2.*" "set breakpoint at sub1"
+gdb_test "b -q sub2" "Breakpoint 3.*" "set breakpoint at sub2"
 
 # We can't use "runto_main" because that is exactly the problem
 # we are trying to detect, stopping somewhere before main.
diff --git a/gdb/testsuite/gdb.arch/i386-permbkpt.exp b/gdb/testsuite/gdb.arch/i386-permbkpt.exp
index e9aadefb09b..7dc2a87d771 100644
--- a/gdb/testsuite/gdb.arch/i386-permbkpt.exp
+++ b/gdb/testsuite/gdb.arch/i386-permbkpt.exp
@@ -35,5 +35,5 @@  if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list
 
 clean_restart ${binfile}
 
-gdb_test "break main" "" "first permanent break"
-gdb_test "break main" "" "second permanent break"
+gdb_test "break -q main" "" "first permanent break"
+gdb_test "break -q main" "" "second permanent break"
diff --git a/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp b/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp
index 9ba64f9c375..c38c7ce7e7c 100644
--- a/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp
+++ b/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp
@@ -48,7 +48,7 @@  gdb_assert {$main_addr != -1}
 set bp_addr -1
 
 # Put breakpoint on main, get the address where the breakpoint was installed.
-gdb_test_multiple "break main" "break on main, get address" {
+gdb_test_multiple "break -q main" "break on main, get address" {
     -re -wrap "Breakpoint $decimal at ($hex).*" {
 	set bp_addr $expect_out(1,string)
 
diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp
index 35813e3dfee..ee77d84a443 100644
--- a/gdb/testsuite/gdb.base/break.exp
+++ b/gdb/testsuite/gdb.base/break.exp
@@ -47,7 +47,7 @@  gdb_expect {
 #
 # test break at function
 #
-gdb_test "break main" \
+gdb_test "break -q main" \
     "Breakpoint.*at.* file .*$srcfile, line.*" \
     "breakpoint function"
 
@@ -76,7 +76,7 @@  set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
 # it's wherever the processor was stopped when we connected to the
 # board.  So, to be sure, we do a list command.
 #
-gdb_test "list main" \
+gdb_test "list -q main" \
     ".*main \\(int argc, char \\*\\*argv, char \\*\\*envp\\).*" \
     "use `list' to establish default source file"
 gdb_test "break $bp_location1" \
@@ -426,7 +426,7 @@  delete_breakpoints
 # test temporary breakpoint at function
 #
 
-gdb_test "tbreak main" "Temporary breakpoint.*at.* file .*$srcfile, line.*" "temporary breakpoint function"
+gdb_test "tbreak -q main" "Temporary breakpoint.*at.* file .*$srcfile, line.*" "temporary breakpoint function"
 
 #
 # test break at function in file
@@ -759,7 +759,7 @@  if { [prepare_for_testing "failed to prepare" "breako2" {break.c break1.c} {debu
 #
 # test break at function
 #
-gdb_test "break main" \
+gdb_test "break -q main" \
     "Breakpoint.*at.* file .*, line.*" \
     "breakpoint function, optimized file"
 
diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp
index 869d0a81a4a..7ff57f774af 100644
--- a/gdb/testsuite/gdb.base/commands.exp
+++ b/gdb/testsuite/gdb.base/commands.exp
@@ -289,7 +289,7 @@  proc_with_prefix breakpoint_clear_command_test {} {
     delete_breakpoints
     gdb_test "break factorial" "Breakpoint.*at.*"
     gdb_test_no_output "set \$bpnumfactorial = \$bpnum"
-    gdb_test "break main" "Breakpoint.*at.*"
+    gdb_test "break -q main" "Breakpoint.*at.*"
     gdb_test_no_output "set \$bpnummain = \$bpnum"
 
     gdb_test \
@@ -873,7 +873,7 @@  proc_with_prefix if_commands_test {} {
 
     set test "if_commands_test 1"
     gdb_test_no_prompt "if \$tem == 2" { >} $test
-    gdb_test_no_prompt "break main" { >} $test
+    gdb_test_no_prompt "break -q main" { >} $test
     gdb_test_no_prompt "else" { >} $test
     gdb_test_no_prompt "break factorial" { >} $test
     gdb_test_no_prompt "commands" {  >} $test
@@ -899,7 +899,7 @@  proc_with_prefix if_commands_test {} {
 
     set test "if_commands_test 2"
     gdb_test_no_prompt "if \$tem == 1" { >} $test
-    gdb_test_no_prompt "break main" { >} $test
+    gdb_test_no_prompt "break -q main" { >} $test
     gdb_test_no_prompt "else" { >} $test
     gdb_test_no_prompt "break factorial" { >} $test
     gdb_test_no_prompt "commands" {  >} $test
diff --git a/gdb/testsuite/gdb.base/condbreak.exp b/gdb/testsuite/gdb.base/condbreak.exp
index 39e93a7fc2d..05c90c30040 100644
--- a/gdb/testsuite/gdb.base/condbreak.exp
+++ b/gdb/testsuite/gdb.base/condbreak.exp
@@ -45,7 +45,7 @@  set bp_location17 [gdb_get_line_number "set breakpoint 17 here" $srcfile2]
 #
 # test break at function
 #
-gdb_test "break main" \
+gdb_test "break -q main" \
     "Breakpoint.*at.* file .*$srcfile, line.*" \
     "breakpoint function"
 
@@ -182,9 +182,9 @@  gdb_test_multiple "continue" "run until breakpoint at marker2" {
 }
 
 # Test combinations of conditional and thread-specific breakpoints.
-gdb_test "break main if (1==1) thread 999" \
+gdb_test "break -q main if (1==1) thread 999" \
     "Unknown thread 999\\."
-gdb_test "break main thread 999 if (1==1)" \
+gdb_test "break -q main thread 999 if (1==1)" \
     "Unknown thread 999\\."
 
 # Verify that both if and thread can be distinguished from a breakpoint
diff --git a/gdb/testsuite/gdb.base/ctf-ptype.exp b/gdb/testsuite/gdb.base/ctf-ptype.exp
index f981477839c..b123f9b1ddd 100644
--- a/gdb/testsuite/gdb.base/ctf-ptype.exp
+++ b/gdb/testsuite/gdb.base/ctf-ptype.exp
@@ -95,7 +95,7 @@  gdb_test "ptype enum colors" "type = enum colors \{yellow, purple, pink\}.*" "pt
 #
 gdb_test "ptype boolean" "type = enum (boolean |)\{FALSE, TRUE\}.*" "ptype unnamed typedef'd enumeration"
 
-gdb_test "list main" ".*"
+gdb_test "list -q main" ".*"
 
 # Same thing with struct and union.
 gdb_test "ptype t_struct3" "type = struct (t_struct3 |)\{.*
diff --git a/gdb/testsuite/gdb.base/define.exp b/gdb/testsuite/gdb.base/define.exp
index 272be432f8f..002bd47fcb8 100644
--- a/gdb/testsuite/gdb.base/define.exp
+++ b/gdb/testsuite/gdb.base/define.exp
@@ -179,7 +179,7 @@  with_test_prefix "command abbreviations in define" {
       -re "Type commands for definition of \"breakmain\".\r\nEnd with a line saying just \"end\".\r\n>$" {
 	  pass "$test"
 	  set test "send body of breakmain"
-	  gdb_test_multiple "break main\ncommand\necho\nend\nend" "$test"  {
+	  gdb_test_multiple "break -q main\ncommand\necho\nend\nend" "$test"  {
 	      -re "$gdb_prompt $"\
 		  {pass "$test"}
 	  }
diff --git a/gdb/testsuite/gdb.base/del.exp b/gdb/testsuite/gdb.base/del.exp
index d54eed78bf7..3cb43c46187 100644
--- a/gdb/testsuite/gdb.base/del.exp
+++ b/gdb/testsuite/gdb.base/del.exp
@@ -42,7 +42,7 @@  proc test_delete_alias { alias } {
     # Now, insert a breakpoint at an easy location, and then remove it
     # using $alias. We verified that the removal worked by checking
     # the list of breakpoints.
-    gdb_test "break main" \
+    gdb_test "break -q main" \
              "Breakpoint.*at.* file .*$srcfile, line.*" \
              "breakpoint insertion ($alias)"
     
diff --git a/gdb/testsuite/gdb.base/fullname.exp b/gdb/testsuite/gdb.base/fullname.exp
index 7905ed20927..8ef5ca97373 100644
--- a/gdb/testsuite/gdb.base/fullname.exp
+++ b/gdb/testsuite/gdb.base/fullname.exp
@@ -59,7 +59,7 @@  if { [gdb_breakpoint [standard_output_file tmp-${srcfile}]:${line} {no-message}]
     fail $msg
 }
 
-gdb_test "break main" \
+gdb_test "break -q main" \
 	 "Breakpoint.*at.*line.*" "set breakpoint at main - built absolute"
 
 set msg "set breakpoint by full path after loading symbols - built absolute"
@@ -86,7 +86,7 @@  if { [gdb_breakpoint [standard_output_file tmp-${srcfile}]:${line} {no-message}]
     fail $msg
 }
 
-gdb_test "break main" \
+gdb_test "break -q main" \
 	 "Breakpoint.*at.*line.*" "set breakpoint at main - built relative"
 
 set msg "set breakpoint by full path after loading symbols - built relative"
@@ -119,7 +119,7 @@  if { [gdb_breakpoint [standard_output_file tmp-${srcfile}]:${line} {no-message}]
     fail $msg
 }
 
-gdb_test "break main" \
+gdb_test "break -q main" \
 	 "Breakpoint.*at.*line.*" "set breakpoint at main - built other"
 
 set msg "set breakpoint by full path after loading symbols - built other"
diff --git a/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.exp b/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.exp
index 75835306de8..c1865e816f0 100644
--- a/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.exp
+++ b/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.exp
@@ -70,7 +70,7 @@  if {$is_target_remote} {
 set cant_insert_hbreak 0
 set supports_hbreak 0
 set test "probe hbreak support"
-gdb_test_multiple "hbreak main" $test {
+gdb_test_multiple "hbreak -q main" $test {
     -re "No hardware breakpoint support in the target.*$gdb_prompt $" {
 	pass $test
     }
diff --git a/gdb/testsuite/gdb.base/hbreak-unmapped.exp b/gdb/testsuite/gdb.base/hbreak-unmapped.exp
index 6a1035f89d8..64482b7a9db 100644
--- a/gdb/testsuite/gdb.base/hbreak-unmapped.exp
+++ b/gdb/testsuite/gdb.base/hbreak-unmapped.exp
@@ -40,7 +40,7 @@  delete_breakpoints
 
 set supports_hbreak 0
 set test "probe hardware breakpoint support"
-gdb_test_multiple "hbreak main" $test {
+gdb_test_multiple "hbreak -q main" $test {
     -re "No hardware breakpoint support in the target.*$gdb_prompt $" {
 	pass $test
     }
diff --git a/gdb/testsuite/gdb.base/hbreak2.exp b/gdb/testsuite/gdb.base/hbreak2.exp
index 04a003fb4e3..9a0ef08e52c 100644
--- a/gdb/testsuite/gdb.base/hbreak2.exp
+++ b/gdb/testsuite/gdb.base/hbreak2.exp
@@ -31,7 +31,7 @@  delete_breakpoints
 #
 # Test whether the target supports hardware breakpoints at all.
 #
-gdb_test_multiple "hbreak main" "hardware breakpoint support" {
+gdb_test_multiple "hbreak -q main" "hardware breakpoint support" {
     -re "No hardware breakpoint support in the target.*$gdb_prompt $" {
 	unsupported "hardware breakpoints"
 	return
@@ -63,7 +63,7 @@  delete_breakpoints
 #
 # Test break at function.
 #
-gdb_test "hbreak main" \
+gdb_test "hbreak -q main" \
     "Hardware assisted breakpoint.*at.* file .*$srcfile, line.*" \
     "hardware breakpoint function"
 delete_breakpoints
@@ -95,7 +95,7 @@  set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
 # it's wherever the processor was stopped when we connected to the
 # board.  So, to be sure, we do a list command.
 #
-gdb_test "list main" \
+gdb_test "list -q main" \
     ".*main \\(int argc, char ..argv, char ..envp\\).*" \
     "use `list' to establish default source file"
 gdb_test "hbreak $bp_location1" \
@@ -145,7 +145,7 @@  delete_breakpoints
 #
 # Run until the breakpoint at main is hit.  For non-stubs-using targets.
 #
-gdb_test "hbreak main" \
+gdb_test "hbreak -q main" \
     "Hardware assisted breakpoint.*at.* file .*$srcfile, line.*" \
     "hardware breakpoint function (2)"
 gdb_run_cmd
@@ -233,7 +233,7 @@  delete_breakpoints
 # Test temporary breakpoint at function.
 #
 
-gdb_test "thbreak main" \
+gdb_test "thbreak -q main" \
     "Hardware assisted breakpoint.*at.* file .*$srcfile, line.*" \
     "temporary hardware breakpoint function"
 delete_breakpoints
@@ -520,7 +520,7 @@  delete_breakpoints
 #
 # Test break at function.
 #
-gdb_test "hbreak main" \
+gdb_test "hbreak -q main" \
     "Hardware assisted breakpoint.*at.* file .*, line.*" \
     "hardware breakpoint function, optimized file"
 
diff --git a/gdb/testsuite/gdb.base/hw-sw-break-same-address.exp b/gdb/testsuite/gdb.base/hw-sw-break-same-address.exp
index 92896ff4db5..cbc74be5d22 100644
--- a/gdb/testsuite/gdb.base/hw-sw-break-same-address.exp
+++ b/gdb/testsuite/gdb.base/hw-sw-break-same-address.exp
@@ -42,11 +42,11 @@  gdb_test_no_output "set confirm off"
 # Test inserting a hw breakpoint first, then a sw breakpoint at the
 # same address.
 with_test_prefix "hw-sw" {
-    gdb_test "hbreak main" \
+    gdb_test "hbreak -q main" \
 	"Hardware assisted breakpoint .* at .*" \
 	"hbreak"
 
-    gdb_test "break main" \
+    gdb_test "break -q main" \
 	"Note: breakpoint .* also set at .*\r\nBreakpoint .* at .*" \
 	"break"
 
@@ -61,11 +61,11 @@  with_test_prefix "hw-sw" {
 # Now the opposite: test inserting a sw breakpoint first, then a hw
 # breakpoint at the same address.
 with_test_prefix "sw-hw" {
-    gdb_test "break main" \
+    gdb_test "break -q main" \
 	"Breakpoint .* at .*" \
 	"break"
 
-    gdb_test "hbreak main" \
+    gdb_test "hbreak -q main" \
 	"Note: breakpoint .* also set at .*\r\nHardware assisted breakpoint .* at .*" \
 	"hbreak"
 
diff --git a/gdb/testsuite/gdb.base/included.exp b/gdb/testsuite/gdb.base/included.exp
index 2a32fe4698d..d35a6abb54e 100644
--- a/gdb/testsuite/gdb.base/included.exp
+++ b/gdb/testsuite/gdb.base/included.exp
@@ -20,7 +20,7 @@  if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
 
 gdb_test_no_output "set listsize 1"
 
-gdb_test "list main" ".*"
+gdb_test "list -q main" ".*"
 get_debug_format
 set non_dwarf [expr ! [test_debug_format "DWARF 2"]]
 
diff --git a/gdb/testsuite/gdb.base/label.exp b/gdb/testsuite/gdb.base/label.exp
index 51cb8c1ad3e..83c336c3dc0 100644
--- a/gdb/testsuite/gdb.base/label.exp
+++ b/gdb/testsuite/gdb.base/label.exp
@@ -29,11 +29,11 @@  if {![runto_main]} {
   return -1
 }
 
-gdb_test "break here" \
+gdb_test "break -q here" \
   "Breakpoint.*at.*" \
   "breakpoint here"
 
-gdb_test "break main:there" \
+gdb_test "break -q main:there" \
   "Breakpoint.*at.*" \
   "breakpoint there"
 
diff --git a/gdb/testsuite/gdb.base/lineinc.exp b/gdb/testsuite/gdb.base/lineinc.exp
index f52a08143b9..4f357690f51 100644
--- a/gdb/testsuite/gdb.base/lineinc.exp
+++ b/gdb/testsuite/gdb.base/lineinc.exp
@@ -90,7 +90,7 @@  clean_restart ${binfile}
 # Any command that causes GDB to read the debugging info for the
 # lineinc.c compilation unit will do here.
 set test_name "tolerate macro info with multiple #inclusions per line"
-gdb_test_multiple "break main" $test_name {
+gdb_test_multiple "break -q main" $test_name {
     -re "Breakpoint 1 at 0x.*: file .*lineinc.c.*\\.\r\n${gdb_prompt}" {
         pass $test_name
     }
diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp
index fddc949421a..b7d0e98978d 100644
--- a/gdb/testsuite/gdb.base/list.exp
+++ b/gdb/testsuite/gdb.base/list.exp
@@ -195,16 +195,16 @@  proc test_list_function {} {
     # gcc appears to generate incorrect debugging information for code
     # in include files, which breaks this test.
     # SunPRO cc is the second case below, it's also correct.
-    gdb_test "list main" "(5\[ \t\]+int x;.*8\[ \t\]+foo \[(\]+.*\[)\]+;|1\[ \t\]+#include .*7\[ \t\]+x = 0;)" "list function in source file 1"
+    gdb_test "list -q main" "(5\[ \t\]+int x;.*8\[ \t\]+foo \[(\]+.*\[)\]+;|1\[ \t\]+#include .*7\[ \t\]+x = 0;)" "list function in source file 1"
 
     # Ultrix gdb takes the second case below; it's also correct.
     # SunPRO cc is the third case.
-    gdb_test "list bar" "(4\[ \t\]+void.*\[ \t\]*long_line.*;.*bar.*9\[ \t\]*.*|1\[ \t\]+void.*8\[ \t\]+\}|1\[ \t\]+void.*7\[ \t\]*long_line ..;|7\[ \t\]+void.*14\[ \t\]+\})" "list function in source file 2"
+    gdb_test "list -q bar" "(4\[ \t\]+void.*\[ \t\]*long_line.*;.*bar.*9\[ \t\]*.*|1\[ \t\]+void.*8\[ \t\]+\}|1\[ \t\]+void.*7\[ \t\]*long_line ..;|7\[ \t\]+void.*14\[ \t\]+\})" "list function in source file 2"
 
     # Test "list function" for C include file
     # Ultrix gdb is the second case, still correct.
     # SunPRO cc is the third case.
-    gdb_test "list foo" "(3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;|2\[ \t\]+including file.*11\[ \t\]+bar \[(\]+.*\[)\]+;|1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;)" "list function in include file"
+    gdb_test "list -q foo" "(3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;|2\[ \t\]+including file.*11\[ \t\]+bar \[(\]+.*\[)\]+;|1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;)" "list function in include file"
 }
 
 proc test_list_forward {} {
diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp
index ec6c1a9258e..1ecb4b80e4c 100644
--- a/gdb/testsuite/gdb.base/macscp.exp
+++ b/gdb/testsuite/gdb.base/macscp.exp
@@ -193,7 +193,7 @@  proc list_and_check_macro {func macro expected} {
     return [check_macro $macro $expected "after `list $func'"]
 }
 
-gdb_test "list main" ".*main.*" "list main for support check"
+gdb_test "list -q main" ".*main.*" "list main for support check"
 set macro_support "unknown"
 gdb_test_multiple "info source" "test macro information"  {
     -re "Includes preprocessor macro info\..*$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.base/pending.exp b/gdb/testsuite/gdb.base/pending.exp
index 03dcf3fdfca..cb9e4f2158e 100644
--- a/gdb/testsuite/gdb.base/pending.exp
+++ b/gdb/testsuite/gdb.base/pending.exp
@@ -102,7 +102,7 @@  gdb_test "info break" \
 
 set mainline [gdb_get_line_number "break main here"]
 
-gdb_test "break main" \
+gdb_test "break -q main" \
     "Breakpoint.*at.* file .*$srcfile, line $mainline.*" \
     "breakpoint function"
 
diff --git a/gdb/testsuite/gdb.base/prologue-include.exp b/gdb/testsuite/gdb.base/prologue-include.exp
index a3cdd86a2b7..483c3667729 100644
--- a/gdb/testsuite/gdb.base/prologue-include.exp
+++ b/gdb/testsuite/gdb.base/prologue-include.exp
@@ -21,6 +21,6 @@  if { [prepare_for_testing "failed to prepare" ${testfile}] } {
 
 set bp_main [gdb_get_line_number "break main" ${testfile}.h]
 
-gdb_test "break main" \
+gdb_test "break -q main" \
     "Breakpoint.*at.* file .*$testfile.h, line $bp_main\\." \
     "breakpoint main"
diff --git a/gdb/testsuite/gdb.base/ptype.exp b/gdb/testsuite/gdb.base/ptype.exp
index e1ba7d07320..16d29376047 100644
--- a/gdb/testsuite/gdb.base/ptype.exp
+++ b/gdb/testsuite/gdb.base/ptype.exp
@@ -116,7 +116,7 @@  if {!$gcc_compiled} {
 }
 
 # For get_debug_format to do its job, we need to have a current source file.
-gdb_test "list main" ".*"
+gdb_test "list -q main" ".*"
 get_debug_format
 gdb_test "whatis v_boolean" "type = (enum |)boolean" \
   "whatis unnamed typedef'd enum (compiler bug in IBM's xlc)"
diff --git a/gdb/testsuite/gdb.base/sepdebug.exp b/gdb/testsuite/gdb.base/sepdebug.exp
index bdbfa2c98ee..502c664d95c 100644
--- a/gdb/testsuite/gdb.base/sepdebug.exp
+++ b/gdb/testsuite/gdb.base/sepdebug.exp
@@ -81,14 +81,14 @@  if { $gdb_file_cmd_debug_info != "debug" } then {
 #
 # test break at function
 #
-gdb_test "break main" \
+gdb_test "break -q main" \
     "Breakpoint.*at.* file .*$srcfile, line.*" \
     "breakpoint function"
 
 #
 # test break at quoted function
 #
-gdb_test "break \"marker2\"" \
+gdb_test "break -q \"marker2\"" \
     "Breakpoint.*at.* file .*$srcfile, line.*" \
     "breakpoint quoted function"
 
@@ -110,7 +110,7 @@  set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
 # it's wherever the processor was stopped when we connected to the
 # board.  So, to be sure, we do a list command.
 #
-gdb_test "list main" \
+gdb_test "list -q main" \
     ".*main \\(int argc, char \\*\\*argv, char \\*\\*envp\\).*" \
     "use `list' to establish default source file"
 gdb_test "break $bp_location1" \
@@ -227,7 +227,7 @@  delete_breakpoints
 # test temporary breakpoint at function
 #
 
-gdb_test "tbreak main" "Temporary breakpoint.*at.* file .*$srcfile, line.*" "temporary breakpoint function"
+gdb_test "tbreak -q main" "Temporary breakpoint.*at.* file .*$srcfile, line.*" "temporary breakpoint function"
 
 #
 # test break at function in file
@@ -569,7 +569,7 @@  proc test_different_dir {type test_different_dir xfail} {
 	if {$xfail} {
 	    setup_xfail "*-*-*"
 	}
-	gdb_test "break main" \
+	gdb_test "break -q main" \
 	    "Breakpoint.*at.* file .*$srcfile, line.*" \
 	    "breakpoint function, optimized file"
 
diff --git a/gdb/testsuite/gdb.base/server-del-break.exp b/gdb/testsuite/gdb.base/server-del-break.exp
index 7fd95847ad4..7467092eaa3 100644
--- a/gdb/testsuite/gdb.base/server-del-break.exp
+++ b/gdb/testsuite/gdb.base/server-del-break.exp
@@ -24,7 +24,7 @@  if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
     return -1
 }
 
-gdb_test "break main" \
+gdb_test "break -q main" \
          "Breakpoint.*at.* file .*$srcfile, line .*"
 
 # Try deleting all breakpoints, using the "server" command prefix.
diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp
index ef9f7c80a5a..28c270591ba 100644
--- a/gdb/testsuite/gdb.base/style.exp
+++ b/gdb/testsuite/gdb.base/style.exp
@@ -63,7 +63,7 @@  save_vars { env(TERM) } {
 	"frame without styling"
     gdb_test_no_output "set style sources on"
 
-    gdb_test "break main" "file $base_file_expr.*"
+    gdb_test "break -q main" "file $base_file_expr.*"
 
     gdb_test "print &main" " = .* [style $hex address] <$main_expr>"
 
diff --git a/gdb/testsuite/gdb.base/symbol-without-target_section.exp b/gdb/testsuite/gdb.base/symbol-without-target_section.exp
index 79d47e28de9..af0797e1fb6 100644
--- a/gdb/testsuite/gdb.base/symbol-without-target_section.exp
+++ b/gdb/testsuite/gdb.base/symbol-without-target_section.exp
@@ -16,7 +16,7 @@ 
 # Exploit formerly failed assertion in scan_dyntag when it got called for
 # objfile having ".dynamic" section but without having data loaded in target.
 # Such file is ${binmainfile} through add-symbol-file here.  Set context first
-# by "list main" to have some local BLOCK set in lookup_symbol_global.
+# by "list -q main" to have some local BLOCK set in lookup_symbol_global.
 
 standard_testfile start.c .c
 set binlibfile ${testfile}.x
@@ -35,5 +35,5 @@  gdb_test "add-symbol-file [standard_output_file ${testfile}] 0" \
     "Reading symbols from .*" \
     "add-symbol-file" \
     "add symbol table from file \".*\" at.*\\(y or n\\) " "y"
-gdb_test "list main"
+gdb_test "list -q main"
 gdb_test "print symbol_without_target_section"
diff --git a/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp b/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp
index 3d3d3c479d5..61ad83db55f 100644
--- a/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp
+++ b/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp
@@ -118,7 +118,7 @@  proc build_cmds_list {} {
     }
 
     set test "hbreak"
-    gdb_test_multiple "hbreak main" $test {
+    gdb_test_multiple "hbreak -q main" $test {
 	-re "You may have requested too many.*$gdb_prompt $" {
 	    unsupported $test
 	}
diff --git a/gdb/testsuite/gdb.cp/exception.exp b/gdb/testsuite/gdb.cp/exception.exp
index 341de192a6b..ce038d083e4 100644
--- a/gdb/testsuite/gdb.cp/exception.exp
+++ b/gdb/testsuite/gdb.cp/exception.exp
@@ -73,7 +73,7 @@  gdb_test_multiple "info breakpoints" $name {
       }
 }
 
-gdb_test "tbreak main" "Temporary breakpoint 4.*" \
+gdb_test "tbreak -q main" "Temporary breakpoint 4.*" \
     "Set temporary breakpoint at main"
 
 set ok 0
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-error.exp b/gdb/testsuite/gdb.dwarf2/dw2-error.exp
index 5583e368781..53d6339dee7 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-error.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-error.exp
@@ -45,4 +45,4 @@  gdb_test "file $binfile" \
     "file $testfile"
 
 # Now check that we can still break given the minimal symbol.
-gdb_test "break main" "Breakpoint $decimal.*"
+gdb_test "break -q main" "Breakpoint $decimal.*"
diff --git a/gdb/testsuite/gdb.dwarf2/fission-mix.exp b/gdb/testsuite/gdb.dwarf2/fission-mix.exp
index aa7bfb19a54..cede8cb84a1 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-mix.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-mix.exp
@@ -37,7 +37,7 @@  if {[gdb_compile "$objfile $objfile2" $binfile executable {debug}] != "" } {
 
 clean_restart $binfile
 
-gdb_test "break main" "Breakpoint .*"
+gdb_test "break -q main" "Breakpoint .*"
 
 # Bug 15691: gdb would crash here on an assert violation.
 # The debug info for the TU for "struct s" has already been read,
diff --git a/gdb/testsuite/gdb.dwarf2/fission-reread.exp b/gdb/testsuite/gdb.dwarf2/fission-reread.exp
index f74855ef589..1994ad7a599 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-reread.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-reread.exp
@@ -45,7 +45,7 @@  gdb_test_no_output "set debug-file-directory [file dirname $binfile]" \
     "set debug-file-directory"
 gdb_load $binfile
 
-gdb_test "break main" "Breakpoint.*at.*"
+gdb_test "break -q main" "Breakpoint.*at.*"
 
 gdb_test "ptype baz" "type = class foo {.*"
 
diff --git a/gdb/testsuite/gdb.dwarf2/pr13961.exp b/gdb/testsuite/gdb.dwarf2/pr13961.exp
index bf898487b6e..69d6aa17a41 100644
--- a/gdb/testsuite/gdb.dwarf2/pr13961.exp
+++ b/gdb/testsuite/gdb.dwarf2/pr13961.exp
@@ -32,7 +32,7 @@  if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
     return -1
 }
 
-gdb_test "break main" "Breakpoint.*at.*"
+gdb_test "break -q main" "Breakpoint.*at.*"
 
 # If we get this far gdb didn't crash.
 pass $testfile
diff --git a/gdb/testsuite/gdb.linespec/explicit.exp b/gdb/testsuite/gdb.linespec/explicit.exp
index c01a425ece1..e9ccbbb7403 100644
--- a/gdb/testsuite/gdb.linespec/explicit.exp
+++ b/gdb/testsuite/gdb.linespec/explicit.exp
@@ -611,15 +611,15 @@  namespace eval $testfile {
 
     # Test explicit "ranges."  Make sure that using explicit
     # locations doesn't alter the expected outcome.
-    gdb_test "list main" ".*" "list main 1"
+    gdb_test "list -q main" ".*" "list main 1"
     set list_result [capture_command_output "list -,+" ""]
-    gdb_test "list main" ".*" "list main 2"
+    gdb_test "list -q main" ".*" "list main 2"
     gdb_test "list -line -,-line +" [string_to_regexp $list_result]
 
     # Ditto for the reverse (except that no output is expected).
-    gdb_test "list myfunction" ".*" "list myfunction 1"
+    gdb_test "list -q myfunction" ".*" "list myfunction 1"
     gdb_test_no_output "list +,-"
-    gdb_test "list myfunction" ".*" "list myfunction 2"
+    gdb_test "list -q myfunction" ".*" "list myfunction 2"
     gdb_test_no_output "list -line +, -line -"
 }
 
diff --git a/gdb/testsuite/gdb.linespec/linespec.exp b/gdb/testsuite/gdb.linespec/linespec.exp
index be1b9189e20..d82fc7cdd04 100644
--- a/gdb/testsuite/gdb.linespec/linespec.exp
+++ b/gdb/testsuite/gdb.linespec/linespec.exp
@@ -213,6 +213,6 @@  gdb_test "file $binfile" \
     "Reading symbols from .*" \
     "set the new inferior file for linespec tests"
 
-gdb_test "break main" \
-    "Breakpoint \[0-9\]+ at $hex: main. .2 locations." \
+gdb_test "break -q main" \
+    "Breakpoint \[0-9\]+ at $hex: -qualified main. .2 locations." \
     "set breakpoint at main in both inferiors"
diff --git a/gdb/testsuite/gdb.mi/mi-simplerun.exp b/gdb/testsuite/gdb.mi/mi-simplerun.exp
index 20a079ead89..2838c07c627 100644
--- a/gdb/testsuite/gdb.mi/mi-simplerun.exp
+++ b/gdb/testsuite/gdb.mi/mi-simplerun.exp
@@ -65,7 +65,7 @@  proc test_breakpoints_creation_and_listing {} {
     # -break-info
 
     set bps {}
-    lappend bps [mi_create_breakpoint "main" \
+    lappend bps [mi_create_breakpoint "--qualified main" \
 		     "break-insert operation" \
 		     -number 1 -func main -file ".*basics.c" \
 		     -line $line_main_body]
diff --git a/gdb/testsuite/gdb.python/py-mi-objfile-gdb.py b/gdb/testsuite/gdb.python/py-mi-objfile-gdb.py
index 0b9c4a3fffc..5266fa2adef 100644
--- a/gdb/testsuite/gdb.python/py-mi-objfile-gdb.py
+++ b/gdb/testsuite/gdb.python/py-mi-objfile-gdb.py
@@ -23,4 +23,4 @@  import gdb
 # parameter change notification.
 gdb.execute("set width 101", to_string=True)
 # And finally a command that will use the console stream without redirection
-gdb.execute("list main")
+gdb.execute("list -q main")
diff --git a/gdb/testsuite/gdb.server/bkpt-other-inferior.exp b/gdb/testsuite/gdb.server/bkpt-other-inferior.exp
index 7ad38ea1b25..5ff0513ecf3 100644
--- a/gdb/testsuite/gdb.server/bkpt-other-inferior.exp
+++ b/gdb/testsuite/gdb.server/bkpt-other-inferior.exp
@@ -79,11 +79,11 @@  foreach inf_sel {1 2} {
 	    "switch to inferior"
 
 	set test "set breakpoint"
-	gdb_test_multiple "break main" $test {
+	gdb_test_multiple "break -q main" $test {
 	    -re "Sending packet.*$gdb_prompt $" {
 		fail $test
 	    }
-	    -re "^break main\r\nBreakpoint .* at .*$gdb_prompt $" {
+	    -re "^break -q main\r\nBreakpoint .* at .*$gdb_prompt $" {
 		pass $test
 	    }
 	}
diff --git a/gdb/testsuite/gdb.server/connect-without-multi-process.exp b/gdb/testsuite/gdb.server/connect-without-multi-process.exp
index 123089260dd..7e3579f087a 100644
--- a/gdb/testsuite/gdb.server/connect-without-multi-process.exp
+++ b/gdb/testsuite/gdb.server/connect-without-multi-process.exp
@@ -45,7 +45,7 @@  proc do_test {multiprocess} {
     set gdbserver_protocol [lindex $res 0]
     set gdbserver_gdbport [lindex $res 1]
 
-    gdb_test "break main" "Breakpoint .*"
+    gdb_test "break -q main" "Breakpoint .*"
 
     gdb_test "target $gdbserver_protocol $gdbserver_gdbport" \
 	"Remote debugging using .*" \
diff --git a/gdb/testsuite/gdb.trace/change-loc.exp b/gdb/testsuite/gdb.trace/change-loc.exp
index 118f980987a..8cb8cc66af8 100644
--- a/gdb/testsuite/gdb.trace/change-loc.exp
+++ b/gdb/testsuite/gdb.trace/change-loc.exp
@@ -214,7 +214,7 @@  proc tracepoint_change_loc_2 { trace_type } {
 	    "tracepoint with one location"
 
 	set main_bp 0
-	gdb_test_multiple "break main" "set breakpoint on main" {
+	gdb_test_multiple "break -q main" "set breakpoint on main" {
 	    -re "Breakpoint (\[0-9\]*) at .*, line.*$gdb_prompt $" {
 		set main_bp $expect_out(1,string)
 	    }
diff --git a/gdb/testsuite/gdb.trace/pending.exp b/gdb/testsuite/gdb.trace/pending.exp
index a3d02ee0c89..c817bafff30 100644
--- a/gdb/testsuite/gdb.trace/pending.exp
+++ b/gdb/testsuite/gdb.trace/pending.exp
@@ -90,7 +90,7 @@  proc pending_tracepoint_resolved { trace_type } {
 
 	gdb_load ${binfile}
 
-	gdb_test "break main" "Breakpoint.*at.* file .*$srcfile, line.*" \
+	gdb_test "break -q main" "Breakpoint.*at.* file .*$srcfile, line.*" \
 	    "breakpoint function"
 
 	gdb_run_cmd
@@ -132,7 +132,7 @@  proc pending_tracepoint_works { trace_type } {
 	    "single pending tracepoint info"
 
 	# Run to main which should resolve a pending tracepoint
-	gdb_test "break main" "Breakpoint.*at.* file .*$srcfile, line.*" \
+	gdb_test "break -q main" "Breakpoint.*at.* file .*$srcfile, line.*" \
 	    "breakpoint function"
 	gdb_run_cmd
 	gdb_test "" "Breakpoint 2, main.*"
diff --git a/gdb/testsuite/gdb.tui/basic.exp b/gdb/testsuite/gdb.tui/basic.exp
index 0296e542868..e334848602d 100644
--- a/gdb/testsuite/gdb.tui/basic.exp
+++ b/gdb/testsuite/gdb.tui/basic.exp
@@ -33,8 +33,8 @@  set text [Term::get_all_lines]
 gdb_assert {![string match "No Source Available" $text]} \
     "initial source listing"
 
-Term::command "list main"
-Term::check_contents "list main" "21 *return 0"
+Term::command "list -q main"
+Term::check_contents "list -q main" "21 *return 0"
 
 # Get the first source line.
 set line [Term::get_line 1]
diff --git a/gdb/testsuite/gdb.tui/list-before.exp b/gdb/testsuite/gdb.tui/list-before.exp
index fce745db7e0..3969516d95c 100644
--- a/gdb/testsuite/gdb.tui/list-before.exp
+++ b/gdb/testsuite/gdb.tui/list-before.exp
@@ -25,7 +25,7 @@  if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} {
 
 Term::clean_restart 24 80 $testfile
 
-gdb_test "list main"
+gdb_test "list -q main"
 
 if {![Term::enter_tui]} {
     unsupported "TUI not supported"
diff --git a/gdb/testsuite/gdb.tui/list.exp b/gdb/testsuite/gdb.tui/list.exp
index 576b33fa869..a31c912428a 100644
--- a/gdb/testsuite/gdb.tui/list.exp
+++ b/gdb/testsuite/gdb.tui/list.exp
@@ -34,9 +34,9 @@  Term::check_contents "initial source listing" "21 *return 0"
 Term::command "layout asm"
 Term::check_contents "asm window shows main" "$hex <main>"
 
-Term::command "list main"
-Term::check_contents "list main" "21 *return 0"
-# The following 'focus next' must be immediately after 'list main' to
-# ensure that GDB has a valid idea of what is currently focused.
+Term::command "list -q main"
+Term::check_contents "list -q main" "21 *return 0"
+# The following 'focus next' must be immediately after 'list -q main'
+# to ensure that GDB has a valid idea of what is currently focused.
 Term::command "focus next"
 Term::check_contents "focus next" "Focus set to cmd window"
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 4c9675f255f..63ba8008c3d 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -5942,7 +5942,7 @@  gdb_caching_proc gdb_has_argv0 {
 	gdb_load "$exe"
 
 	# Set breakpoint on main.
-	gdb_test_multiple "break main" "break main" {
+	gdb_test_multiple "break -q main" "break -q main" {
 	    -re "Breakpoint.*${gdb_prompt} $" {
 	    }
 	    -re "${gdb_prompt} $" {