public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/5] runto_main and -qualified
@ 2020-10-12  0:47 Pedro Alves
  2020-10-12  0:47 ` [PATCH 1/5] 'runto main' -> 'runto_main' throughout Pedro Alves
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Pedro Alves @ 2020-10-12  0:47 UTC (permalink / raw)
  To: gdb-patches

This patchset makes the testsuite use "-qualified" when setting a
breakpoint at main, to avoid hitting unrelated locations in some
runtimes.

Pedro Alves (5):
  'runto main' -> 'runto_main' throughout
  Introduce mi_runto_main
  gdb/testsuite/: Use -qualified in runto_main / mi_runto_main
  gdb/testsuite/: Use "-qualified" in explicit "break main", etc.
  Eliminate mi_run_to_main, introduce mi_clean_restart

 gdb/testsuite/config/monitor.exp                   |  2 +-
 gdb/testsuite/gdb.ada/fun_in_declare.exp           |  2 +-
 gdb/testsuite/gdb.ada/mi_catch_assert.exp          | 11 +----
 gdb/testsuite/gdb.ada/mi_catch_ex.exp              | 13 ++---
 gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp         |  9 ++--
 gdb/testsuite/gdb.ada/mi_dyn_arr.exp               | 11 +----
 gdb/testsuite/gdb.ada/mi_exc_info.exp              |  7 +--
 gdb/testsuite/gdb.ada/mi_interface.exp             | 13 ++---
 gdb/testsuite/gdb.ada/mi_prot.exp                  |  7 +--
 gdb/testsuite/gdb.ada/mi_ref_changeable.exp        | 11 +----
 gdb/testsuite/gdb.ada/mi_string_access.exp         | 11 +----
 gdb/testsuite/gdb.ada/mi_var_access.exp            | 10 +---
 gdb/testsuite/gdb.ada/mi_var_array.exp             | 11 +----
 gdb/testsuite/gdb.ada/mi_var_union.exp             | 11 +----
 gdb/testsuite/gdb.ada/mi_variant.exp               | 11 +----
 gdb/testsuite/gdb.ada/small_reg_param.exp          |  2 +-
 gdb/testsuite/gdb.arch/gdb1558.exp                 |  6 +--
 gdb/testsuite/gdb.arch/i386-permbkpt.exp           |  4 +-
 .../gdb.arch/i386-prologue-skip-cf-protection.exp  |  2 +-
 gdb/testsuite/gdb.arch/powerpc-d128-regs.exp       |  2 +-
 gdb/testsuite/gdb.base/annota1.exp                 |  2 +-
 gdb/testsuite/gdb.base/anon.exp                    |  2 +-
 gdb/testsuite/gdb.base/break.exp                   |  8 +--
 gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp |  2 +-
 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/dprintf-non-stop.exp        |  2 +-
 gdb/testsuite/gdb.base/dprintf.exp                 |  4 +-
 gdb/testsuite/gdb.base/fullname.exp                |  6 +--
 gdb/testsuite/gdb.base/gdb11530.exp                |  2 +-
 gdb/testsuite/gdb.base/gdb11531.exp                |  2 +-
 gdb/testsuite/gdb.base/gnu_vector.exp              |  2 +-
 .../gdb.base/hbreak-in-shr-unsupported.exp         |  2 +-
 gdb/testsuite/gdb.base/hbreak-unmapped.exp         |  2 +-
 gdb/testsuite/gdb.base/hbreak2.exp                 | 12 ++---
 .../gdb.base/hw-sw-break-same-address.exp          |  8 +--
 gdb/testsuite/gdb.base/included.exp                |  2 +-
 gdb/testsuite/gdb.base/interrupt-noterm.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/memattr.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/step-over-syscall.exp       |  4 +-
 gdb/testsuite/gdb.base/style.exp                   |  2 +-
 .../gdb.base/symbol-without-target_section.exp     |  4 +-
 gdb/testsuite/gdb.base/ui-redirect.exp             |  2 +-
 gdb/testsuite/gdb.base/watch-cond-infcall.exp      |  2 +-
 gdb/testsuite/gdb.base/watch-read.exp              |  2 +-
 gdb/testsuite/gdb.base/watch-vfork.exp             |  2 +-
 gdb/testsuite/gdb.base/watch_thread_num.exp        |  2 +-
 gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp   |  2 +-
 .../gdb.base/watchpoint-stops-at-right-insn.exp    |  4 +-
 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.guile/scm-breakpoint.exp         |  2 +-
 gdb/testsuite/gdb.guile/scm-frame-inline.exp       |  2 +-
 gdb/testsuite/gdb.linespec/explicit.exp            | 10 ++--
 gdb/testsuite/gdb.linespec/linespec.exp            |  4 +-
 gdb/testsuite/gdb.mi/gdb2549.exp                   | 11 ++---
 gdb/testsuite/gdb.mi/gdb669.exp                    |  8 +--
 gdb/testsuite/gdb.mi/gdb701.exp                    |  8 +--
 gdb/testsuite/gdb.mi/gdb792.exp                    | 15 ++----
 gdb/testsuite/gdb.mi/mi-break.exp                  |  2 +-
 gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp     |  8 ++-
 .../gdb.mi/mi-breakpoint-multiple-locations.exp    |  9 ++--
 gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp   | 11 ++---
 gdb/testsuite/gdb.mi/mi-catch-load.exp             | 18 ++-----
 gdb/testsuite/gdb.mi/mi-cli.exp                    |  9 ++--
 gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp      |  7 ++-
 gdb/testsuite/gdb.mi/mi-complete.exp               |  9 ++--
 gdb/testsuite/gdb.mi/mi-console.exp                |  4 +-
 gdb/testsuite/gdb.mi/mi-detach.exp                 |  8 +--
 gdb/testsuite/gdb.mi/mi-disassemble.exp            |  8 +--
 gdb/testsuite/gdb.mi/mi-dprintf.exp                | 10 +---
 gdb/testsuite/gdb.mi/mi-exit-code.exp              | 14 +++---
 gdb/testsuite/gdb.mi/mi-fill-memory.exp            |  8 +--
 gdb/testsuite/gdb.mi/mi-fortran-modules.exp        |  7 +--
 gdb/testsuite/gdb.mi/mi-frame-regs.exp             | 14 +++---
 gdb/testsuite/gdb.mi/mi-info-os.exp                |  2 +-
 gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp        |  7 +--
 gdb/testsuite/gdb.mi/mi-logging.exp                |  9 ++--
 gdb/testsuite/gdb.mi/mi-nonstop-exit.exp           | 14 ++----
 gdb/testsuite/gdb.mi/mi-nonstop.exp                | 18 +++----
 gdb/testsuite/gdb.mi/mi-ns-stale-regcache.exp      | 10 +---
 gdb/testsuite/gdb.mi/mi-nsintrall.exp              | 10 +---
 gdb/testsuite/gdb.mi/mi-nsmoribund.exp             | 10 +---
 gdb/testsuite/gdb.mi/mi-nsthrexec.exp              | 10 +---
 gdb/testsuite/gdb.mi/mi-read-memory.exp            |  8 +--
 gdb/testsuite/gdb.mi/mi-record-changed.exp         |  7 ++-
 gdb/testsuite/gdb.mi/mi-regs.exp                   |  9 ++--
 gdb/testsuite/gdb.mi/mi-reverse.exp                |  8 +--
 gdb/testsuite/gdb.mi/mi-simplerun.exp              |  2 +-
 gdb/testsuite/gdb.mi/mi-stepi.exp                  |  8 +--
 gdb/testsuite/gdb.mi/mi-stepn.exp                  |  9 ++--
 gdb/testsuite/gdb.mi/mi-sym-info.exp               |  7 +--
 gdb/testsuite/gdb.mi/mi-syn-frame.exp              |  6 +--
 gdb/testsuite/gdb.mi/mi-var-cmd.exp                |  2 +-
 gdb/testsuite/gdb.mi/mi-var-create-rtti.exp        | 11 +----
 gdb/testsuite/gdb.mi/mi-var-invalidate.exp         |  2 +-
 .../mi-var-list-children-invalid-grandchild.exp    |  2 +-
 gdb/testsuite/gdb.mi/mi-watch-nonstop.exp          | 10 +---
 gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp     | 14 +++---
 gdb/testsuite/gdb.mi/new-ui-mi-sync.exp            |  2 +-
 gdb/testsuite/gdb.mi/pr11022.exp                   |  8 ++-
 .../gdb.mi/user-selected-context-sync.exp          |  2 +-
 gdb/testsuite/gdb.opt/inline-break.exp             | 10 ++--
 gdb/testsuite/gdb.opt/inline-cmds.exp              |  2 +-
 gdb/testsuite/gdb.python/py-frame-inline.exp       |  2 +-
 gdb/testsuite/gdb.python/py-framefilter-mi.exp     |  2 +-
 gdb/testsuite/gdb.python/py-mi-events.exp          |  3 +-
 gdb/testsuite/gdb.python/py-mi-objfile-gdb.py      |  2 +-
 .../gdb.python/py-mi-var-info-path-expression.exp  | 11 ++---
 gdb/testsuite/gdb.python/py-mi.exp                 |  4 +-
 gdb/testsuite/gdb.reverse/break-precsave.exp       |  2 +-
 gdb/testsuite/gdb.reverse/break-reverse.exp        |  2 +-
 gdb/testsuite/gdb.reverse/consecutive-precsave.exp |  2 +-
 gdb/testsuite/gdb.reverse/consecutive-reverse.exp  |  2 +-
 gdb/testsuite/gdb.reverse/finish-precsave.exp      |  2 +-
 gdb/testsuite/gdb.reverse/finish-reverse.exp       |  2 +-
 gdb/testsuite/gdb.reverse/fstatat-reverse.exp      |  2 +-
 gdb/testsuite/gdb.reverse/getresuid-reverse.exp    |  2 +-
 gdb/testsuite/gdb.reverse/i386-precsave.exp        |  2 +-
 gdb/testsuite/gdb.reverse/i386-reverse.exp         |  2 +-
 gdb/testsuite/gdb.reverse/i386-sse-reverse.exp     |  2 +-
 gdb/testsuite/gdb.reverse/i387-env-reverse.exp     |  2 +-
 gdb/testsuite/gdb.reverse/i387-stack-reverse.exp   |  2 +-
 gdb/testsuite/gdb.reverse/insn-reverse.exp         |  2 +-
 .../gdb.reverse/machinestate-precsave.exp          |  2 +-
 gdb/testsuite/gdb.reverse/machinestate.exp         |  2 +-
 gdb/testsuite/gdb.reverse/pipe-reverse.exp         |  2 +-
 gdb/testsuite/gdb.reverse/readv-reverse.exp        |  2 +-
 gdb/testsuite/gdb.reverse/recvmsg-reverse.exp      |  2 +-
 gdb/testsuite/gdb.reverse/rerun-prec.exp           |  2 +-
 gdb/testsuite/gdb.reverse/s390-mvcle.exp           |  2 +-
 gdb/testsuite/gdb.reverse/solib-precsave.exp       |  2 +-
 gdb/testsuite/gdb.reverse/solib-reverse.exp        |  2 +-
 gdb/testsuite/gdb.reverse/step-precsave.exp        |  2 +-
 gdb/testsuite/gdb.reverse/step-reverse.exp         |  2 +-
 gdb/testsuite/gdb.reverse/time-reverse.exp         |  2 +-
 gdb/testsuite/gdb.reverse/until-precsave.exp       |  2 +-
 gdb/testsuite/gdb.reverse/until-reverse.exp        |  2 +-
 gdb/testsuite/gdb.reverse/waitpid-reverse.exp      |  2 +-
 gdb/testsuite/gdb.reverse/watch-precsave.exp       |  2 +-
 gdb/testsuite/gdb.reverse/watch-reverse.exp        |  2 +-
 gdb/testsuite/gdb.server/bkpt-other-inferior.exp   |  4 +-
 .../gdb.server/connect-without-multi-process.exp   |  2 +-
 gdb/testsuite/gdb.threads/kill.exp                 |  2 +-
 gdb/testsuite/gdb.threads/tid-reuse.exp            |  2 +-
 gdb/testsuite/gdb.trace/change-loc.exp             |  2 +-
 .../gdb.trace/mi-trace-frame-collected.exp         |  6 +--
 gdb/testsuite/gdb.trace/mi-trace-unavailable.exp   |  6 +--
 gdb/testsuite/gdb.trace/mi-traceframe-changed.exp  | 12 ++---
 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                          |  4 +-
 gdb/testsuite/lib/mi-support.exp                   | 57 +++++++++++++++-------
 170 files changed, 362 insertions(+), 568 deletions(-)


base-commit: 307f2595ddeebff38f95045b25be937e6b72eff2
prerequisite-patch-id: b85398e03202a588cd70a4fcacdf7f49d72472c7
prerequisite-patch-id: b704f2ea0cd9bedc5bc2bc4b8c2c3293cffaad43
prerequisite-patch-id: f3191bfd4993fe9590969fa98ab26180fdb9ce05
prerequisite-patch-id: 8f2ddc01f9d78e865866437bead3ad8a23f00960
prerequisite-patch-id: 350b356bfd69a2d006e88840d67b97674b729006
prerequisite-patch-id: 65513b25c462e840f20e958e5fbcf7977ffd5780
prerequisite-patch-id: df07677645ebcbfb5bc64853a69afa8b787b1f3c
prerequisite-patch-id: aaee44ad7e606a7b8005e50e07fed3d889fca273
prerequisite-patch-id: 07bb01a00f4ec3909ba7034a5f824b18f7321d7a
prerequisite-patch-id: 4ea5de53d195b08d1f53b8e166b210c107ed27bf
prerequisite-patch-id: 8a76dc24f80334ad88f9047bb688d380f52d6161
prerequisite-patch-id: 763bfd89d8a18768e63342a2e566996aa9a4dee1
prerequisite-patch-id: a59a2cdce7d9498b4702b6facfb1f23bf3305645
prerequisite-patch-id: 80c43d8ac7b99ca812827898d055ced8b6ed7f59
prerequisite-patch-id: e9a632f7d3484ef20e85910bd8809fdc8bb197fd
prerequisite-patch-id: 7e018252a12a350938906d4be9e99e75c777e095
prerequisite-patch-id: deff912a5df699495c489163126d497b32fcfa64
prerequisite-patch-id: a8f17d1109745acbf999999e2342a56c89930173
prerequisite-patch-id: da855c12f8ea6182eda0a4c9993c099c730d78e9
prerequisite-patch-id: 5a805031ec6aa5d3fe6b14e274c9733a4c280433
prerequisite-patch-id: 3b9a62b4424e865674c5d3f776c69d8bc4024ef7
prerequisite-patch-id: ad4e30fe22b1521cee3bbd1dfa59581ce7e8b0d4
prerequisite-patch-id: 4da593fb297c0268a9b7e242c7348b4fef986db6
prerequisite-patch-id: a51356e0a26d476ce63fa712a7bc0de89ba834f9
prerequisite-patch-id: dec170ee5267bc8cf1b4c74bbd96b169bce091e1
prerequisite-patch-id: b19121613bf5e6987c69cfddfa1b95ace5f4c635
prerequisite-patch-id: 8be39d95d7c25a35dc22b4372e7ebe1abfb1a89c
prerequisite-patch-id: a47960439373d667708a8ac91791470d2c6ffcf5
prerequisite-patch-id: 87656f370d8608e17bfac777356fd1f5c15fddcd
prerequisite-patch-id: 0d6adb9ed40a14eacea413a52edae455b33cd0e1
prerequisite-patch-id: fb1f939366cd97ecc9c74d029648b3ea05851380
prerequisite-patch-id: 179be21aa112f637f5af66428f5601321f717066
prerequisite-patch-id: 48f58874ac17ecbfd0365516d57605e35aba615e
prerequisite-patch-id: 8317e3dd97e5cf21b81384c92d41381c24a07852
prerequisite-patch-id: bdb03b9c14457a7a66a3871db760dd3f5a740533
prerequisite-patch-id: 60c8b7b1ce885ec6a6893dea65d0ebbaae908ef5
prerequisite-patch-id: c8612af15abe57aadc25ea38a0555e8345e715da
prerequisite-patch-id: b0cd1cea8424b4675feaf385fc5bb8423c8186fb
prerequisite-patch-id: 5d174de823dc4692df7a67d12aa970795e7741c9
prerequisite-patch-id: 1c6231adc0b412c317e5ae1f3adfe70a00a6d1ee
prerequisite-patch-id: 4f397987a2b073a72744f98a1bd5156e950af0dc
prerequisite-patch-id: 3b7cb3f95e36c2699414a475dfc2065dcc821a16
prerequisite-patch-id: e2f5a8806a7f10edd42685a8b8387cddeb9c834c
prerequisite-patch-id: 4e1783c8274e559c8f5b5f0c6090ab3e75f0ea36
prerequisite-patch-id: dcb7dcbd0cb4e09804a40d4639558a28e186ebb0
prerequisite-patch-id: eb0333dcba33d1609e4648773608100143a86599
prerequisite-patch-id: 456805a797bea8d4cddf9c853d4e329aa65681a3
prerequisite-patch-id: 89bd9efd8707ba76513e0f25c26c660f1061c3ef
prerequisite-patch-id: 9ef30ac9003ecc1e8c23ace8ab4be9047686d6d0
prerequisite-patch-id: 5a1d4c983919111632751f678a1f805d606add24
prerequisite-patch-id: 6163c5e2551daffae5a9680fe20e8540fcc941db
prerequisite-patch-id: ba9ef65b17b632d1dd1e15821ef537933668750c
prerequisite-patch-id: 6faca4e48bf196c5640d5bb22b9ac97173030094
prerequisite-patch-id: 965f5924d218855a7e011be2ec82aa32b7f17569
prerequisite-patch-id: b560c9c8bf5e9adb167b7ad165306e2664f5a4a7
prerequisite-patch-id: 138a7407aed28b7557aed161184e76d336827454
prerequisite-patch-id: 4c3cc38effce6ec219b2babfd7072c7f275b80a6
prerequisite-patch-id: 0e38f95afd164b30d86be07a15376a7fd67e99d3
prerequisite-patch-id: 5c2bedf3dacc22ee10c3d70c6e96405e686f7754
prerequisite-patch-id: 0949e7987f845ad35f3723e785ca8cc0106b385e
prerequisite-patch-id: f77c346b385bd4a786ab036ba0a4c43161b6a1c5
prerequisite-patch-id: ec17f124177156115588daa3429201a571eeddd6
prerequisite-patch-id: bed58d55f0d727dd3faffbc434cebd2138a55473
prerequisite-patch-id: a0b3ae07a15badaaebcd0dcf9cc4bd0d7f4e1d9d
prerequisite-patch-id: 83434ed1c333dbc48135ebd1841615ce9c845def
prerequisite-patch-id: 49ecfbe26c00f05f051b12a0c78e7a9947e59572
prerequisite-patch-id: 7cd35c0342a3d9a24584782a2fc50e51a1f1a540
prerequisite-patch-id: 40e3f2acd678e746a76ae00727d15e4ae31ca5dc
prerequisite-patch-id: 027901dc90953117115660eea45fb61f2ce7d82b
prerequisite-patch-id: 0bd5809fe5527effeabcf380c9850a2bb807e563
prerequisite-patch-id: 7955212e8ef236f657dae147b8bc185ef66adc2a
prerequisite-patch-id: 4a63cc096d494ca40beb228078f64069a53fc5cd
prerequisite-patch-id: 93bec5ae9ee48335fe5c4997d5a9f4f8e70f6142
prerequisite-patch-id: 189fa77304f8c5c175e35e24590f9c41ead9ffb6
prerequisite-patch-id: a831479c004e2582ded20f5eb4b0e3e1150ff70f
prerequisite-patch-id: bd120763a3cc2da8707eacbffbcde96fd8f0db04
prerequisite-patch-id: f5d36515fadee074075f8de2c629b83ee4d99eea
prerequisite-patch-id: 95442e30d0ee1b275d309c5696129a5770aff00e
prerequisite-patch-id: f32714570885c04b51b7da03b38d953f9844c822
prerequisite-patch-id: ae99f3a7c326fa96ccc0f4670538b75e7a0db2d6
prerequisite-patch-id: 166bac5d2f69df7a15cb57b36f8e4e4a2b301657
prerequisite-patch-id: 4290f2f001c7949e62599bbe6a4c354d9de01f24
prerequisite-patch-id: 3ebe737930f5b43d974f624d6a87e98b6600183b
prerequisite-patch-id: 65b50c4215ef250670ff9c3229c6f30b3b53e28d
prerequisite-patch-id: 981ea00eac441bd76b4e33ec2e339b02f1cd2256
prerequisite-patch-id: 4103def900a17ced835150c68f59b7d79c652547
prerequisite-patch-id: 3f7208468c88e3943e574caabd026a20dae5a4b6
prerequisite-patch-id: 4688cb83a5cda31db9b20b37c5260f5b1fe4f73e
prerequisite-patch-id: a40acbfb6abed4982afb8b2dd0a0b33872963b04
prerequisite-patch-id: b6e98d8e155c14cc430edf243ba41743c88dea0c
prerequisite-patch-id: df3a316d44ec1a09b3003415fa54b0299d0a8da6
prerequisite-patch-id: d4296f043a2e3760f18ac41931570168e03c31b6
prerequisite-patch-id: cc2d381f3800c981bec2ad2e7c3ff9b5e63d2c4e
prerequisite-patch-id: f216800e16052b3b244703e0aa623edcaafc471c
prerequisite-patch-id: 299bea5ed5087403e6caca1ddbe46d5d432f95e6
prerequisite-patch-id: 1348b8e30cc66a9bae671a477dc3f37ef756c16e
prerequisite-patch-id: 6b9d42aa9ff18219111d324f458f02a891ff6100
prerequisite-patch-id: b5ab2bf767f8e4f41a5de61f019c174e67064b08
prerequisite-patch-id: d4873f818084297d07d79808d06b392de943d78a
prerequisite-patch-id: 1a3f7ddd091bb6830e38c994552856d18810e264
prerequisite-patch-id: 322ace6e4ce9fb60296872177bb994063b288e58
prerequisite-patch-id: a8aa86e3687b960f2385bce1183cdf80c32dc935
prerequisite-patch-id: cf6fdb77f38ea2adde7453dc710266bee3a4a56a
prerequisite-patch-id: 473372ebeb31644a41d6f12a3a85e6cc3e22b815
prerequisite-patch-id: 1c00be430e30e7ef93b9745b88afb1d668f21560
prerequisite-patch-id: 64ae459697caa6e110285279665a19115b259313
prerequisite-patch-id: df7ac0d9b3b0e1198ec7c2e0e64531d9ed166b4d
prerequisite-patch-id: 64ee5afc040ca2680ab53059b6deb9714b7e28a4
prerequisite-patch-id: 88f07f0f09bb721e4e0ee07579824920657f1f30
prerequisite-patch-id: 46319e3208173e82be7a0ce1d5b7f806848f1dc3
prerequisite-patch-id: 158ef42b71c695fd9612d2c8eccbde1b123c1b6e
prerequisite-patch-id: cdeddd19f28a58b6cad7e6b2b3231fa7a0919873
prerequisite-patch-id: a7394c2addef039ac866b57e7fad2c3d732ff615
prerequisite-patch-id: 36f18d85565aeca12b77397780ca71a0e51794a8
prerequisite-patch-id: 38f0f62f078664fd8a3323fffeac6e2fb6582434
prerequisite-patch-id: 6f10ea620f40818630135d900bff261963664ebc
prerequisite-patch-id: aec900cdb6127b4b510888251ac28c5bb0e8af26
prerequisite-patch-id: 96bd092720cfd0f62ac36c65b15722834b1c61f2
prerequisite-patch-id: ed9044826997b34da00321092b5b8f231e7391d1
prerequisite-patch-id: 6fd000b2e9407049a64bcdc5a8f4b149bfe22c54
prerequisite-patch-id: 48f02610fbd99129b09598dae5006ddf5312df0a
prerequisite-patch-id: 5426e499461735e8ec5220d288fff74cf678aa60
prerequisite-patch-id: 20c7180f8801a3bb64b6bb71619325675f348447
prerequisite-patch-id: f45d88e948b0cb0443358341f6e88933b2bb2fe6
prerequisite-patch-id: 940cdbc7c8f826d106b9597c02e972597f3cc3d5
prerequisite-patch-id: b543401052928389d3c36097c7b0ab525486167b
prerequisite-patch-id: 474ee12d37f8ca093ae0706b36365d68aa7d20e6
prerequisite-patch-id: f9bb0c5ecb57421abccbf7d7669cc3fe02d5bf93
prerequisite-patch-id: 4d6ff6d83b901441817268a035311bcdcec53c98
prerequisite-patch-id: 9625cf1fbbf8238369702c5c85c23b0d9e03e220
prerequisite-patch-id: fd9717d67435d72b25892af82391172b7d2950b7
prerequisite-patch-id: de0f0aaab080f81b7c6b62c1fc98f2a376576c06
prerequisite-patch-id: cc7d5a6c4b34c86258da386c21877a268dd053a3
prerequisite-patch-id: ebbaace7c2389114716fd295b31e52ac0d94db90
prerequisite-patch-id: d9e0739994cfc75aeb4925830af7cb1f000dd0bd
prerequisite-patch-id: 467931f4852f33e013507dc9e3e468e72cced166
prerequisite-patch-id: d581168493b2bcaf07528c975ad1aa6a728e6586
prerequisite-patch-id: a283c19832d563a263ef4f696e91da6f5043f7e5
prerequisite-patch-id: a9a4e60999776f3c513be8e259c33e08fcfa1cd2
prerequisite-patch-id: 86d74e2c938d4edccbe3ebc2eb760f2fc1df652e
prerequisite-patch-id: 2be8c33bf6d9ae34da0ce4dbd18e7c705642f272
prerequisite-patch-id: e08393975df17db62f356c8326050f990330b3f9
prerequisite-patch-id: 17ca8f185c55193f7af33b80f6cfa69a93b3beba
prerequisite-patch-id: 41b4caa1a14edb7c20d46d7d5c3fa5eb66e0057c
prerequisite-patch-id: 5472eaf979e150e1df0acec9614b936bfad850ed
prerequisite-patch-id: e509cbf8b9e0ba439feb17775fa557abe2625dc7
prerequisite-patch-id: 276f6d76a66f2aea7e6a63f309024d270ccbb919
prerequisite-patch-id: 9fa0e8a3e3192d4699b45a7b5e9b8819b473b702
prerequisite-patch-id: ca38d73c62a48377d13eaab7616a8f12f8deb08d
prerequisite-patch-id: a59fb62fc87bb0bfe6d219274acbccca6d3d2975
prerequisite-patch-id: 31e56828166d6e15d57bb73bee70a9c1a20af136
prerequisite-patch-id: b7b2b16163428721d12f0ec035149077f0af4463
prerequisite-patch-id: 9b3682b7269284784f7aaaa14d5ba4d2b55f65bd
prerequisite-patch-id: 00c0873939339bbdd0c7d955bb97b19deee120f6
prerequisite-patch-id: 82f954efd5b0d1b99d72ec7ab696bc18ffcc02a6
prerequisite-patch-id: f64b5ea50db5335409b7ed1ca0bf22307b6ecb2e
prerequisite-patch-id: 9f27e936f0b938afb0c9b2db828a5826a791dfaa
prerequisite-patch-id: dbc1ed98d0226344c3e2a5359c98ff5b5cf3f3a2
prerequisite-patch-id: f91b89d3fd77acf83f6a8ca4bd3e5912d5957080
prerequisite-patch-id: a658b2e4d9f67440d384d8f4fb5d1a20b8d32b7b
prerequisite-patch-id: 7213379b2dbcfde28a8bcb432470e3a8925e9672
prerequisite-patch-id: b6735ae3920ca8e2f692cb42516b08fa6c12c73d
prerequisite-patch-id: 23e0c03b06d8addd2d15f6357628e52b8e4f295e
prerequisite-patch-id: f47ce10d71ceadb975387e013b5fc92726e0a911
prerequisite-patch-id: e83c30dc9c0c09234aab7ade6382e31c9091872a
prerequisite-patch-id: e71edfe9e932e6258626c74b1085b6c869b73b16
prerequisite-patch-id: 6d7b4dd6e0394bbabdd2378bdb8d8b112436f241
prerequisite-patch-id: 4374a81e7537bee94a750bdec61d096b5113824c
prerequisite-patch-id: 80235b15266aa844501781cbbf2d772a70d53501
prerequisite-patch-id: 2fe797b17be11f6ce285c00fc4312d7198dbdee6
prerequisite-patch-id: 0a86c0988d60685da4373d3769efe33372796992
prerequisite-patch-id: cfc13b73630a575e7f3c8b782f04874d7e16d365
prerequisite-patch-id: 57f2ee486c4f3fe42489f6f7e2b70f6dbd92ccff
prerequisite-patch-id: 157d3f29541d737bb205369b4b916429f95454d6
prerequisite-patch-id: 8cbc50161db136cbaddc6841427a58d801613665
prerequisite-patch-id: 1814be6d2cc3c3d69fb577c8b187dec252c0f951
prerequisite-patch-id: 23ab37ff8ce4c6247ea875b49d36e6b82f20461d
prerequisite-patch-id: b16662b1ee2cd6647cef578497e6b5ef323cc7e1
prerequisite-patch-id: 907e02735831b94a5efa6c98cec8a88e90d8db77
prerequisite-patch-id: 4a02e3006db55e36d24633f8671b1265f99b2335
prerequisite-patch-id: 4e775628d2799ebbaf18d158493f2aa97e0ef59e
prerequisite-patch-id: f45ac9e20b1e0f0fd6884e3027d11eeee1b2ba02
prerequisite-patch-id: cd8e3fced275d2c6a7067cd0c2f40bc2ca5ec954
prerequisite-patch-id: 6b8f6da72725a6bdbd99621720a80d1b42cb55d6
prerequisite-patch-id: c7d9db26be6c7354d764406d286638c804a0131b
prerequisite-patch-id: 6ff599af6a101310acba91dc086971299ef38660
prerequisite-patch-id: 2490decd3987e756ceb4ed7ed53171b0cb047b94
prerequisite-patch-id: b1ff6e37c252fb73f45a35fee4e07053492f7aa8
prerequisite-patch-id: 7780942ad8424e643f9888c09ee6a168c68bb414
prerequisite-patch-id: 9636554da7d61fae96847cdf14be0ac2a0386801
prerequisite-patch-id: ff511bbf86d28303659f791580694ca83db77345
prerequisite-patch-id: 86f98fe657082d978e54e93990a3954df4ba64fb
prerequisite-patch-id: 8a164241e6444ccc40092d2c33a89c7576979544
prerequisite-patch-id: d64e6c916522b6062f3442344399625c3d27f1d7
prerequisite-patch-id: 3d1d20e023d045b60c52ac05206e691f415cce3e
prerequisite-patch-id: 13cb1dd555cd8db38a8661e0492da8685d8d4624
prerequisite-patch-id: 9e5cd47675d0a1896ef5ae867df8b921997dbe31
prerequisite-patch-id: 4df589e4b71bd747f45c99692a4b75afd6189243
prerequisite-patch-id: 324a8ec3e312d4f7e87a382281baea28d3f0ac79
prerequisite-patch-id: 2084ee1363a9100bbc2738a54008b33b2e0990ab
prerequisite-patch-id: d82fa80c2c5e6e8780ccffdec129a9f5ef0c2684
prerequisite-patch-id: 6e72f158c81bfe00a3e7227cf2a2f636302a0c61
prerequisite-patch-id: 0a0948f29a5fbc3613cc46ae83e729ef96b94fa4
-- 
2.14.5


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/5] 'runto main' -> 'runto_main' throughout
  2020-10-12  0:47 [PATCH 0/5] runto_main and -qualified Pedro Alves
@ 2020-10-12  0:47 ` Pedro Alves
  2020-10-13 17:57   ` Simon Marchi
  2020-10-12  0:47 ` [PATCH 2/5] Introduce mi_runto_main Pedro Alves
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Pedro Alves @ 2020-10-12  0:47 UTC (permalink / raw)
  To: gdb-patches

This commit does 's/runto main/runto_main/g' throughout.

gdb/testsuite/ChangeLog:

	* gdb.ada/fun_in_declare.exp: Use "runto_main" instead of
	"runto main".
	* gdb.ada/small_reg_param.exp: Likewise.
	* gdb.arch/powerpc-d128-regs.exp: Likewise.
	* gdb.base/annota1.exp: Likewise.
	* gdb.base/anon.exp: Likewise.
	* gdb.base/breakpoint-in-ro-region.exp: Likewise.
	* gdb.base/dprintf-non-stop.exp: Likewise.
	* gdb.base/dprintf.exp: Likewise.
	* gdb.base/gdb11530.exp: Likewise.
	* gdb.base/gdb11531.exp: Likewise.
	* gdb.base/gnu_vector.exp: Likewise.
	* gdb.base/interrupt-noterm.exp: Likewise.
	* gdb.base/memattr.exp: Likewise.
	* gdb.base/step-over-syscall.exp: Likewise.
	* gdb.base/watch-cond-infcall.exp: Likewise.
	* gdb.base/watch-read.exp: Likewise.
	* gdb.base/watch-vfork.exp: Likewise.
	* gdb.base/watch_thread_num.exp: Likewise.
	* gdb.base/watchpoint-stops-at-right-insn.exp: Likewise.
	* gdb.guile/scm-frame-inline.exp: Likewise.
	* gdb.linespec/explicit.exp: Likewise.
	* gdb.opt/inline-break.exp: Likewise.
	* gdb.python/py-frame-inline.exp: Likewise.
	* gdb.reverse/break-precsave.exp: Likewise.
	* gdb.reverse/break-reverse.exp: Likewise.
	* gdb.reverse/consecutive-precsave.exp: Likewise.
	* gdb.reverse/consecutive-reverse.exp: Likewise.
	* gdb.reverse/finish-precsave.exp: Likewise.
	* gdb.reverse/finish-reverse.exp: Likewise.
	* gdb.reverse/fstatat-reverse.exp: Likewise.
	* gdb.reverse/getresuid-reverse.exp: Likewise.
	* gdb.reverse/i386-precsave.exp: Likewise.
	* gdb.reverse/i386-reverse.exp: Likewise.
	* gdb.reverse/i386-sse-reverse.exp: Likewise.
	* gdb.reverse/i387-env-reverse.exp: Likewise.
	* gdb.reverse/i387-stack-reverse.exp: Likewise.
	* gdb.reverse/insn-reverse.exp: Likewise.
	* gdb.reverse/machinestate-precsave.exp: Likewise.
	* gdb.reverse/machinestate.exp: Likewise.
	* gdb.reverse/pipe-reverse.exp: Likewise.
	* gdb.reverse/readv-reverse.exp: Likewise.
	* gdb.reverse/recvmsg-reverse.exp: Likewise.
	* gdb.reverse/rerun-prec.exp: Likewise.
	* gdb.reverse/s390-mvcle.exp: Likewise.
	* gdb.reverse/solib-precsave.exp: Likewise.
	* gdb.reverse/solib-reverse.exp: Likewise.
	* gdb.reverse/step-precsave.exp: Likewise.
	* gdb.reverse/step-reverse.exp: Likewise.
	* gdb.reverse/time-reverse.exp: Likewise.
	* gdb.reverse/until-precsave.exp: Likewise.
	* gdb.reverse/until-reverse.exp: Likewise.
	* gdb.reverse/waitpid-reverse.exp: Likewise.
	* gdb.reverse/watch-precsave.exp: Likewise.
	* gdb.reverse/watch-reverse.exp: Likewise.
	* gdb.threads/kill.exp: Likewise.
	* gdb.threads/tid-reuse.exp: Likewise.

Change-Id: I70f457253836019880b4d7fb981936afa56724c2
---
 gdb/testsuite/gdb.ada/fun_in_declare.exp                  |  2 +-
 gdb/testsuite/gdb.ada/small_reg_param.exp                 |  2 +-
 gdb/testsuite/gdb.arch/powerpc-d128-regs.exp              |  2 +-
 gdb/testsuite/gdb.base/annota1.exp                        |  2 +-
 gdb/testsuite/gdb.base/anon.exp                           |  2 +-
 gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp        |  2 +-
 gdb/testsuite/gdb.base/dprintf-non-stop.exp               |  2 +-
 gdb/testsuite/gdb.base/dprintf.exp                        |  4 ++--
 gdb/testsuite/gdb.base/gdb11530.exp                       |  2 +-
 gdb/testsuite/gdb.base/gdb11531.exp                       |  2 +-
 gdb/testsuite/gdb.base/gnu_vector.exp                     |  2 +-
 gdb/testsuite/gdb.base/interrupt-noterm.exp               |  2 +-
 gdb/testsuite/gdb.base/memattr.exp                        |  2 +-
 gdb/testsuite/gdb.base/step-over-syscall.exp              |  4 ++--
 gdb/testsuite/gdb.base/watch-cond-infcall.exp             |  2 +-
 gdb/testsuite/gdb.base/watch-read.exp                     |  2 +-
 gdb/testsuite/gdb.base/watch-vfork.exp                    |  2 +-
 gdb/testsuite/gdb.base/watch_thread_num.exp               |  2 +-
 gdb/testsuite/gdb.base/watchpoint-stops-at-right-insn.exp |  4 ++--
 gdb/testsuite/gdb.guile/scm-frame-inline.exp              |  2 +-
 gdb/testsuite/gdb.linespec/explicit.exp                   |  2 +-
 gdb/testsuite/gdb.opt/inline-break.exp                    | 10 +++++-----
 gdb/testsuite/gdb.python/py-frame-inline.exp              |  2 +-
 gdb/testsuite/gdb.reverse/break-precsave.exp              |  2 +-
 gdb/testsuite/gdb.reverse/break-reverse.exp               |  2 +-
 gdb/testsuite/gdb.reverse/consecutive-precsave.exp        |  2 +-
 gdb/testsuite/gdb.reverse/consecutive-reverse.exp         |  2 +-
 gdb/testsuite/gdb.reverse/finish-precsave.exp             |  2 +-
 gdb/testsuite/gdb.reverse/finish-reverse.exp              |  2 +-
 gdb/testsuite/gdb.reverse/fstatat-reverse.exp             |  2 +-
 gdb/testsuite/gdb.reverse/getresuid-reverse.exp           |  2 +-
 gdb/testsuite/gdb.reverse/i386-precsave.exp               |  2 +-
 gdb/testsuite/gdb.reverse/i386-reverse.exp                |  2 +-
 gdb/testsuite/gdb.reverse/i386-sse-reverse.exp            |  2 +-
 gdb/testsuite/gdb.reverse/i387-env-reverse.exp            |  2 +-
 gdb/testsuite/gdb.reverse/i387-stack-reverse.exp          |  2 +-
 gdb/testsuite/gdb.reverse/insn-reverse.exp                |  2 +-
 gdb/testsuite/gdb.reverse/machinestate-precsave.exp       |  2 +-
 gdb/testsuite/gdb.reverse/machinestate.exp                |  2 +-
 gdb/testsuite/gdb.reverse/pipe-reverse.exp                |  2 +-
 gdb/testsuite/gdb.reverse/readv-reverse.exp               |  2 +-
 gdb/testsuite/gdb.reverse/recvmsg-reverse.exp             |  2 +-
 gdb/testsuite/gdb.reverse/rerun-prec.exp                  |  2 +-
 gdb/testsuite/gdb.reverse/s390-mvcle.exp                  |  2 +-
 gdb/testsuite/gdb.reverse/solib-precsave.exp              |  2 +-
 gdb/testsuite/gdb.reverse/solib-reverse.exp               |  2 +-
 gdb/testsuite/gdb.reverse/step-precsave.exp               |  2 +-
 gdb/testsuite/gdb.reverse/step-reverse.exp                |  2 +-
 gdb/testsuite/gdb.reverse/time-reverse.exp                |  2 +-
 gdb/testsuite/gdb.reverse/until-precsave.exp              |  2 +-
 gdb/testsuite/gdb.reverse/until-reverse.exp               |  2 +-
 gdb/testsuite/gdb.reverse/waitpid-reverse.exp             |  2 +-
 gdb/testsuite/gdb.reverse/watch-precsave.exp              |  2 +-
 gdb/testsuite/gdb.reverse/watch-reverse.exp               |  2 +-
 gdb/testsuite/gdb.threads/kill.exp                        |  2 +-
 gdb/testsuite/gdb.threads/tid-reuse.exp                   |  2 +-
 56 files changed, 63 insertions(+), 63 deletions(-)

diff --git a/gdb/testsuite/gdb.ada/fun_in_declare.exp b/gdb/testsuite/gdb.ada/fun_in_declare.exp
index 56b6d4c6c00..9e4d76fa554 100644
--- a/gdb/testsuite/gdb.ada/fun_in_declare.exp
+++ b/gdb/testsuite/gdb.ada/fun_in_declare.exp
@@ -25,7 +25,7 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" }
 
 clean_restart ${testfile}
 
-if ![runto main] then {
+if ![runto_main] then {
   perror "Couldn't run ${testfile}"
   return
 } 
diff --git a/gdb/testsuite/gdb.ada/small_reg_param.exp b/gdb/testsuite/gdb.ada/small_reg_param.exp
index 5737708e39f..9ae9a1805fb 100644
--- a/gdb/testsuite/gdb.ada/small_reg_param.exp
+++ b/gdb/testsuite/gdb.ada/small_reg_param.exp
@@ -25,7 +25,7 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug optimize=-
 
 clean_restart ${testfile}
 
-if ![runto main] then {
+if ![runto_main] then {
   perror "Couldn't run ${testfile}"
   return
 }
diff --git a/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp b/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp
index e7bbccb2711..609112392a2 100644
--- a/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp
@@ -39,7 +39,7 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
-if { ![runto main] } then {
+if { ![runto_main] } then {
    fail "run to main"
    return
 }
diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp
index 2fdfd65ce86..f3c99667acd 100644
--- a/gdb/testsuite/gdb.base/annota1.exp
+++ b/gdb/testsuite/gdb.base/annota1.exp
@@ -459,7 +459,7 @@ proc thread_test {} {
 	gdb_start
 	gdb_reinitialize_dir $srcdir/$subdir
 	gdb_load ${binfile}
-	if { ![runto main] } then {
+	if { ![runto_main] } then {
 	    fail "run to main"
 	    return
 	}
diff --git a/gdb/testsuite/gdb.base/anon.exp b/gdb/testsuite/gdb.base/anon.exp
index 0d77bbf5040..f6bb3c5f041 100644
--- a/gdb/testsuite/gdb.base/anon.exp
+++ b/gdb/testsuite/gdb.base/anon.exp
@@ -20,7 +20,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] } {
     return -1
 }
 
-if { ![runto main] } then {
+if { ![runto_main] } then {
     fail "run to main"
     return
 }
diff --git a/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp b/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp
index 65f7baae9f5..3d22af5937f 100644
--- a/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp
+++ b/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp
@@ -28,7 +28,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return -1
 }
 
-if ![runto main] {
+if ![runto_main] {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.base/dprintf-non-stop.exp b/gdb/testsuite/gdb.base/dprintf-non-stop.exp
index 5ed5d022322..3d911a4073b 100644
--- a/gdb/testsuite/gdb.base/dprintf-non-stop.exp
+++ b/gdb/testsuite/gdb.base/dprintf-non-stop.exp
@@ -26,7 +26,7 @@ save_vars { GDBFLAGS } {
     clean_restart ${executable}
 }
 
-if ![runto main] {
+if ![runto_main] {
     fail "can't run to main"
     return -1
 }
diff --git a/gdb/testsuite/gdb.base/dprintf.exp b/gdb/testsuite/gdb.base/dprintf.exp
index 968f9eafcc9..9fa2e64993c 100644
--- a/gdb/testsuite/gdb.base/dprintf.exp
+++ b/gdb/testsuite/gdb.base/dprintf.exp
@@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
 set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
 set dp_location1 [gdb_get_line_number "set dprintf 1 here"]
 
-if ![runto main] {
+if ![runto_main] {
     return -1
 }
 
@@ -72,7 +72,7 @@ proc restart {} {
 
     clean_restart $binfile
 
-    if ![runto main] {
+    if ![runto_main] {
 	return -1
     }
 
diff --git a/gdb/testsuite/gdb.base/gdb11530.exp b/gdb/testsuite/gdb.base/gdb11530.exp
index 705d03dd2a2..a7399267acd 100644
--- a/gdb/testsuite/gdb.base/gdb11530.exp
+++ b/gdb/testsuite/gdb.base/gdb11530.exp
@@ -36,7 +36,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $testfile.c {debug}] } {
 }
 
 
-if { ![runto main] } then {
+if { ![runto_main] } then {
     fail "run to main"
     return
 }
diff --git a/gdb/testsuite/gdb.base/gdb11531.exp b/gdb/testsuite/gdb.base/gdb11531.exp
index 6cde80ddda5..59ef4394a8b 100644
--- a/gdb/testsuite/gdb.base/gdb11531.exp
+++ b/gdb/testsuite/gdb.base/gdb11531.exp
@@ -31,7 +31,7 @@ if [target_info exists gdb,no_hardware_watchpoints] {
    gdb_test_no_output "set can-use-hw-watchpoints 0" ""
 }
 
-if { ![runto main] } then {
+if { ![runto_main] } then {
     fail "run to main"
     return
 }
diff --git a/gdb/testsuite/gdb.base/gnu_vector.exp b/gdb/testsuite/gdb.base/gnu_vector.exp
index 23fc2dbbd98..15cd59b0409 100644
--- a/gdb/testsuite/gdb.base/gnu_vector.exp
+++ b/gdb/testsuite/gdb.base/gnu_vector.exp
@@ -42,7 +42,7 @@ if { [do_compile {-mcpu=native}] != ""
 
 clean_restart ${binfile}
 
-if { ![runto main] } {
+if { ![runto_main] } {
     fail "runto main"
     return -1
 }
diff --git a/gdb/testsuite/gdb.base/interrupt-noterm.exp b/gdb/testsuite/gdb.base/interrupt-noterm.exp
index 4ec4e8513f0..ddf4ba3352a 100644
--- a/gdb/testsuite/gdb.base/interrupt-noterm.exp
+++ b/gdb/testsuite/gdb.base/interrupt-noterm.exp
@@ -23,7 +23,7 @@ if [prepare_for_testing "failed to prepare for testing" \
 # Pretend there's no terminal.
 gdb_test_no_output "set interactive-mode off"
 
-if ![runto main] {
+if ![runto_main] {
     fail "can't run to main"
     return -1
 }
diff --git a/gdb/testsuite/gdb.base/memattr.exp b/gdb/testsuite/gdb.base/memattr.exp
index 237f51a4bae..91527cec063 100644
--- a/gdb/testsuite/gdb.base/memattr.exp
+++ b/gdb/testsuite/gdb.base/memattr.exp
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return -1
 }
 
-runto main
+runto_main
 
 # Delete all target-supplied memory regions.
 delete_memory_regions
diff --git a/gdb/testsuite/gdb.base/step-over-syscall.exp b/gdb/testsuite/gdb.base/step-over-syscall.exp
index 0d0c31abe87..6f67aea12ef 100644
--- a/gdb/testsuite/gdb.base/step-over-syscall.exp
+++ b/gdb/testsuite/gdb.base/step-over-syscall.exp
@@ -76,7 +76,7 @@ proc setup { syscall } {
 
     clean_restart $testfile
 
-    if { ![runto main] } then {
+    if { ![runto_main] } then {
 	fail "run to main ($syscall)"
 	return -1
     }
@@ -317,7 +317,7 @@ step_over_syscall "clone"
 
 set testfile "step-over-fork"
 clean_restart $testfile
-if { ![runto main] } then {
+if { ![runto_main] } then {
     fail "run to main"
     return -1
 }
diff --git a/gdb/testsuite/gdb.base/watch-cond-infcall.exp b/gdb/testsuite/gdb.base/watch-cond-infcall.exp
index 0401ecc7fb5..dc76bf11aa2 100644
--- a/gdb/testsuite/gdb.base/watch-cond-infcall.exp
+++ b/gdb/testsuite/gdb.base/watch-cond-infcall.exp
@@ -33,7 +33,7 @@ proc test_watchpoint { hw } {
 
     clean_restart ${testfile}
 
-    if { ![runto main] } then {
+    if { ![runto_main] } then {
 	fail "run to main"
 	return
     }
diff --git a/gdb/testsuite/gdb.base/watch-read.exp b/gdb/testsuite/gdb.base/watch-read.exp
index 42e5f323b6e..bb1d8476001 100644
--- a/gdb/testsuite/gdb.base/watch-read.exp
+++ b/gdb/testsuite/gdb.base/watch-read.exp
@@ -32,7 +32,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return -1
 }
 
-if { ![runto main] } then {
+if { ![runto_main] } then {
     fail "run to main"
     return
 }
diff --git a/gdb/testsuite/gdb.base/watch-vfork.exp b/gdb/testsuite/gdb.base/watch-vfork.exp
index a88897e34bb..ead0222a64b 100644
--- a/gdb/testsuite/gdb.base/watch-vfork.exp
+++ b/gdb/testsuite/gdb.base/watch-vfork.exp
@@ -27,7 +27,7 @@ proc test_watchpoint_across_vfork { hw teststr } {
 
     clean_restart ${testfile}
 
-    if { ![runto main] } then {
+    if { ![runto_main] } then {
 	fail "run to main ($teststr)"
 	return
     }
diff --git a/gdb/testsuite/gdb.base/watch_thread_num.exp b/gdb/testsuite/gdb.base/watch_thread_num.exp
index 88c22a28751..e59b9c3592d 100644
--- a/gdb/testsuite/gdb.base/watch_thread_num.exp
+++ b/gdb/testsuite/gdb.base/watch_thread_num.exp
@@ -41,7 +41,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
 
 clean_restart ${binfile}
 
-if { ![runto main] } then {
+if { ![runto_main] } then {
    fail "run to main"
    return
 }
diff --git a/gdb/testsuite/gdb.base/watchpoint-stops-at-right-insn.exp b/gdb/testsuite/gdb.base/watchpoint-stops-at-right-insn.exp
index 4e36c4207fc..5b55739cc16 100644
--- a/gdb/testsuite/gdb.base/watchpoint-stops-at-right-insn.exp
+++ b/gdb/testsuite/gdb.base/watchpoint-stops-at-right-insn.exp
@@ -79,7 +79,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return -1
 }
 
-if { ![runto main] } then {
+if { ![runto_main] } then {
     fail "run to main"
     return
 }
@@ -134,7 +134,7 @@ proc test {always_inserted} {
 
 	clean_restart $binfile
 
-	if { ![runto main] } then {
+	if { ![runto_main] } then {
 	    fail "run to main"
 	    return
 	}
diff --git a/gdb/testsuite/gdb.guile/scm-frame-inline.exp b/gdb/testsuite/gdb.guile/scm-frame-inline.exp
index 8a4d8f893de..6f7c9140c00 100644
--- a/gdb/testsuite/gdb.guile/scm-frame-inline.exp
+++ b/gdb/testsuite/gdb.guile/scm-frame-inline.exp
@@ -24,7 +24,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
 # Skip all tests if Guile scripting is not enabled.
 if { [skip_guile_tests] } { continue }
 
-if ![runto main] {
+if ![runto_main] {
     fail "can't run to main"
     return
 }
diff --git a/gdb/testsuite/gdb.linespec/explicit.exp b/gdb/testsuite/gdb.linespec/explicit.exp
index 4f457dc372f..c01a425ece1 100644
--- a/gdb/testsuite/gdb.linespec/explicit.exp
+++ b/gdb/testsuite/gdb.linespec/explicit.exp
@@ -584,7 +584,7 @@ namespace eval $testfile {
     gdb_load [standard_output_file $exefile]
 
     set tst "condition_command overrides explicit linespec condition"
-    if {![runto main]} {
+    if {![runto_main]} {
 	fail $tst
     } else {
 	if {![gdb_breakpoint "-func myfunction if arg == 1"]} {
diff --git a/gdb/testsuite/gdb.opt/inline-break.exp b/gdb/testsuite/gdb.opt/inline-break.exp
index 560ed8ce48c..da3c706a533 100644
--- a/gdb/testsuite/gdb.opt/inline-break.exp
+++ b/gdb/testsuite/gdb.opt/inline-break.exp
@@ -190,7 +190,7 @@ foreach_with_prefix cmd [list "break" "tbreak"] {
 
     # Start with a clean state.
     delete_breakpoints
-    if {![runto main]} {
+    if {![runto_main]} {
 	untested "could not run to main"
 	return -1
     }
@@ -246,7 +246,7 @@ foreach_with_prefix func {
 } {
     clean_restart $binfile
 
-    if {![runto main]} {
+    if {![runto_main]} {
 	untested "could not run to main"
 	continue
     }
@@ -264,7 +264,7 @@ set line [gdb_get_line_number "break here"]
 with_test_prefix "line number" {
     clean_restart $binfile
 
-    if {![runto main]} {
+    if {![runto_main]} {
 	untested "could not run to main"
 	continue
     }
@@ -289,7 +289,7 @@ with_test_prefix "address" {
 
     clean_restart $binfile
 
-    if {![runto main]} {
+    if {![runto_main]} {
 	untested "could not run to main"
 	continue
     }
@@ -308,7 +308,7 @@ with_test_prefix "check alignment" {
 
     clean_restart $binfile
 
-    if {![runto main]} {
+    if {![runto_main]} {
 	untested "could not run to main"
 	continue
     }
diff --git a/gdb/testsuite/gdb.python/py-frame-inline.exp b/gdb/testsuite/gdb.python/py-frame-inline.exp
index 2b3d8e2b0e1..749e040408b 100644
--- a/gdb/testsuite/gdb.python/py-frame-inline.exp
+++ b/gdb/testsuite/gdb.python/py-frame-inline.exp
@@ -24,7 +24,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
 # Skip all tests if Python scripting is not enabled.
 if { [skip_python_tests] } { continue }
 
-if ![runto main] then {
+if ![runto_main] then {
     fail "can't run to function f"
     return 0
 }
diff --git a/gdb/testsuite/gdb.reverse/break-precsave.exp b/gdb/testsuite/gdb.reverse/break-precsave.exp
index ec4ce6025be..ea0cb42a95f 100644
--- a/gdb/testsuite/gdb.reverse/break-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/break-precsave.exp
@@ -37,7 +37,7 @@ proc precsave_tests {} {
     global foo_location bar_location main_location end_location
     global decimal srcfile precsave gdb_prompt
 
-    runto main
+    runto_main
 
     if [supports_process_record] {
 	# Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/break-reverse.exp b/gdb/testsuite/gdb.reverse/break-reverse.exp
index 65c59bb8f39..07dd1da7991 100644
--- a/gdb/testsuite/gdb.reverse/break-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/break-reverse.exp
@@ -31,7 +31,7 @@ set bar_location  [gdb_get_line_number "break in bar" ]
 set main_location [gdb_get_line_number "break in main"]
 set end_location  [gdb_get_line_number "end of main"  ]
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/consecutive-precsave.exp b/gdb/testsuite/gdb.reverse/consecutive-precsave.exp
index dec501d589b..1d78df6b7da 100644
--- a/gdb/testsuite/gdb.reverse/consecutive-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/consecutive-precsave.exp
@@ -28,7 +28,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return -1
 }
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/consecutive-reverse.exp b/gdb/testsuite/gdb.reverse/consecutive-reverse.exp
index ff03e6744a4..d01a7dcf3a5 100644
--- a/gdb/testsuite/gdb.reverse/consecutive-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/consecutive-reverse.exp
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return -1
 }
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/finish-precsave.exp b/gdb/testsuite/gdb.reverse/finish-precsave.exp
index ed468152049..1f3749849ff 100644
--- a/gdb/testsuite/gdb.reverse/finish-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/finish-precsave.exp
@@ -27,7 +27,7 @@ if { [prepare_for_testing "failed to prepare" "$testfile" $srcfile] } {
     return -1
 }
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/finish-reverse.exp b/gdb/testsuite/gdb.reverse/finish-reverse.exp
index 62eb3fd156e..89fa10ce983 100644
--- a/gdb/testsuite/gdb.reverse/finish-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/finish-reverse.exp
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" "$testfile" $srcfile] } {
     return -1
 }
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/fstatat-reverse.exp b/gdb/testsuite/gdb.reverse/fstatat-reverse.exp
index 227f44891f0..e8151cccd2d 100644
--- a/gdb/testsuite/gdb.reverse/fstatat-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/fstatat-reverse.exp
@@ -29,7 +29,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return -1
 }
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/getresuid-reverse.exp b/gdb/testsuite/gdb.reverse/getresuid-reverse.exp
index 3e75939f528..33b64a311c4 100644
--- a/gdb/testsuite/gdb.reverse/getresuid-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/getresuid-reverse.exp
@@ -29,7 +29,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return -1
 }
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/i386-precsave.exp b/gdb/testsuite/gdb.reverse/i386-precsave.exp
index c51066cd2d8..58053f7888b 100644
--- a/gdb/testsuite/gdb.reverse/i386-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/i386-precsave.exp
@@ -44,7 +44,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
 set end_of_main          [gdb_get_line_number " end of main "]
 set end_of_inc_dec_tests [gdb_get_line_number " end inc_dec_tests "]
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/i386-reverse.exp b/gdb/testsuite/gdb.reverse/i386-reverse.exp
index c0d21b80cec..a8a8347b3d0 100644
--- a/gdb/testsuite/gdb.reverse/i386-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/i386-reverse.exp
@@ -42,7 +42,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
 set end_of_main          [gdb_get_line_number " end of main "]
 set end_of_inc_dec_tests [gdb_get_line_number " end inc_dec_tests "]
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/i386-sse-reverse.exp b/gdb/testsuite/gdb.reverse/i386-sse-reverse.exp
index 0440409b94f..f1b7643e7b2 100644
--- a/gdb/testsuite/gdb.reverse/i386-sse-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/i386-sse-reverse.exp
@@ -44,7 +44,7 @@ set end_sse_test         [gdb_get_line_number " end sse_test "]
 set end_ssse3_test       [gdb_get_line_number " end ssse3_test "]
 set end_sse4_test         [gdb_get_line_number " end sse4_test "]
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/i387-env-reverse.exp b/gdb/testsuite/gdb.reverse/i387-env-reverse.exp
index 5bef30f0e44..f051ccbe8f5 100644
--- a/gdb/testsuite/gdb.reverse/i387-env-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/i387-env-reverse.exp
@@ -31,7 +31,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
     return -1
 }
 
-runto main
+runto_main
 
 # Record to end of main
 
diff --git a/gdb/testsuite/gdb.reverse/i387-stack-reverse.exp b/gdb/testsuite/gdb.reverse/i387-stack-reverse.exp
index 072fdba89ce..a53033c603b 100644
--- a/gdb/testsuite/gdb.reverse/i387-stack-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/i387-stack-reverse.exp
@@ -31,7 +31,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
     return -1
 }
 
-runto main
+runto_main
 
 # Record to end of main
 
diff --git a/gdb/testsuite/gdb.reverse/insn-reverse.exp b/gdb/testsuite/gdb.reverse/insn-reverse.exp
index 53f4698763f..174b7957517 100644
--- a/gdb/testsuite/gdb.reverse/insn-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/insn-reverse.exp
@@ -23,7 +23,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
 	 [list debug]]} {
     return -1
 }
-if { ![runto main] } then {
+if { ![runto_main] } then {
     fail "run to main"
     return
 }
diff --git a/gdb/testsuite/gdb.reverse/machinestate-precsave.exp b/gdb/testsuite/gdb.reverse/machinestate-precsave.exp
index f7df3d70361..21b793c0178 100644
--- a/gdb/testsuite/gdb.reverse/machinestate-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/machinestate-precsave.exp
@@ -55,7 +55,7 @@ set endmain   [gdb_get_line_number " end main "   $srcfile]
 
 # Test begins
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/machinestate.exp b/gdb/testsuite/gdb.reverse/machinestate.exp
index 5171ee60c0c..a597bb6212d 100644
--- a/gdb/testsuite/gdb.reverse/machinestate.exp
+++ b/gdb/testsuite/gdb.reverse/machinestate.exp
@@ -53,7 +53,7 @@ set endmain   [gdb_get_line_number " end main "   $srcfile]
 
 # Test begins
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/pipe-reverse.exp b/gdb/testsuite/gdb.reverse/pipe-reverse.exp
index 7113178b663..20187a06d96 100644
--- a/gdb/testsuite/gdb.reverse/pipe-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/pipe-reverse.exp
@@ -29,7 +29,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return -1
 }
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/readv-reverse.exp b/gdb/testsuite/gdb.reverse/readv-reverse.exp
index cd019dbbc98..be703cbe07e 100644
--- a/gdb/testsuite/gdb.reverse/readv-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/readv-reverse.exp
@@ -29,7 +29,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return -1
 }
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/recvmsg-reverse.exp b/gdb/testsuite/gdb.reverse/recvmsg-reverse.exp
index ac5d136dc98..949b711ff17 100644
--- a/gdb/testsuite/gdb.reverse/recvmsg-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/recvmsg-reverse.exp
@@ -29,7 +29,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return -1
 }
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/rerun-prec.exp b/gdb/testsuite/gdb.reverse/rerun-prec.exp
index 637ac58954d..108c4a7bf91 100644
--- a/gdb/testsuite/gdb.reverse/rerun-prec.exp
+++ b/gdb/testsuite/gdb.reverse/rerun-prec.exp
@@ -24,7 +24,7 @@ if {[prepare_for_testing "failed to prepare" $testfile [list $srcfile]]} {
 }
 
 # The bug is a regression in the sequence "run; record; run".
-runto main
+runto_main
 gdb_test_no_output "record" "turn on process record"
 
 gdb_run_cmd
diff --git a/gdb/testsuite/gdb.reverse/s390-mvcle.exp b/gdb/testsuite/gdb.reverse/s390-mvcle.exp
index beb4a69c79d..01761eb6fdf 100644
--- a/gdb/testsuite/gdb.reverse/s390-mvcle.exp
+++ b/gdb/testsuite/gdb.reverse/s390-mvcle.exp
@@ -32,7 +32,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return -1
 }
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/solib-precsave.exp b/gdb/testsuite/gdb.reverse/solib-precsave.exp
index 8d57e7951e2..e396e65066c 100644
--- a/gdb/testsuite/gdb.reverse/solib-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/solib-precsave.exp
@@ -79,7 +79,7 @@ gdb_load ${binfile}
 gdb_load_shlib $library1
 gdb_load_shlib $library2
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/solib-reverse.exp b/gdb/testsuite/gdb.reverse/solib-reverse.exp
index 843aedc722a..a9ab07b3215 100644
--- a/gdb/testsuite/gdb.reverse/solib-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/solib-reverse.exp
@@ -71,7 +71,7 @@ gdb_load ${binfile}
 gdb_load_shlib $library1
 gdb_load_shlib $library2
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/step-precsave.exp b/gdb/testsuite/gdb.reverse/step-precsave.exp
index 12bb7d19486..7d8c12ce76b 100644
--- a/gdb/testsuite/gdb.reverse/step-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/step-precsave.exp
@@ -32,7 +32,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return -1
 }
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/step-reverse.exp b/gdb/testsuite/gdb.reverse/step-reverse.exp
index bdc9489d6f0..2320389c501 100644
--- a/gdb/testsuite/gdb.reverse/step-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/step-reverse.exp
@@ -30,7 +30,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return -1
 }
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/time-reverse.exp b/gdb/testsuite/gdb.reverse/time-reverse.exp
index fea38f37820..0f369aae711 100644
--- a/gdb/testsuite/gdb.reverse/time-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/time-reverse.exp
@@ -29,7 +29,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return -1
 }
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/until-precsave.exp b/gdb/testsuite/gdb.reverse/until-precsave.exp
index 5eb03dfeaf7..25f455fb608 100644
--- a/gdb/testsuite/gdb.reverse/until-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/until-precsave.exp
@@ -36,7 +36,7 @@ set bp_location19 [gdb_get_line_number "set breakpoint 19 here"]
 set bp_location20 [gdb_get_line_number "set breakpoint 20 here"]
 set bp_location21 [gdb_get_line_number "set breakpoint 21 here"]
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/until-reverse.exp b/gdb/testsuite/gdb.reverse/until-reverse.exp
index 6b435be4c94..f91600df550 100644
--- a/gdb/testsuite/gdb.reverse/until-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/until-reverse.exp
@@ -34,7 +34,7 @@ set bp_location19 [gdb_get_line_number "set breakpoint 19 here"]
 set bp_location20 [gdb_get_line_number "set breakpoint 20 here"]
 set bp_location21 [gdb_get_line_number "set breakpoint 21 here"]
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/waitpid-reverse.exp b/gdb/testsuite/gdb.reverse/waitpid-reverse.exp
index 39d7771fa1a..12de810dfe1 100644
--- a/gdb/testsuite/gdb.reverse/waitpid-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/waitpid-reverse.exp
@@ -31,7 +31,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return -1
 }
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/watch-precsave.exp b/gdb/testsuite/gdb.reverse/watch-precsave.exp
index de85c07b40a..30c5f26f62a 100644
--- a/gdb/testsuite/gdb.reverse/watch-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/watch-precsave.exp
@@ -29,7 +29,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return -1
 }
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.reverse/watch-reverse.exp b/gdb/testsuite/gdb.reverse/watch-reverse.exp
index 703131155f7..433bf28f688 100644
--- a/gdb/testsuite/gdb.reverse/watch-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/watch-reverse.exp
@@ -28,7 +28,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return -1
 }
 
-runto main
+runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.threads/kill.exp b/gdb/testsuite/gdb.threads/kill.exp
index 4acb1467935..2fe4fce0a20 100644
--- a/gdb/testsuite/gdb.threads/kill.exp
+++ b/gdb/testsuite/gdb.threads/kill.exp
@@ -38,7 +38,7 @@ proc test {threaded} {
 	    return -1
 	}
 
-	if { ![runto main] } then {
+	if { ![runto_main] } then {
 	    fail "run to main"
 	    return
 	}
diff --git a/gdb/testsuite/gdb.threads/tid-reuse.exp b/gdb/testsuite/gdb.threads/tid-reuse.exp
index 9f42fdddf8d..756a3dc2d98 100644
--- a/gdb/testsuite/gdb.threads/tid-reuse.exp
+++ b/gdb/testsuite/gdb.threads/tid-reuse.exp
@@ -24,7 +24,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile { debug pthreads
 
 clean_restart ${binfile}
 
-if ![runto main] {
+if ![runto_main] {
     fail "can't run to main"
     return -1
 }
-- 
2.14.5


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 2/5] Introduce mi_runto_main
  2020-10-12  0:47 [PATCH 0/5] runto_main and -qualified Pedro Alves
  2020-10-12  0:47 ` [PATCH 1/5] 'runto main' -> 'runto_main' throughout Pedro Alves
@ 2020-10-12  0:47 ` Pedro Alves
  2020-10-13 18:00   ` Simon Marchi
  2020-10-12  0:47 ` [PATCH 3/5] gdb/testsuite/: Use -qualified in runto_main / mi_runto_main Pedro Alves
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Pedro Alves @ 2020-10-12  0:47 UTC (permalink / raw)
  To: gdb-patches

This adds an mi_runto_main routine, very much like the runto_main CLI
counterpart.

Note there's already a mi_run_to_main (extra underscore in "run_to"),
but unlike its intro comment says, that does more than the CLI's
runto_main -- it also starts GDB.  I would like to eliminate that
other one by introducing a mi_clean_restart function instead.  That is
done later in the series.

gdb/testsuite/ChangeLog:

	* lib/mi-support.exp (mi_runto_main): New proc.
	(mi_run_to_main): Use it.
	* gdb.mi/mi-catch-cpp-exceptions.exp: Likewise.
	* gdb.mi/mi-var-cmd.exp: Likewise.
	* gdb.mi/mi-var-invalidate.exp: Likewise.
	* mi-var-list-children-invalid-grandchild.exp: Likewise.
	* gdb.mi/mi2-amd64-entry-value.exp: Likewise.
	* gdb.mi/new-ui-mi-sync.exp: Likewise.
	* gdb.mi/user-selected-context-sync.exp: Likewise.
	* gdb.opt/inline-cmds.exp: Likewise.
	* gdb.python/py-framefilter-mi.exp: Likewise.
	* gdb.python/py-mi.exp: Likewise.

Change-Id: I2e49ca7b0b61cea57c1202e5dfa32417e6a4403d
---
 gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp           |  2 +-
 gdb/testsuite/gdb.mi/mi-var-cmd.exp                        |  2 +-
 gdb/testsuite/gdb.mi/mi-var-invalidate.exp                 |  2 +-
 .../gdb.mi/mi-var-list-children-invalid-grandchild.exp     |  2 +-
 gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp             | 14 +++++++-------
 gdb/testsuite/gdb.mi/new-ui-mi-sync.exp                    |  2 +-
 gdb/testsuite/gdb.mi/user-selected-context-sync.exp        |  2 +-
 gdb/testsuite/gdb.opt/inline-cmds.exp                      |  2 +-
 gdb/testsuite/gdb.python/py-framefilter-mi.exp             |  2 +-
 gdb/testsuite/gdb.python/py-mi.exp                         |  4 ++--
 gdb/testsuite/lib/mi-support.exp                           |  8 +++++++-
 11 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp b/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp
index 40c17c68e63..14e820fa350 100644
--- a/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp
+++ b/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp
@@ -59,7 +59,7 @@ proc restart_for_test {} {
     mi_gdb_reinitialize_dir $srcdir/$subdir
     mi_gdb_load ${binfile}
 
-    mi_runto main
+    mi_runto_main
 
     mi_create_breakpoint \
 	"$srcfile:${main_lineno}" "break before exiting program" \
diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp
index 260917a906b..c521a18bf6e 100644
--- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp
@@ -657,7 +657,7 @@ with_test_prefix "second run" {
 mi_create_varobj "L" "lsimple" "in-and-out-of-scope: create varobj"
 mi_check_varobj_value "L" "{...}" "in-and-out-of-scope: check initial value"
 
-mi_runto main
+mi_runto_main
 
 mi_gdb_test "-var-update L" \
     {\^done,changelist=\[{name="L",in_scope="false",type_changed="false",has_more="0"}\]} \
diff --git a/gdb/testsuite/gdb.mi/mi-var-invalidate.exp b/gdb/testsuite/gdb.mi/mi-var-invalidate.exp
index d6fb7754766..bc056b92d8b 100644
--- a/gdb/testsuite/gdb.mi/mi-var-invalidate.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-invalidate.exp
@@ -70,7 +70,7 @@ mi_create_floating_varobj float_simple array "create floating variable"
 #
 mi_delete_breakpoints
 mi_gdb_load ${binfile_bis}
-mi_runto main
+mi_runto_main
 
 # Change format of floating variable immediately after reload reveals a
 # bug where gdb still uses a free'd pointer.
diff --git a/gdb/testsuite/gdb.mi/mi-var-list-children-invalid-grandchild.exp b/gdb/testsuite/gdb.mi/mi-var-list-children-invalid-grandchild.exp
index 78ad1e1e4b2..b34593546d3 100644
--- a/gdb/testsuite/gdb.mi/mi-var-list-children-invalid-grandchild.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-list-children-invalid-grandchild.exp
@@ -43,7 +43,7 @@ mi_gdb_test "-interpreter-exec console \"set print object on\"" \
     "(.*=cmd-param-changed,param=\"print object\",value=\"on\".*|)\\^done" \
     "set print object on"
 
-mi_runto main
+mi_runto_main
 
 mi_continue_to_line $line_invalid_pointer_value "continue to invalid pointer value"
 
diff --git a/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp b/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp
index c9e5724bee3..b8d2cd16bf4 100644
--- a/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp
+++ b/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp
@@ -49,7 +49,7 @@ foreach name {different breakhere_different breakhere_validity breakhere_invalid
 
 # Test various kinds of `set print entry-values'.
 
-if {[mi_runto main] == -1} {
+if {[mi_runto_main] == -1} {
     return -1
 }
 mi_gdb_test "-gdb-set print entry-values no" {\^done} "no: set print entry-values"
@@ -66,7 +66,7 @@ mi_send_resuming_command "exec-continue" "no: invalid: continue"
 mi_expect_stop "breakpoint-hit" .* {{name="inv",value="<optimized out>"}} .* .* {.* disp="keep"} "no: invalid: stop"
 mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"}\]} "no: invalid: -stack-list-variables"
 
-if {[mi_runto main] == -1} {
+if {[mi_runto_main] == -1} {
     return -1
 }
 mi_gdb_test "-gdb-set print entry-values only" {\^done} "only: set print entry-values"
@@ -83,7 +83,7 @@ mi_send_resuming_command "exec-continue" "only: invalid: continue"
 mi_expect_stop "breakpoint-hit" .* {{name="inv@entry",value="<optimized out>"}} .* .* {.* disp="keep"} "only: invalid: stop"
 mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv@entry",arg="1",value="<optimized out>"}\]} "only: invalid: -stack-list-variables"
 
-if {[mi_runto main] == -1} {
+if {[mi_runto_main] == -1} {
     return -1
 }
 mi_gdb_test "-gdb-set print entry-values preferred" {\^done} "preferred: set print entry-values"
@@ -100,7 +100,7 @@ mi_send_resuming_command "exec-continue" "preferred: invalid: continue"
 mi_expect_stop "breakpoint-hit" .* {{name="inv@entry",value="<optimized out>"}} .* .* {.* disp="keep"} "preferred: invalid: stop"
 mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv@entry",arg="1",value="<optimized out>"}\]} "preferred: invalid: -stack-list-variables"
 
-if {[mi_runto main] == -1} {
+if {[mi_runto_main] == -1} {
     return -1
 }
 mi_gdb_test "-gdb-set print entry-values if-needed" {\^done} "if-needed: set print entry-values"
@@ -117,7 +117,7 @@ mi_send_resuming_command "exec-continue" "if-needed: invalid: continue"
 mi_expect_stop "breakpoint-hit" .* {{name="inv",value="<optimized out>"}} .* .* {.* disp="keep"} "if-needed: invalid: stop"
 mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"}\]} "if-needed: invalid: -stack-list-variables"
 
-if {[mi_runto main] == -1} {
+if {[mi_runto_main] == -1} {
     return -1
 }
 mi_gdb_test "-gdb-set print entry-values both" {\^done} "both: set print entry-values"
@@ -134,7 +134,7 @@ mi_send_resuming_command "exec-continue" "both: invalid: continue"
 mi_expect_stop "breakpoint-hit" .* {{name="inv",value="<optimized out>"},{name="inv@entry",value="<optimized out>"}} .* .* {.* disp="keep"} "both: invalid: stop"
 mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"},{name="inv@entry",arg="1",value="<optimized out>"}\]} "both: invalid: -stack-list-variables"
 
-if {[mi_runto main] == -1} {
+if {[mi_runto_main] == -1} {
     return -1
 }
 mi_gdb_test "-gdb-set print entry-values compact" {\^done} "compact: set print entry-values"
@@ -151,7 +151,7 @@ mi_send_resuming_command "exec-continue" "compact: invalid: continue"
 mi_expect_stop "breakpoint-hit" .* {{name="inv",value="<optimized out>"}} .* .* {.* disp="keep"} "compact: invalid: stop"
 mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"}\]} "compact: invalid: -stack-list-variables"
 
-if {[mi_runto main] == -1} {
+if {[mi_runto_main] == -1} {
     return -1
 }
 mi_gdb_test "-gdb-set print entry-values default" {\^done} "default: set print entry-values"
diff --git a/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp b/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp
index a55fae67dfe..83a8d5ff4a4 100644
--- a/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp
+++ b/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp
@@ -63,7 +63,7 @@ proc do_test {sync_command} {
 	    return
 	}
     } else {
-	if {[mi_runto main] < 0} {
+	if {[mi_runto_main] < 0} {
 	    return
 	}
 	if {[mi_send_resuming_command_raw "123-exec-continue" $test] >= 0} {
diff --git a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
index 390df005542..ed39443eb73 100644
--- a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
+++ b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
@@ -401,7 +401,7 @@ proc_with_prefix test_setup { mode } {
     mi_gdb_reinitialize_dir $srcdir/$subdir
     mi_gdb_load $binfile
 
-    if { [mi_runto main] < 0 } {
+    if { [mi_runto_main] < 0 } {
 	fail "can't run to main"
 	return
     }
diff --git a/gdb/testsuite/gdb.opt/inline-cmds.exp b/gdb/testsuite/gdb.opt/inline-cmds.exp
index 94314fe2e4c..516d76139cd 100644
--- a/gdb/testsuite/gdb.opt/inline-cmds.exp
+++ b/gdb/testsuite/gdb.opt/inline-cmds.exp
@@ -355,7 +355,7 @@ with_test_prefix "mi" {
 	continue
     }
     mi_gdb_load ${binfile}
-    mi_runto main
+    mi_runto_main
 
     set line_number [gdb_get_line_number "set mi break here"]
     mi_gdb_test "-break-insert ${srcfile}:${line_number}" \
diff --git a/gdb/testsuite/gdb.python/py-framefilter-mi.exp b/gdb/testsuite/gdb.python/py-framefilter-mi.exp
index 244ec1a2b6b..feb58111f4b 100644
--- a/gdb/testsuite/gdb.python/py-framefilter-mi.exp
+++ b/gdb/testsuite/gdb.python/py-framefilter-mi.exp
@@ -42,7 +42,7 @@ if {[lsearch -exact [mi_get_features] python] < 0} {
     return -1
 }
 
-mi_runto main
+mi_runto_main
 
 set remote_python_file [gdb_remote_download host ${srcdir}/${subdir}/${pyfile}]
 
diff --git a/gdb/testsuite/gdb.python/py-mi.exp b/gdb/testsuite/gdb.python/py-mi.exp
index abaa380186e..7216c4141d6 100644
--- a/gdb/testsuite/gdb.python/py-mi.exp
+++ b/gdb/testsuite/gdb.python/py-mi.exp
@@ -40,7 +40,7 @@ if {[lsearch -exact [mi_get_features] python] < 0} {
     return -1
 }
 
-mi_runto main
+mi_runto_main
 
 set remote_python_file [gdb_remote_download host ${srcdir}/${subdir}/${pyfile}]
 
@@ -347,7 +347,7 @@ if {[lsearch -exact [mi_get_features] python] < 0} {
     return -1
 }
 
-mi_runto main
+mi_runto_main
 mi_continue_to_line \
     [gdb_get_line_number {break to inspect struct and union} ${srcfile}] \
     "step to breakpoint"
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 0e7524ed0f6..732aed27b27 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1042,7 +1042,7 @@ proc mi_run_to_main { } {
     mi_gdb_reinitialize_dir $srcdir/$subdir
     mi_gdb_load ${binfile}
 
-    mi_runto main
+    mi_runto_main
 }
 
 
@@ -1086,6 +1086,12 @@ proc mi_runto {func} {
     return [mi_runto_helper $func "run"]
 }
 
+# Just like runto_main but works with the MI interface.
+
+proc mi_runto_main {} {
+    return [mi_runto_helper "main" "run"]
+}
+
 # Next to the next statement
 # For return values, see mi_execute_to_helper
 
-- 
2.14.5


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 3/5] gdb/testsuite/: Use -qualified in runto_main / mi_runto_main
  2020-10-12  0:47 [PATCH 0/5] runto_main and -qualified Pedro Alves
  2020-10-12  0:47 ` [PATCH 1/5] 'runto main' -> 'runto_main' throughout Pedro Alves
  2020-10-12  0:47 ` [PATCH 2/5] Introduce mi_runto_main Pedro Alves
@ 2020-10-12  0:47 ` Pedro Alves
  2020-10-13 18:06   ` Simon Marchi
  2020-10-12  0:47 ` [PATCH 4/5] gdb/testsuite/: Use "-qualified" in explicit "break main", etc Pedro Alves
  2020-10-12 18:56 ` [RESEND][PATCH 5/5] Eliminate mi_run_to_main, introduce mi_clean_restart Pedro Alves
  4 siblings, 1 reply; 14+ messages in thread
From: Pedro Alves @ 2020-10-12  0:47 UTC (permalink / raw)
  To: gdb-patches

In some runtimes, there may be a "main" function in some class or
namespace.  The breakpoint created by runto_main may therefore have
unexpected locations on some other functions than the actual main.
These breakpoint locations can unexpectedly get hit during tests and
lead to failures.

I saw this while playing with AMD's ROCm toolchain -- I wrote a board
file to run the testsuite against device kernels.  There, the runtime
calls a "main" function before the device kernel code is reached:

 Thread 4 "bit_extract" hit Breakpoint 1, 0x00007ffeea140960 in lld::elf::LinkerDriver::main(llvm::ArrayRef<char const*>) () from /opt/rocm/lib/libamd_comgr.so.1
 (gdb) bt
 #0  0x00007ffeea140960 in lld::elf::LinkerDriver::main(llvm::ArrayRef<char const*>) () from /opt/rocm/lib/libamd_comgr.so.1
 #1  0x00007ffeea2257a5 in lld::elf::link(llvm::ArrayRef<char const*>, bool, llvm::raw_ostream&, llvm::raw_ostream&) () from /opt/rocm/lib/libamd_comgr.so.1
 #2  0x00007ffeea1bc374 in COMGR::linkWithLLD(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&) () from /opt/rocm/lib/libamd_comgr.so.1
 #3  0x00007ffeea1bfb09 in COMGR::InProcessDriver::execute(llvm::ArrayRef<char const*>) () from /opt/rocm/lib/libamd_comgr.so.1
 #4  0x00007ffeea1c4da9 in COMGR::AMDGPUCompiler::linkToExecutable() () from /opt/rocm/lib/libamd_comgr.so.1
 #5  0x00007ffeea1fde20 in dispatchCompilerAction(amd_comgr_action_kind_s, COMGR::DataAction*, COMGR::DataSet*, COMGR::DataSet*, llvm::raw_ostream&) () from /opt/rocm/lib/libamd_comgr.so.1
 #6  0x00007ffeea203a87 in amd_comgr_do_action () from /opt/rocm/lib/libamd_comgr.so.1
 ...

To avoid that, pass "qualified" to runto, in runto_main, so that
gdb_breakpoint ends up creating a breakpoint with -qualified.  This
avoids creating breakpoints locations for other unrelated "main"
functions.

Note: I first tried making runto itself use "-qualified", but that
caused regressions in the gdb.ada/ tests, which use runto without
specifying the whole fully-qualified function name (i.e., without the
package).  So I end up restricting the -qualified to
runto_main/mi_runto_main.

The gdb.base/ui-redirect.exp change is necessary because that testcase
is looking at what "save breakpoint" generates.

gdb/testsuite/ChangeLog:

	* gdb.base/ui-redirect.exp: Expect "break -qualified main" in
	saved breakpoints file.
	* gdb.guile/scm-breakpoint.exp: Expect "-qualified main" when
	inspecting breakpoint list.
	* lib/gdb.exp (runto_main): Add "qualified" to options.
	* lib/mi-support.exp (mi_runto_helper): Add 'qualified' parameter,
	and handle it.
	(mi_runto_main): Pass 1 as qualified argument.

Change-Id: I51468359ab0a518f05f7c0394c97f7e33b45fe69
---
 gdb/testsuite/gdb.base/ui-redirect.exp     |  2 +-
 gdb/testsuite/gdb.guile/scm-breakpoint.exp |  2 +-
 gdb/testsuite/lib/gdb.exp                  |  2 +-
 gdb/testsuite/lib/mi-support.exp           | 10 +++++++---
 4 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/gdb/testsuite/gdb.base/ui-redirect.exp b/gdb/testsuite/gdb.base/ui-redirect.exp
index ef0a79178c7..9e0a694c798 100644
--- a/gdb/testsuite/gdb.base/ui-redirect.exp
+++ b/gdb/testsuite/gdb.base/ui-redirect.exp
@@ -47,7 +47,7 @@ gdb_breakpoint "foo"
 gdb_breakpoint "bar"
 
 set cmds [multi_line_input \
-	      "break main" \
+	      "break -qualified main" \
 	      "  commands" \
 	      "    print 1" \
 	      "  end" \
diff --git a/gdb/testsuite/gdb.guile/scm-breakpoint.exp b/gdb/testsuite/gdb.guile/scm-breakpoint.exp
index 7545392452e..3bcd5c81546 100644
--- a/gdb/testsuite/gdb.guile/scm-breakpoint.exp
+++ b/gdb/testsuite/gdb.guile/scm-breakpoint.exp
@@ -43,7 +43,7 @@ proc test_bkpt_basic { } {
 	gdb_scm_test_silent_cmd "guile (define blist (breakpoints))" \
 	    "get breakpoint list 1"
 	gdb_test "guile (print (car blist))" \
-	    "<gdb:breakpoint #1 BP_BREAKPOINT enabled noisy hit:1 ignore:0 @main>" \
+	    "<gdb:breakpoint #1 BP_BREAKPOINT enabled noisy hit:1 ignore:0 @-qualified main>" \
 	    "check main breakpoint"
 	gdb_test "guile (print (breakpoint-location (car blist)))" \
 	    "main" "check main breakpoint location"
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 608469953bf..4c9675f255f 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -689,7 +689,7 @@ proc runto { function args } {
 # If you don't want that, use gdb_start_cmd.
 
 proc runto_main { } {
-    return [runto main no-message]
+    return [runto main no-message qualified]
 }
 
 ### Continue, and expect to hit a breakpoint.
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 732aed27b27..693c7d2c467 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1056,7 +1056,7 @@ proc mi_run_to_main { } {
 #   -1  if test suppressed, failed, timedout
 #    0  if test passed
 
-proc mi_runto_helper {func run_or_continue} {
+proc mi_runto_helper {func run_or_continue {qualified 0}} {
   global suppress_flag
   if { $suppress_flag } {
     return -1
@@ -1068,7 +1068,11 @@ proc mi_runto_helper {func run_or_continue} {
   set test "mi runto $func"
   set bp [mi_make_breakpoint -type breakpoint -disp del \
 	      -func $func\(\\\(.*\\\)\)?]
-  mi_gdb_test "200-break-insert -t $func" "200\\^done,$bp" \
+  set extra_opts ""
+  if {$qualified} {
+      append extra_opts "--qualified"
+  }
+  mi_gdb_test "200-break-insert $extra_opts -t $func" "200\\^done,$bp" \
       "breakpoint at $func"
 
   if {$run_or_continue == "run"} {
@@ -1089,7 +1093,7 @@ proc mi_runto {func} {
 # Just like runto_main but works with the MI interface.
 
 proc mi_runto_main {} {
-    return [mi_runto_helper "main" "run"]
+    return [mi_runto_helper "main" "run" 1]
 }
 
 # Next to the next statement
-- 
2.14.5


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 4/5] gdb/testsuite/: Use "-qualified" in explicit "break main", etc.
  2020-10-12  0:47 [PATCH 0/5] runto_main and -qualified Pedro Alves
                   ` (2 preceding siblings ...)
  2020-10-12  0:47 ` [PATCH 3/5] gdb/testsuite/: Use -qualified in runto_main / mi_runto_main Pedro Alves
@ 2020-10-12  0:47 ` Pedro Alves
  2020-10-13 18:07   ` Simon Marchi
  2020-10-12 18:56 ` [RESEND][PATCH 5/5] Eliminate mi_run_to_main, introduce mi_clean_restart Pedro Alves
  4 siblings, 1 reply; 14+ messages in thread
From: Pedro Alves @ 2020-10-12  0:47 UTC (permalink / raw)
  To: gdb-patches

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(-)

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} $" {
-- 
2.14.5


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [RESEND][PATCH 5/5] Eliminate mi_run_to_main, introduce mi_clean_restart
  2020-10-12  0:47 [PATCH 0/5] runto_main and -qualified Pedro Alves
                   ` (3 preceding siblings ...)
  2020-10-12  0:47 ` [PATCH 4/5] gdb/testsuite/: Use "-qualified" in explicit "break main", etc Pedro Alves
@ 2020-10-12 18:56 ` Pedro Alves
  2020-10-13 18:19   ` Simon Marchi
  4 siblings, 1 reply; 14+ messages in thread
From: Pedro Alves @ 2020-10-12 18:56 UTC (permalink / raw)
  To: gdb-patches

[This patch is hitting sourceware's spam filters for some reason.
Frank unblocked it, we think.  Thus I'm resending it.  Hopefully
it will make it this time.]

I've also pushed the series to the users/palves/runto_main branch.

From 9359526f088cd1606eca44c04b5ea5b63d88c76f Mon Sep 17 00:00:00 2001
From: Pedro Alves <pedro@palves.net>
Date: Sun, 11 Oct 2020 21:58:31 +0100
Subject: [PATCH 5/5] Eliminate mi_run_to_main, introduce mi_clean_restart

Since we now have mi_runto_main which is like runto_main, eliminate
mi_run_to_main, in favor of a new MI clean_restart counterpart --
mi_clean_restart -- and mi_runto_main.

This makes MI testcases look a bit more like CLI testcases.

gdb/testsuite/ChangeLog:

	* lib/mi-support.exp (mi_clean_restart): New.
	(mi_run_to_main): Delete.
	All callers adjust to use mi_clean_restart / mi_runto_main.

Change-Id: I34920bab4fea1f23fb752928c2969c1f6ad714b6
---
 gdb/testsuite/gdb.ada/mi_catch_assert.exp          | 11 +-----
 gdb/testsuite/gdb.ada/mi_catch_ex.exp              | 13 ++-----
 gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp         |  9 ++---
 gdb/testsuite/gdb.ada/mi_dyn_arr.exp               | 11 +-----
 gdb/testsuite/gdb.ada/mi_exc_info.exp              |  7 +---
 gdb/testsuite/gdb.ada/mi_interface.exp             | 13 ++-----
 gdb/testsuite/gdb.ada/mi_prot.exp                  |  7 +---
 gdb/testsuite/gdb.ada/mi_ref_changeable.exp        | 11 +-----
 gdb/testsuite/gdb.ada/mi_string_access.exp         | 11 +-----
 gdb/testsuite/gdb.ada/mi_var_access.exp            | 10 +----
 gdb/testsuite/gdb.ada/mi_var_array.exp             | 11 +-----
 gdb/testsuite/gdb.ada/mi_var_union.exp             | 11 +-----
 gdb/testsuite/gdb.ada/mi_variant.exp               | 11 +-----
 gdb/testsuite/gdb.mi/gdb2549.exp                   | 11 +++---
 gdb/testsuite/gdb.mi/gdb669.exp                    |  8 +---
 gdb/testsuite/gdb.mi/gdb701.exp                    |  8 +---
 gdb/testsuite/gdb.mi/gdb792.exp                    | 15 ++------
 gdb/testsuite/gdb.mi/mi-break.exp                  |  2 +-
 gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp     |  8 ++--
 .../gdb.mi/mi-breakpoint-multiple-locations.exp    |  9 ++---
 gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp   |  9 +----
 gdb/testsuite/gdb.mi/mi-catch-load.exp             | 18 +++------
 gdb/testsuite/gdb.mi/mi-cli.exp                    |  9 ++---
 gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp      |  7 ++--
 gdb/testsuite/gdb.mi/mi-complete.exp               |  9 ++---
 gdb/testsuite/gdb.mi/mi-console.exp                |  4 +-
 gdb/testsuite/gdb.mi/mi-detach.exp                 |  8 +---
 gdb/testsuite/gdb.mi/mi-disassemble.exp            |  8 +---
 gdb/testsuite/gdb.mi/mi-dprintf.exp                | 10 +----
 gdb/testsuite/gdb.mi/mi-exit-code.exp              | 14 +++----
 gdb/testsuite/gdb.mi/mi-fill-memory.exp            |  8 +---
 gdb/testsuite/gdb.mi/mi-fortran-modules.exp        |  7 +---
 gdb/testsuite/gdb.mi/mi-frame-regs.exp             | 14 +++----
 gdb/testsuite/gdb.mi/mi-info-os.exp                |  2 +-
 gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp        |  7 +---
 gdb/testsuite/gdb.mi/mi-logging.exp                |  9 ++---
 gdb/testsuite/gdb.mi/mi-nonstop-exit.exp           | 14 +++----
 gdb/testsuite/gdb.mi/mi-nonstop.exp                | 18 +++------
 gdb/testsuite/gdb.mi/mi-ns-stale-regcache.exp      | 10 +----
 gdb/testsuite/gdb.mi/mi-nsintrall.exp              | 10 +----
 gdb/testsuite/gdb.mi/mi-nsmoribund.exp             | 10 +----
 gdb/testsuite/gdb.mi/mi-nsthrexec.exp              | 10 +----
 gdb/testsuite/gdb.mi/mi-read-memory.exp            |  8 +---
 gdb/testsuite/gdb.mi/mi-record-changed.exp         |  7 ++--
 gdb/testsuite/gdb.mi/mi-regs.exp                   |  9 ++---
 gdb/testsuite/gdb.mi/mi-reverse.exp                |  8 +---
 gdb/testsuite/gdb.mi/mi-stepi.exp                  |  8 +---
 gdb/testsuite/gdb.mi/mi-stepn.exp                  |  9 ++---
 gdb/testsuite/gdb.mi/mi-sym-info.exp               |  7 +---
 gdb/testsuite/gdb.mi/mi-syn-frame.exp              |  6 +--
 gdb/testsuite/gdb.mi/mi-var-create-rtti.exp        | 11 +-----
 gdb/testsuite/gdb.mi/mi-watch-nonstop.exp          | 10 +----
 gdb/testsuite/gdb.mi/pr11022.exp                   |  8 ++--
 gdb/testsuite/gdb.python/py-mi-events.exp          |  3 +-
 .../gdb.python/py-mi-var-info-path-expression.exp  | 11 ++----
 .../gdb.trace/mi-trace-frame-collected.exp         |  6 +--
 gdb/testsuite/gdb.trace/mi-trace-unavailable.exp   |  6 +--
 gdb/testsuite/gdb.trace/mi-traceframe-changed.exp  | 12 ++----
 gdb/testsuite/lib/mi-support.exp                   | 43 ++++++++++++++--------
 59 files changed, 184 insertions(+), 400 deletions(-)

diff --git a/gdb/testsuite/gdb.ada/mi_catch_assert.exp b/gdb/testsuite/gdb.ada/mi_catch_assert.exp
index 30543e56008..095815d1829 100644
--- a/gdb/testsuite/gdb.ada/mi_catch_assert.exp
+++ b/gdb/testsuite/gdb.ada/mi_catch_assert.exp
@@ -58,14 +58,7 @@ gdb_test_multiple "catch exception" $msg {
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+mi_clean_restart $binfile
 
 ###################################################
 # 2. Try catching conditionnal failed assertion.  #
@@ -77,7 +70,7 @@ mi_gdb_load ${binfile}
 #  - continue, we should see the second failed assertion
 #  - continue, the program exits.
 
-if ![mi_run_to_main] then {
+if {[mi_runto_main] < 0} {
    fail "cannot run to main, testcase aborted"
    return 0
 }
diff --git a/gdb/testsuite/gdb.ada/mi_catch_ex.exp b/gdb/testsuite/gdb.ada/mi_catch_ex.exp
index 63c6984bc66..103ec85f862 100644
--- a/gdb/testsuite/gdb.ada/mi_catch_ex.exp
+++ b/gdb/testsuite/gdb.ada/mi_catch_ex.exp
@@ -58,21 +58,14 @@ gdb_test_multiple "catch exception" $msg {
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+mi_clean_restart $binfile
 
 ####################################
 # 1. Try catching all exceptions.  #
 ####################################
 
 with_test_prefix "scenario 1" {
-    if ![mi_run_to_main] then {
+    if {[mi_runto_main] < 0} {
 	fail "cannot run to main, testcase aborted"
 	return 0
     }
@@ -130,7 +123,7 @@ continue_to_exception \
 #  - continue, the program exits.
 
 with_test_prefix "scenario 2" {
-    if ![mi_run_to_main] then {
+    if {[mi_runto_main] < 0} {
 	fail "cannot run to main, testcase aborted"
 	return 0
     }
diff --git a/gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp b/gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp
index 06e466672ea..ef3dd249790 100644
--- a/gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp
+++ b/gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp
@@ -57,17 +57,14 @@ gdb_test_multiple "catch handlers" $msg {
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
+mi_clean_restart $binfile
 
 #############################################
 # 1. Try catching all exceptions handlers.  #
 #############################################
 
 with_test_prefix "scenario 1" {
-    if ![mi_run_to_main] then {
+    if {[mi_runto_main] < 0} {
 	fail "cannot run to main, testcase aborted"
 	return 0
     }
@@ -119,7 +116,7 @@ continue_to_exception_handler \
 #    but exit instead.
 
 with_test_prefix "scenario 2" {
-    if ![mi_run_to_main] then {
+    if {[mi_runto_main] < 0} {
 	fail "cannot run to main, testcase aborted"
 	return 0
     }
diff --git a/gdb/testsuite/gdb.ada/mi_dyn_arr.exp b/gdb/testsuite/gdb.ada/mi_dyn_arr.exp
index 5c8b986e455..4b5d2c10d58 100644
--- a/gdb/testsuite/gdb.ada/mi_dyn_arr.exp
+++ b/gdb/testsuite/gdb.ada/mi_dyn_arr.exp
@@ -26,16 +26,9 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" }
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+mi_clean_restart $binfile
 
-if ![mi_run_to_main] then {
+if {[mi_runto_main] < 0} {
    fail "cannot run to main, testcase aborted"
    return 0
 }
diff --git a/gdb/testsuite/gdb.ada/mi_exc_info.exp b/gdb/testsuite/gdb.ada/mi_exc_info.exp
index eeb8247a3bf..52c37c45348 100644
--- a/gdb/testsuite/gdb.ada/mi_exc_info.exp
+++ b/gdb/testsuite/gdb.ada/mi_exc_info.exp
@@ -26,12 +26,9 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" }
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
+mi_clean_restart $binfile
 
-if ![mi_run_to_main] then {
+if {[mi_runto_main] < 0} {
    fail "cannot run to main, testcase aborted"
    return 0
 }
diff --git a/gdb/testsuite/gdb.ada/mi_interface.exp b/gdb/testsuite/gdb.ada/mi_interface.exp
index f948237558d..a2c0d0453e4 100644
--- a/gdb/testsuite/gdb.ada/mi_interface.exp
+++ b/gdb/testsuite/gdb.ada/mi_interface.exp
@@ -26,17 +26,10 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+mi_clean_restart $binfile
 
-if ![mi_run_to_main] then {
-   fail "cannot run to main, testcase aborted"
+if {[mi_runto_main] < 0} {
+    fail "cannot run to main, testcase aborted"
    return 0
 }
 
diff --git a/gdb/testsuite/gdb.ada/mi_prot.exp b/gdb/testsuite/gdb.ada/mi_prot.exp
index fb4ca8d7ffb..703fabdacdc 100644
--- a/gdb/testsuite/gdb.ada/mi_prot.exp
+++ b/gdb/testsuite/gdb.ada/mi_prot.exp
@@ -30,12 +30,9 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable \
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if {[mi_gdb_start]} {
-    continue
-}
+mi_clean_restart $binfile
 
-if {![mi_run_to_main]} then {
+if {[mi_runto_main] < 0} {
    fail "cannot run to main, testcase aborted"
    return 0
 }
diff --git a/gdb/testsuite/gdb.ada/mi_ref_changeable.exp b/gdb/testsuite/gdb.ada/mi_ref_changeable.exp
index 71f26c02dee..86df5680dda 100644
--- a/gdb/testsuite/gdb.ada/mi_ref_changeable.exp
+++ b/gdb/testsuite/gdb.ada/mi_ref_changeable.exp
@@ -26,16 +26,9 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" }
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+mi_clean_restart $binfile
 
-if ![mi_run_to_main] then {
+if {[mi_runto_main] < 0} {
    fail "cannot run to main, testcase aborted"
    return 0
 }
diff --git a/gdb/testsuite/gdb.ada/mi_string_access.exp b/gdb/testsuite/gdb.ada/mi_string_access.exp
index 5e07f1ebcc0..56c8522e196 100644
--- a/gdb/testsuite/gdb.ada/mi_string_access.exp
+++ b/gdb/testsuite/gdb.ada/mi_string_access.exp
@@ -26,16 +26,9 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" }
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+mi_clean_restart $binfile
 
-if ![mi_run_to_main] then {
+if {[mi_runto_main] < 0} {
    fail "cannot run to main, testcase aborted"
    return 0
 }
diff --git a/gdb/testsuite/gdb.ada/mi_var_access.exp b/gdb/testsuite/gdb.ada/mi_var_access.exp
index 14e899221e3..196daff904e 100644
--- a/gdb/testsuite/gdb.ada/mi_var_access.exp
+++ b/gdb/testsuite/gdb.ada/mi_var_access.exp
@@ -28,15 +28,9 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable debug] != "" } {
     return -1
 }
 
-if {[mi_gdb_start]} {
-    continue
-}
-
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+mi_clean_restart $binfile
 
-if ![mi_run_to_main] then {
+if {[mi_runto_main] < 0} {
     fail "cannot run to main, testcase aborted"
     return 0
 }
diff --git a/gdb/testsuite/gdb.ada/mi_var_array.exp b/gdb/testsuite/gdb.ada/mi_var_array.exp
index 4ef213b7a6e..09b89ce4e46 100644
--- a/gdb/testsuite/gdb.ada/mi_var_array.exp
+++ b/gdb/testsuite/gdb.ada/mi_var_array.exp
@@ -32,16 +32,9 @@ foreach_with_prefix scenario {none all minimal} {
 	return -1
     }
 
-    gdb_exit
-    if [mi_gdb_start] {
-	continue
-    }
-
-    mi_delete_breakpoints
-    mi_gdb_reinitialize_dir $srcdir/$subdir
-    mi_gdb_load ${binfile}
+    mi_clean_restart $binfile
 
-    if ![mi_run_to_main] then {
+    if {[mi_runto_main] < 0} {
 	fail "cannot run to main, testcase aborted"
 	return 0
     }
diff --git a/gdb/testsuite/gdb.ada/mi_var_union.exp b/gdb/testsuite/gdb.ada/mi_var_union.exp
index f950855d871..da09d7abedb 100644
--- a/gdb/testsuite/gdb.ada/mi_var_union.exp
+++ b/gdb/testsuite/gdb.ada/mi_var_union.exp
@@ -34,16 +34,9 @@ foreach_with_prefix scenario {none all minimal} {
 	return -1
     }
 
-    gdb_exit
-    if [mi_gdb_start] {
-	continue
-    }
-
-    mi_delete_breakpoints
-    mi_gdb_reinitialize_dir $srcdir/$subdir
-    mi_gdb_load ${binfile}
+    mi_clean_restart $binfile
 
-    if ![mi_run_to_main] then {
+    if {[mi_runto_main] < 0} {
 	fail "cannot run to main, testcase aborted"
 	return 0
     }
diff --git a/gdb/testsuite/gdb.ada/mi_variant.exp b/gdb/testsuite/gdb.ada/mi_variant.exp
index 01c67200581..d7e619191ae 100644
--- a/gdb/testsuite/gdb.ada/mi_variant.exp
+++ b/gdb/testsuite/gdb.ada/mi_variant.exp
@@ -33,16 +33,9 @@ foreach_with_prefix scenario {none all minimal} {
 	return -1
     }
 
-    gdb_exit
-    if [mi_gdb_start] {
-	continue
-    }
-
-    mi_delete_breakpoints
-    mi_gdb_reinitialize_dir $srcdir/$subdir
-    mi_gdb_load ${binfile}
+    mi_clean_restart $binfile
 
-    if ![mi_run_to_main] then {
+    if {[mi_runto_main] < 0} {
 	fail "cannot run to main, testcase aborted"
 	return 0
     }
diff --git a/gdb/testsuite/gdb.mi/gdb2549.exp b/gdb/testsuite/gdb.mi/gdb2549.exp
index cc6441c8ec0..54ef3b71435 100644
--- a/gdb/testsuite/gdb.mi/gdb2549.exp
+++ b/gdb/testsuite/gdb.mi/gdb2549.exp
@@ -25,11 +25,6 @@
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
 standard_testfile basics.c
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -103,8 +98,12 @@ proc register_tests { } {
     }
 }
 
+mi_clean_restart $binfile
+
 register_tests_no_exec
-mi_run_to_main
+
+mi_runto_main
+
 register_tests
 
 mi_gdb_exit
diff --git a/gdb/testsuite/gdb.mi/gdb669.exp b/gdb/testsuite/gdb.mi/gdb669.exp
index 4eaed22191c..edd076ec3a5 100644
--- a/gdb/testsuite/gdb.mi/gdb669.exp
+++ b/gdb/testsuite/gdb.mi/gdb669.exp
@@ -20,11 +20,6 @@
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if {[mi_gdb_start]} {
-    continue
-}
-
 #
 # Start here
 #
@@ -35,7 +30,8 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $option
     return -1
 }
 
-mi_run_to_main
+mi_clean_restart $binfile
+mi_runto_main
 check_mi_and_console_threads "at main"
 
 for {set i 0} {$i < 4} {incr i} {
diff --git a/gdb/testsuite/gdb.mi/gdb701.exp b/gdb/testsuite/gdb.mi/gdb701.exp
index 3f0801986c4..85c48f2ea7c 100644
--- a/gdb/testsuite/gdb.mi/gdb701.exp
+++ b/gdb/testsuite/gdb.mi/gdb701.exp
@@ -20,11 +20,6 @@
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
 standard_testfile
 
 if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable debug] != ""} {
@@ -40,7 +35,8 @@ if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable debug] != ""} {
 # If it doesn't, Bad Things Happen(TM).
 
 # Run to main
-mi_run_to_main
+mi_clean_restart $binfile
+mi_runto_main
 
 # Step over "foo = 0"
 mi_next "step over \"foo = 0\""
diff --git a/gdb/testsuite/gdb.mi/gdb792.exp b/gdb/testsuite/gdb.mi/gdb792.exp
index 89227036251..1fec75b0b93 100644
--- a/gdb/testsuite/gdb.mi/gdb792.exp
+++ b/gdb/testsuite/gdb.mi/gdb792.exp
@@ -13,20 +13,14 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-#
-# test gdb/792
-#
+# Test that children of classes are properly reported.  Regression
+# test for gdb/792.
 
 if { [skip_cplus_tests] } { continue }
 
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
 standard_testfile .cc
 
 if [get_compiler_info "c++"] {
@@ -38,10 +32,9 @@ if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable {debug c++}] != ""
   return -1
 }
 
-# Test that children of classes are properly reported
+mi_clean_restart $binfile
 
-# Run to main
-mi_run_to_main
+mi_runto_main
 
 mi_create_varobj "var1" "a" "create var for class A"
 
diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp
index 1149bb34c8d..3c594c8de4f 100644
--- a/gdb/testsuite/gdb.mi/mi-break.exp
+++ b/gdb/testsuite/gdb.mi/mi-break.exp
@@ -272,7 +272,7 @@ proc test_breakpoint_commands {} {
 	"\\^done,[mi_make_breakpoint_table [list $bp_no_script]]" \
         "breakpoint commands: check that commands are cleared"
 
-    mi_run_to_main
+    mi_runto_main
 
     mi_create_breakpoint "basics.c:callee2" \
 	"breakpoint commands: insert breakpoint at basics.c:callee2, again" \
diff --git a/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp b/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp
index 5dbedd8302f..3f3acfd9967 100644
--- a/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp
+++ b/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp
@@ -46,15 +46,13 @@ if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != ""
 proc test_insert_delete_modify { } {
     global mi_gdb_prompt
     global lib_sl1 lib_sl2
+    global binfile
 
-    gdb_exit
-    if [mi_gdb_start] {
-	continue
-    }
+    mi_clean_restart $binfile
 
     mi_load_shlibs $lib_sl1 $lib_sl2
 
-    mi_run_to_main
+    mi_runto_main
 
     mi_gdb_test "break marker" \
 	{(&.*)*.*~"Breakpoint 2 at.*\\n".*=breakpoint-created,bkpt=\{number="2",type="breakpoint".*\}.*\n\^done}
diff --git a/gdb/testsuite/gdb.mi/mi-breakpoint-multiple-locations.exp b/gdb/testsuite/gdb.mi/mi-breakpoint-multiple-locations.exp
index 60a098e6013..0f5d33599a9 100644
--- a/gdb/testsuite/gdb.mi/mi-breakpoint-multiple-locations.exp
+++ b/gdb/testsuite/gdb.mi/mi-breakpoint-multiple-locations.exp
@@ -53,15 +53,12 @@ proc make_breakpoints_pattern { expect_fixed_output bp_num loc1_en loc2_en } {
 proc do_test { mi_version use_fix_flag expect_fixed_output } {
     with_test_prefix "mi_version=${mi_version}" {
 	with_test_prefix "use_fix_flag=${use_fix_flag}" {
-	    global MIFLAGS decimal
+	    global MIFLAGS decimal binfile
 	    set MIFLAGS "-i=mi${mi_version}"
 
-	    gdb_exit
-	    if {[mi_gdb_start]} {
-		return
-	    }
+	    mi_clean_restart $binfile
 
-	    mi_run_to_main
+	    mi_runto_main
 
 	    if $use_fix_flag {
 		mi_gdb_test "-fix-multi-location-breakpoint-output" "\\^done" \
diff --git a/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp b/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp
index 14e820fa350..54383f66d65 100644
--- a/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp
+++ b/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp
@@ -27,13 +27,8 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
     return -1
 }
 
-if [mi_gdb_start] {
-    continue
-}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
-if {![mi_run_to_main]} {
+mi_clean_restart $binfile
+if {[mi_runto_main] < 0} {
     return -1
 }
 set libstdcxx_probe_tests_supported [expr ![mi_skip_libstdcxx_probe_tests]]
diff --git a/gdb/testsuite/gdb.mi/mi-catch-load.exp b/gdb/testsuite/gdb.mi/mi-catch-load.exp
index b2538070316..21f3fe03db6 100644
--- a/gdb/testsuite/gdb.mi/mi-catch-load.exp
+++ b/gdb/testsuite/gdb.mi/mi-catch-load.exp
@@ -18,11 +18,6 @@ if {[skip_shlib_tests]} {
     return -1
 }
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
 if {[get_compiler_info]} {
     warning "Could not get compiler info"
     untested "no compiler info"
@@ -44,7 +39,9 @@ if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcfile2}" ${binfile2} {debug}] !
     untested "failed to compile shared library"
     return -1
 }
-mi_run_to_main
+
+mi_clean_restart $binfile
+mi_runto_main
 
 # test -catch-load
 mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" "catch-load: auto-solib-add on"
@@ -66,13 +63,8 @@ gdb_expect {
     }
 }
 
-mi_gdb_exit
-
-
-if [mi_gdb_start] {
-    continue
-}
-mi_run_to_main
+mi_clean_restart $binfile
+mi_runto_main
 
 # test -catch-unload
 mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" "catch-unload: auto-solib-add on"
diff --git a/gdb/testsuite/gdb.mi/mi-cli.exp b/gdb/testsuite/gdb.mi/mi-cli.exp
index 214cc8a479e..ad06c7c05da 100644
--- a/gdb/testsuite/gdb.mi/mi-cli.exp
+++ b/gdb/testsuite/gdb.mi/mi-cli.exp
@@ -22,11 +22,6 @@
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
 standard_testfile basics.c
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -34,6 +29,8 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
      return -1
 }
 
+mi_clean_restart $binfile
+
 mi_gdb_test "-interpreter-exec" \
   {\^error,msg="-interpreter-exec: Usage: -interpreter-exec interp command"} \
   "-interpreter-exec with no arguments"
@@ -59,7 +56,7 @@ mi_gdb_test "-interpreter-exec console \"file $binfile\"" \
   {~"Reading symbols from .*mi-cli...\\n".*} \
   "-interpreter-exec console \"file \$binfile\""
 
-mi_run_to_main
+mi_runto_main
 
 set line_main_head    [gdb_get_line_number "main ("]
 set line_main_body    [expr $line_main_head + 2]
diff --git a/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp b/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp
index 2d653c0e801..1715c764d24 100644
--- a/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp
+++ b/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp
@@ -28,12 +28,11 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
 
 proc test_command_param_changed { } {
     global scheduler_locking_supported
+    global binfile
 
     with_test_prefix "cmd param" {
-	if [mi_gdb_start] {
-	    return
-	}
-	mi_run_to_main
+	mi_clean_restart $binfile
+	mi_runto_main
 
 	if { $scheduler_locking_supported } {
 	    foreach opt { "on" "off" "step" } {
diff --git a/gdb/testsuite/gdb.mi/mi-complete.exp b/gdb/testsuite/gdb.mi/mi-complete.exp
index 626d72d60e1..a1ab50d3d9c 100644
--- a/gdb/testsuite/gdb.mi/mi-complete.exp
+++ b/gdb/testsuite/gdb.mi/mi-complete.exp
@@ -19,11 +19,6 @@
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
 standard_testfile .cc
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
@@ -31,7 +26,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debu
      return -1
 }
 
-mi_run_to_main
+mi_clean_restart $binfile
+
+mi_runto_main
 
 mi_gdb_test "1-complete br" \
             "1\\^done,completion=\"break\",matches=\\\[.*\"break\",.*\"break-range\".*\\\],max_completions_reached=\"0\"" \
diff --git a/gdb/testsuite/gdb.mi/mi-console.exp b/gdb/testsuite/gdb.mi/mi-console.exp
index e334d0bf0f3..02e70c01f80 100644
--- a/gdb/testsuite/gdb.mi/mi-console.exp
+++ b/gdb/testsuite/gdb.mi/mi-console.exp
@@ -58,7 +58,9 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
      return -1
 }
 
-mi_run_to_main
+mi_gdb_reinitialize_dir $srcdir/$subdir
+mi_gdb_load ${binfile}
+mi_runto_main
 
 # The output we get from the target depends on how it is hosted.  If
 # we are semihosted (e.g., the sim or a remote target that supports
diff --git a/gdb/testsuite/gdb.mi/mi-detach.exp b/gdb/testsuite/gdb.mi/mi-detach.exp
index a9b8362659b..1027488eeb4 100644
--- a/gdb/testsuite/gdb.mi/mi-detach.exp
+++ b/gdb/testsuite/gdb.mi/mi-detach.exp
@@ -18,11 +18,6 @@
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
 standard_testfile basics.c
 
 if {[build_executable $testfile.exp $testfile $srcfile {debug}] == -1} {
@@ -30,6 +25,7 @@ if {[build_executable $testfile.exp $testfile $srcfile {debug}] == -1} {
      return -1
 }
 
-mi_run_to_main
+mi_clean_restart $binfile
+mi_runto_main
 
 mi_gdb_test "-target-detach" "=thread-exited,id=\"1\".*=thread-group-exited,id=\"i1\".*" "detach"
diff --git a/gdb/testsuite/gdb.mi/mi-disassemble.exp b/gdb/testsuite/gdb.mi/mi-disassemble.exp
index d17d957ee22..87f8c72251c 100644
--- a/gdb/testsuite/gdb.mi/mi-disassemble.exp
+++ b/gdb/testsuite/gdb.mi/mi-disassemble.exp
@@ -23,11 +23,6 @@
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
 standard_testfile basics.c
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -244,7 +239,8 @@ proc test_disassembly_bogus_args {} {
 
 }
 
-mi_run_to_main
+mi_clean_restart $binfile
+mi_runto_main
 test_disassembly_only
 test_disassembly_with_opcodes
 test_disassembly_mixed
diff --git a/gdb/testsuite/gdb.mi/mi-dprintf.exp b/gdb/testsuite/gdb.mi/mi-dprintf.exp
index ce0670fea29..6254787f212 100644
--- a/gdb/testsuite/gdb.mi/mi-dprintf.exp
+++ b/gdb/testsuite/gdb.mi/mi-dprintf.exp
@@ -17,11 +17,6 @@
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
 standard_testfile
 
 if {[build_executable $testfile.exp $testfile $srcfile {debug}] == -1} {
@@ -29,12 +24,11 @@ if {[build_executable $testfile.exp $testfile $srcfile {debug}] == -1} {
     return -1
 }
 
-mi_delete_breakpoints
-
 set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
 set dp_location1 [gdb_get_line_number "set dprintf 1 here"]
 
-mi_run_to_main
+mi_clean_restart $binfile
+mi_runto_main
 
 set i 0
 mi_gdb_test "[incr i]-dprintf-insert" \
diff --git a/gdb/testsuite/gdb.mi/mi-exit-code.exp b/gdb/testsuite/gdb.mi/mi-exit-code.exp
index f10b49cee0f..b8a133a19c0 100644
--- a/gdb/testsuite/gdb.mi/mi-exit-code.exp
+++ b/gdb/testsuite/gdb.mi/mi-exit-code.exp
@@ -16,11 +16,6 @@
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
 standard_testfile
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -31,6 +26,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debu
 proc test_list_thread_groups { } {
     global hex
     global decimal
+    global binfile
+
+    mi_clean_restart
 
     # Before any run, exit-code should not be present.
     mi_gdb_test \
@@ -38,8 +36,10 @@ proc test_list_thread_groups { } {
 	"122\\^done,groups=\\\[\{id=\"i1\",type=\"process\"\}\]" \
 	"-list-thread-groups before run shows no exit-code"
 
+    mi_clean_restart $binfile
+
     with_test_prefix "first run" {
-	mi_run_to_main
+	mi_runto_main
 
 	# During the run, exit-code should not be present.
 	mi_gdb_test \
@@ -59,7 +59,7 @@ proc test_list_thread_groups { } {
     }
 
     with_test_prefix "second run" {
-	mi_run_to_main
+	mi_runto_main
 
 	# Write the exit code we want in the global var
 	mi_gdb_test "set var exit_code = 8" ".*\\^done" "write exit code"
diff --git a/gdb/testsuite/gdb.mi/mi-fill-memory.exp b/gdb/testsuite/gdb.mi/mi-fill-memory.exp
index acc9b92e398..658da39bce3 100644
--- a/gdb/testsuite/gdb.mi/mi-fill-memory.exp
+++ b/gdb/testsuite/gdb.mi/mi-fill-memory.exp
@@ -20,11 +20,6 @@
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
 standard_testfile "mi-read-memory"
  
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}.c" "${binfile}" executable {debug}] != "" } {
@@ -32,7 +27,8 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}.c" "${binfile}" executable {d
      return -1
 }
 
-mi_run_to_main
+mi_clean_restart $binfile
+mi_runto_main
 mi_next_to "main" "" "mi-read-memory.c" "20" "next at main"
 
 mi_gdb_test "1-data-write-memory-bytes"\
diff --git a/gdb/testsuite/gdb.mi/mi-fortran-modules.exp b/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
index e7ee1b96e46..de5657d2823 100644
--- a/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
+++ b/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
@@ -26,12 +26,9 @@ if {[prepare_for_testing "failed to prepare" ${testfile} \
     return -1
 }
 
-gdb_exit
-if {[mi_gdb_start]} {
-    continue
-}
+mi_clean_restart $binfile
 
-mi_run_to_main
+mi_runto_main
 
 
 # Patterns to skip optional system modules that appear with later versions of GFortran.
diff --git a/gdb/testsuite/gdb.mi/mi-frame-regs.exp b/gdb/testsuite/gdb.mi/mi-frame-regs.exp
index c5cec8d6c29..420fe7a878d 100644
--- a/gdb/testsuite/gdb.mi/mi-frame-regs.exp
+++ b/gdb/testsuite/gdb.mi/mi-frame-regs.exp
@@ -58,17 +58,16 @@ proc breakpoint_address {bpnum} {
 # breakpoints in different functions.
 
 proc_with_prefix do_floating_varobj_test {} {
-    global srcfile
+    global srcfile binfile
     global hex
     global expect_out
 
-    gdb_exit
-    if {[mi_gdb_start]} then {
+    if {[mi_clean_restart $binfile]} {
 	fail "couldn't start gdb"
 	return
     }
 
-    mi_run_to_main
+    mi_runto_main
 
     # Create a floating varobj for $pc.
     mi_gdb_test "-var-create --thread 1 --frame 0 - @ \$pc" \
@@ -111,16 +110,15 @@ proc_with_prefix do_floating_varobj_test {} {
 # counter changes (without substantially changing the stack).
 
 proc_with_prefix do_fixed_varobj_test {} {
-    global srcfile
+    global srcfile binfile
     global hex
 
-    gdb_exit
-    if {[mi_gdb_start]} then {
+    if {[mi_clean_restart $binfile] != 0} {
 	fail "couldn't start gdb"
 	return
     }
 
-    mi_run_to_main
+    mi_runto_main
 
     # Run to the function 'callee3' so we have several frames.
     mi_create_breakpoint "basics.c:callee3" \
diff --git a/gdb/testsuite/gdb.mi/mi-info-os.exp b/gdb/testsuite/gdb.mi/mi-info-os.exp
index 49b2e8e2e01..347b01c10fe 100644
--- a/gdb/testsuite/gdb.mi/mi-info-os.exp
+++ b/gdb/testsuite/gdb.mi/mi-info-os.exp
@@ -45,7 +45,7 @@ if {[mi_gdb_load $binfile] < 0} {
 # When testing a cross configuration, we need to be sure to first
 # connect to the target.  If we didn't do that, GDB would try running
 # the command against the default run target.  The usual way to do
-# that and cover all targets is to run to main, with mi_run_to_main.
+# that and cover all targets is to run to main, with mi_runto_main.
 # However, with native configurations, -info-os should work before
 # running any program, so we want to avoid "run".  Using
 # mi_gdb_target_load directly instead achieves this.
diff --git a/gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp b/gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp
index 58f974a54dd..0f8f59b5a41 100644
--- a/gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp
+++ b/gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp
@@ -31,17 +31,14 @@ if {[prepare_for_testing "failed to prepare" $exefile $srcfile {debug c++}]} {
     return -1
 }
 
-gdb_exit
-if {[mi_gdb_start]} {
-    continue
-}
+mi_clean_restart $binfile
 
 # Turn off the pending breakpoint queries.
 mi_gdb_test "-interpreter-exec console \"set breakpoint pending off\"" \
   {=cmd-param-changed,param=\"breakpoint pending\",.*\^done} \
   "-interpreter-exec console \"set breakpoint pending off\""
 
-mi_run_to_main
+mi_runto_main
 
 # Run to a location in the file.
 set bp_location [gdb_get_line_number "set breakpoint here"]
diff --git a/gdb/testsuite/gdb.mi/mi-logging.exp b/gdb/testsuite/gdb.mi/mi-logging.exp
index 45401432ee5..6da365ef68e 100644
--- a/gdb/testsuite/gdb.mi/mi-logging.exp
+++ b/gdb/testsuite/gdb.mi/mi-logging.exp
@@ -16,11 +16,6 @@
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
 standard_testfile basics.c
 set opts {debug}
 
@@ -29,7 +24,9 @@ if [build_executable $testfile.exp $testfile $srcfile $opts] {
     return -1
 }
 
-if {[mi_run_to_main] < 0} {
+mi_clean_restart $binfile
+
+if {[mi_runto_main] < 0} {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp b/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp
index ff27fa33160..3e58754c9a4 100644
--- a/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp
+++ b/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp
@@ -21,11 +21,6 @@ if { ![support_displaced_stepping] } {
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if {[mi_gdb_start]} {
-    continue
-}
-
 #
 # Start here
 #
@@ -36,14 +31,13 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $option
     return -1
 }
 
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load $binfile
+mi_clean_restart $binfile
 
 mi_gdb_test "-gdb-set non-stop 1" ".*"
 mi_gdb_test "-gdb-set mi-async 1" ".*"
 mi_detect_async
 
-if { [mi_run_to_main] < 0 } {
+if { [mi_runto_main] < 0 } {
     continue
 }
 
@@ -53,7 +47,9 @@ mi_expect_stop "exited-normally" "" "" "" "" "" "finished exec continue"
 
 # Run the program again.
 
-if { [mi_run_to_main] < 0 } {
+mi_delete_breakpoints
+
+if { [mi_runto_main] < 0 } {
     continue
 }
 
diff --git a/gdb/testsuite/gdb.mi/mi-nonstop.exp b/gdb/testsuite/gdb.mi/mi-nonstop.exp
index 7f98bee4096..bb4520e9337 100644
--- a/gdb/testsuite/gdb.mi/mi-nonstop.exp
+++ b/gdb/testsuite/gdb.mi/mi-nonstop.exp
@@ -22,15 +22,6 @@ if { ![support_displaced_stepping] } {
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-
-save_vars { GDBFLAGS } {
-    append GDBFLAGS " -ex \"set non-stop on\""
-    if {[mi_gdb_start]} {
-	continue
-    }
-}
-
 proc mi_nonstop_resume { command test } {
     if { [mi_send_resuming_command $command $test] != 0 } {
 	# If a resume fails, assume non-stop is broken or unsupported
@@ -50,13 +41,16 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $option
     return -1
 }
 
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load $binfile
+
+save_vars { GDBFLAGS } {
+    append GDBFLAGS " -ex \"set non-stop on\""
+    mi_clean_restart $binfile
+}
 
 mi_gdb_test "-gdb-set mi-async 1" ".*"
 mi_detect_async
 
-if { [mi_run_to_main] < 0 } {
+if { [mi_runto_main] < 0 } {
     continue
 }
 
diff --git a/gdb/testsuite/gdb.mi/mi-ns-stale-regcache.exp b/gdb/testsuite/gdb.mi/mi-ns-stale-regcache.exp
index 35a6315470e..ebbdb4186a4 100644
--- a/gdb/testsuite/gdb.mi/mi-ns-stale-regcache.exp
+++ b/gdb/testsuite/gdb.mi/mi-ns-stale-regcache.exp
@@ -24,11 +24,6 @@ if { ![support_displaced_stepping] } {
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if {[mi_gdb_start]} {
-    continue
-}
-
 proc mi_nonstop_resume { command test } {
     if { [mi_send_resuming_command $command $test] != 0 } {
 	# If a resume fails, assume non-stop is broken or unsupported
@@ -49,14 +44,13 @@ if {[gdb_compile "$srcdir/$subdir/$srcfile" \
     return -1
 }
 
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load $binfile
+mi_clean_restart $binfile
 
 mi_gdb_test "-gdb-set non-stop 1" ".*"
 mi_gdb_test "-gdb-set mi-async 1" ".*"
 mi_detect_async
 
-if { [mi_run_to_main] < 0 } {
+if { [mi_runto_main] < 0 } {
     continue
 }
 
diff --git a/gdb/testsuite/gdb.mi/mi-nsintrall.exp b/gdb/testsuite/gdb.mi/mi-nsintrall.exp
index c020c6ac1b7..aa0e81c84ca 100644
--- a/gdb/testsuite/gdb.mi/mi-nsintrall.exp
+++ b/gdb/testsuite/gdb.mi/mi-nsintrall.exp
@@ -21,11 +21,6 @@ if { ![support_displaced_stepping] } {
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if {[mi_gdb_start]} {
-    continue
-}
-
 #
 # Start here
 #
@@ -36,14 +31,13 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $option
     return -1
 }
 
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load $binfile
+mi_clean_restart $binfile
 
 mi_gdb_test "-gdb-set non-stop 1" ".*"
 mi_gdb_test "-gdb-set mi-async 1" ".*"
 mi_detect_async
 
-if { [mi_run_to_main] < 0 } {
+if { [mi_runto_main] < 0 } {
     continue
 }
 
diff --git a/gdb/testsuite/gdb.mi/mi-nsmoribund.exp b/gdb/testsuite/gdb.mi/mi-nsmoribund.exp
index d311e1fe89b..3e99b5f0c6f 100644
--- a/gdb/testsuite/gdb.mi/mi-nsmoribund.exp
+++ b/gdb/testsuite/gdb.mi/mi-nsmoribund.exp
@@ -21,11 +21,6 @@ if { ![support_displaced_stepping] } {
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if {[mi_gdb_start]} {
-    continue
-}
-
 #
 # Start here
 #
@@ -36,14 +31,13 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $option
     return -1
 }
 
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load $binfile
+mi_clean_restart $binfile
 
 mi_gdb_test "-gdb-set non-stop 1" ".*"
 mi_gdb_test "-gdb-set mi-async 1" ".*"
 mi_detect_async
 
-if { [mi_run_to_main] < 0 } {
+if { [mi_runto_main] < 0 } {
     continue
 }
 
diff --git a/gdb/testsuite/gdb.mi/mi-nsthrexec.exp b/gdb/testsuite/gdb.mi/mi-nsthrexec.exp
index 27101cae22c..6f4800aa912 100644
--- a/gdb/testsuite/gdb.mi/mi-nsthrexec.exp
+++ b/gdb/testsuite/gdb.mi/mi-nsthrexec.exp
@@ -26,11 +26,6 @@ if { ![support_displaced_stepping] } {
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if {[mi_gdb_start]} {
-    continue
-}
-
 #
 # Start here
 #
@@ -41,14 +36,13 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $option
     return -1
 }
 
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load $binfile
+mi_clean_restart $binfile
 
 mi_gdb_test "-gdb-set non-stop 1" ".*"
 mi_gdb_test "-gdb-set mi-async 1" ".*"
 mi_detect_async
 
-if { [mi_run_to_main] < 0 } {
+if { [mi_runto_main] < 0 } {
     continue
 }
 
diff --git a/gdb/testsuite/gdb.mi/mi-read-memory.exp b/gdb/testsuite/gdb.mi/mi-read-memory.exp
index a9b8dbce62a..7c1047eeea0 100644
--- a/gdb/testsuite/gdb.mi/mi-read-memory.exp
+++ b/gdb/testsuite/gdb.mi/mi-read-memory.exp
@@ -18,11 +18,6 @@
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
 standard_testfile
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -30,8 +25,9 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
      return -1
 }
 
+mi_clean_restart $binfile
+mi_runto_main
 
-mi_run_to_main
 mi_next_to "main" "" "mi-read-memory.c" "20" "next at main"
 
 mi_gdb_test "1-data-read-memory" \
diff --git a/gdb/testsuite/gdb.mi/mi-record-changed.exp b/gdb/testsuite/gdb.mi/mi-record-changed.exp
index bef48d602d4..bed77c89d15 100644
--- a/gdb/testsuite/gdb.mi/mi-record-changed.exp
+++ b/gdb/testsuite/gdb.mi/mi-record-changed.exp
@@ -26,10 +26,9 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
 
 load_lib mi-support.exp
 
-if [mi_gdb_start] {
-    return
-}
-mi_run_to_main
+mi_clean_restart $binfile
+
+mi_runto_main
 
 mi_gdb_test "record" ".*=record-started,thread-group=\"i${decimal}\",method=\"full\".*\\^done" \
     "record"
diff --git a/gdb/testsuite/gdb.mi/mi-regs.exp b/gdb/testsuite/gdb.mi/mi-regs.exp
index 81ff8acfde0..13ab59c1357 100644
--- a/gdb/testsuite/gdb.mi/mi-regs.exp
+++ b/gdb/testsuite/gdb.mi/mi-regs.exp
@@ -25,11 +25,6 @@
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
 standard_testfile basics.c
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -110,8 +105,10 @@ proc sparc_register_tests { } {
 }
 
 if [istarget "sparc-*-*"] then {
+    mi_clean_restart
     sparc_register_tests_no_exec
-    mi_run_to_main
+    mi_clean_restart $binfile
+    mi_runto_main
     sparc_register_tests
 } else {
     verbose "mi-regs.exp tests ignored for this target"
diff --git a/gdb/testsuite/gdb.mi/mi-reverse.exp b/gdb/testsuite/gdb.mi/mi-reverse.exp
index 091173ea829..f92450eb2d6 100644
--- a/gdb/testsuite/gdb.mi/mi-reverse.exp
+++ b/gdb/testsuite/gdb.mi/mi-reverse.exp
@@ -34,11 +34,6 @@ if ![supports_reverse] {
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
 standard_testfile basics.c
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -46,7 +41,8 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
      return -1
 }
 
-mi_run_to_main
+mi_clean_restart $binfile
+mi_runto_main
 
 if [supports_process_record] {
     # Activate process record/replay
diff --git a/gdb/testsuite/gdb.mi/mi-stepi.exp b/gdb/testsuite/gdb.mi/mi-stepi.exp
index a1efdf78e2d..1f3e5593a06 100644
--- a/gdb/testsuite/gdb.mi/mi-stepi.exp
+++ b/gdb/testsuite/gdb.mi/mi-stepi.exp
@@ -23,11 +23,6 @@
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
 standard_testfile basics.c
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -68,7 +63,8 @@ proc test_stepi_nexti {} {
     }
 }
 
-mi_run_to_main
+mi_clean_restart $binfile
+mi_runto_main
 test_stepi_nexti
 
 mi_gdb_exit
diff --git a/gdb/testsuite/gdb.mi/mi-stepn.exp b/gdb/testsuite/gdb.mi/mi-stepn.exp
index 4725da15e43..9a0a68d5c00 100644
--- a/gdb/testsuite/gdb.mi/mi-stepn.exp
+++ b/gdb/testsuite/gdb.mi/mi-stepn.exp
@@ -19,11 +19,6 @@
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
 standard_testfile
 
 set opts {debug}
@@ -31,7 +26,9 @@ if [build_executable ${testfile}.exp ${testfile} ${srcfile} $opts] {
     return -1
 }
 
-if {[mi_run_to_main] < 0} {
+mi_clean_restart $binfile
+
+if {[mi_runto_main] < 0} {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.mi/mi-sym-info.exp b/gdb/testsuite/gdb.mi/mi-sym-info.exp
index 859dabd040e..207f8922783 100644
--- a/gdb/testsuite/gdb.mi/mi-sym-info.exp
+++ b/gdb/testsuite/gdb.mi/mi-sym-info.exp
@@ -33,12 +33,9 @@ if {[prepare_for_testing "failed to prepare" ${testfile} \
     return -1
 }
 
-gdb_exit
-if {[mi_gdb_start]} {
-    continue
-}
+mi_clean_restart $binfile
 
-mi_run_to_main
+mi_runto_main
 
 set qstr "\"\[^\"\]+\""
 set fun_re "\{line=\"$decimal\",name=${qstr},type=${qstr},description=${qstr}\}"
diff --git a/gdb/testsuite/gdb.mi/mi-syn-frame.exp b/gdb/testsuite/gdb.mi/mi-syn-frame.exp
index 48e872ab669..4207f31647a 100644
--- a/gdb/testsuite/gdb.mi/mi-syn-frame.exp
+++ b/gdb/testsuite/gdb.mi/mi-syn-frame.exp
@@ -32,9 +32,9 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
      return -1
 }
 
-mi_gdb_exit
-mi_gdb_start
-mi_run_to_main
+mi_clean_restart $binfile
+
+mi_runto_main
 
 mi_create_breakpoint "foo" \
     "insert breakpoint foo" \
diff --git a/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp b/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp
index a64529a86e3..3ad3b5c6829 100644
--- a/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp
@@ -16,11 +16,6 @@
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
 standard_testfile .c
 set opts {debug}
 
@@ -28,11 +23,9 @@ if [build_executable $testfile.exp $testfile $srcfile $opts] {
     return -1
 }
 
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+mi_clean_restart $binfile
 
-if ![mi_run_to_main] {
+if {[mi_runto_main] < 0} {
     untested "could not run to main"
     return -1
 }
diff --git a/gdb/testsuite/gdb.mi/mi-watch-nonstop.exp b/gdb/testsuite/gdb.mi/mi-watch-nonstop.exp
index fc2872d705d..6b56f384239 100644
--- a/gdb/testsuite/gdb.mi/mi-watch-nonstop.exp
+++ b/gdb/testsuite/gdb.mi/mi-watch-nonstop.exp
@@ -25,11 +25,6 @@ if { ![support_displaced_stepping] } {
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if {[mi_gdb_start]} {
-    continue
-}
-
 proc mi_nonstop_resume { command test } {
     if { [mi_send_resuming_command $command $test] != 0 } {
 	# If a resume fails, assume non-stop is broken or unsupported
@@ -48,14 +43,13 @@ if {[gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable {debug}] != "" }
     return -1
 }
 
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load $binfile
+mi_clean_restart $binfile
 
 mi_gdb_test "-gdb-set non-stop 1" ".*"
 mi_gdb_test "-gdb-set mi-async 1" ".*"
 mi_detect_async
 
-if { [mi_run_to_main] < 0 } {
+if { [mi_runto_main] < 0 } {
     continue
 }
 
diff --git a/gdb/testsuite/gdb.mi/pr11022.exp b/gdb/testsuite/gdb.mi/pr11022.exp
index ffd36874246..850261b83e1 100644
--- a/gdb/testsuite/gdb.mi/pr11022.exp
+++ b/gdb/testsuite/gdb.mi/pr11022.exp
@@ -29,12 +29,10 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
 
 proc test_memory_changed_observer { mi_command } {
     with_test_prefix "${mi_command}" {
-	global srcfile
+	global srcfile binfile
 
-	if [mi_gdb_start] {
-	    return
-	}
-	mi_run_to_main
+	mi_clean_restart $binfile
+	mi_runto_main
 
 	set line_number [gdb_get_line_number "break here"]
 	mi_gdb_test "-break-insert ${srcfile}:${line_number}" \
diff --git a/gdb/testsuite/gdb.python/py-mi-events.exp b/gdb/testsuite/gdb.python/py-mi-events.exp
index 9f2d7dc13c6..f76a4719e4e 100644
--- a/gdb/testsuite/gdb.python/py-mi-events.exp
+++ b/gdb/testsuite/gdb.python/py-mi-events.exp
@@ -49,7 +49,8 @@ if [is_remote host] {
 }
 
 mi_gdb_test "-file-exec-and-symbols ${filename}"  ".*\\^done" "file-exec-and-symbols operation"
-mi_run_to_main
+mi_gdb_load ${binfile}
+mi_runto_main
 
 
 # register the python event handlers with test-events command
diff --git a/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.exp b/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.exp
index 9b82355d14e..2e611c7d964 100644
--- a/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.exp
+++ b/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.exp
@@ -18,11 +18,6 @@
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-gdb_exit
-if {[mi_gdb_start]} {
-    continue
-}
-
 #
 # Start here
 #
@@ -32,6 +27,8 @@ if {[gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable {debug}] != "" }
     return -1
 }
 
+mi_clean_restart $binfile
+
 # Skip all tests if Python scripting is not enabled.
 if { [mi_skip_python_tests] } { continue }
 
@@ -48,9 +45,7 @@ mi_gdb_test "set python print-stack full" \
   ".*\\^done" \
   "set python print-stack full"
 
-
-mi_run_to_main
-
+mi_runto_main
 
 mi_continue_to_line [gdb_get_line_number "next line" ${srcfile}] \
   "step to breakpoint"
diff --git a/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp b/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp
index 969fe2755c6..4c7c103605c 100644
--- a/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp
+++ b/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp
@@ -41,10 +41,8 @@ gdb_exit
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-if [mi_gdb_start] {
-    return
-}
-mi_run_to_main
+mi_clean_restart $binfile
+mi_runto_main
 
 mi_gdb_test "-break-insert end" \
     "\\^done,bkpt=\{number=\"${decimal}\",type=\"breakpoint\".*\"\}" \
diff --git a/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp b/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp
index 77923a510c2..4abb92be107 100644
--- a/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp
+++ b/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp
@@ -36,10 +36,8 @@ gdb_exit
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-if [mi_gdb_start] {
-    return
-}
-mi_run_to_main
+mi_clean_restart $binfile
+mi_runto_main
 
 mi_gdb_test "-break-insert marker" \
     "\\^done,bkpt=\{number=\"${decimal}\",type=\"breakpoint\".*\"\}" \
diff --git a/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp b/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
index f0be9a8b4f4..a4c7cf6f6b7 100644
--- a/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
+++ b/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
@@ -49,10 +49,7 @@ proc test_tfind_tfile { } {
 	global decimal
 	global tfile_basic
 
-	if [mi_gdb_start] {
-	    return
-	}
-	mi_gdb_load ${binfile}
+	mi_clean_restart $binfile
 
 	mi_gdb_test "-target-select tfile ${tfile_basic}" \
 	    ".*=breakpoint-created,bkpt=\{number=\"${decimal}\",type=\"tracepoint\",disp=\"keep\",enabled=\"y\",.*,func=\"write_basic_trace_file\".*\\^connected" \
@@ -124,11 +121,10 @@ gdb_exit
 proc test_tfind_remote { } {
     with_test_prefix "remote" {
 	global decimal
+	global binfile
 
-	if [mi_gdb_start] {
-	    return
-	}
-	mi_run_to_main
+	mi_clean_restart $binfile
+	mi_runto_main
 
 	mi_gdb_test "-break-insert end" "\\^done.*" "break end"
 	mi_gdb_test "-break-insert -a func2" "\\^done.*" "break func2"
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 693c7d2c467..0de3aa8703a 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1023,28 +1023,41 @@ proc mi_run_with_cli {args} {
     return [eval mi_run_cmd_full 0 $args]
 }
 
-#
-# Just like run-to-main but works with the MI interface
-#
-
-proc mi_run_to_main { } {
-    global suppress_flag
-    if { $suppress_flag } {
-	return -1
-    }
+# Starts fresh GDB binary and loads an optional executable into GDB.
+# Usage: mi_clean_restart [executable]
+# EXECUTABLE is the basename of the binary.
+# Return -1 if starting gdb or loading the executable failed.
 
+proc mi_clean_restart { args } {
     global srcdir
     global subdir
-    global binfile
-    global srcfile
+    global errcnt
+    global warncnt
+
+    if { [llength $args] > 1 } {
+	error "bad number of args: [llength $args]"
+    }
+
+    gdb_exit
+
+    # This is a clean restart, so reset error and warning count.
+    set errcnt 0
+    set warncnt 0
+
+    if {[mi_gdb_start]} {
+	return -1
+    }
 
-    mi_delete_breakpoints
     mi_gdb_reinitialize_dir $srcdir/$subdir
-    mi_gdb_load ${binfile}
 
-    mi_runto_main
-}
+    if { [llength $args] >= 1 } {
+	set executable [lindex $args 0]
+	set binfile [standard_output_file ${executable}]
+	return [mi_gdb_load ${binfile}]
+    }
 
+    return 0
+}
 
 # Just like gdb's "runto" proc, it will run the target to a given
 # function.  The big difference here between mi_runto and mi_execute_to
-- 
2.14.5


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/5] 'runto main' -> 'runto_main' throughout
  2020-10-12  0:47 ` [PATCH 1/5] 'runto main' -> 'runto_main' throughout Pedro Alves
@ 2020-10-13 17:57   ` Simon Marchi
  0 siblings, 0 replies; 14+ messages in thread
From: Simon Marchi @ 2020-10-13 17:57 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 2020-10-11 8:47 p.m., Pedro Alves wrote:
> This commit does 's/runto main/runto_main/g' throughout.

This LGTM.

Simon

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/5] Introduce mi_runto_main
  2020-10-12  0:47 ` [PATCH 2/5] Introduce mi_runto_main Pedro Alves
@ 2020-10-13 18:00   ` Simon Marchi
  0 siblings, 0 replies; 14+ messages in thread
From: Simon Marchi @ 2020-10-13 18:00 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 2020-10-11 8:47 p.m., Pedro Alves wrote:
> This adds an mi_runto_main routine, very much like the runto_main CLI
> counterpart.
> 
> Note there's already a mi_run_to_main (extra underscore in "run_to"),
> but unlike its intro comment says, that does more than the CLI's
> runto_main -- it also starts GDB.  I would like to eliminate that
> other one by introducing a mi_clean_restart function instead.  That is
> done later in the series.

This LGTM.

Simon


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/5] gdb/testsuite/: Use -qualified in runto_main / mi_runto_main
  2020-10-12  0:47 ` [PATCH 3/5] gdb/testsuite/: Use -qualified in runto_main / mi_runto_main Pedro Alves
@ 2020-10-13 18:06   ` Simon Marchi
  2020-10-13 21:33     ` Pedro Alves
  0 siblings, 1 reply; 14+ messages in thread
From: Simon Marchi @ 2020-10-13 18:06 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 2020-10-11 8:47 p.m., Pedro Alves wrote:
> diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
> index 732aed27b27..693c7d2c467 100644
> --- a/gdb/testsuite/lib/mi-support.exp
> +++ b/gdb/testsuite/lib/mi-support.exp
> @@ -1056,7 +1056,7 @@ proc mi_run_to_main { } {
>  #   -1  if test suppressed, failed, timedout
>  #    0  if test passed
>
> -proc mi_runto_helper {func run_or_continue} {
> +proc mi_runto_helper {func run_or_continue {qualified 0}} {

For new options, I'd suggest using the parse_args procedure, instead of
using arguments with default values.  That makes it nicer when a
procedure has multiple optional arguments and want to specifiy just one
(that isn't the first one).

So a call to mi_runto_helper would look like:

  mi_runto_helper main run -qualified

Otherwise, LGTM.

Simon

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] gdb/testsuite/: Use "-qualified" in explicit "break main", etc.
  2020-10-12  0:47 ` [PATCH 4/5] gdb/testsuite/: Use "-qualified" in explicit "break main", etc Pedro Alves
@ 2020-10-13 18:07   ` Simon Marchi
  0 siblings, 0 replies; 14+ messages in thread
From: Simon Marchi @ 2020-10-13 18:07 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RESEND][PATCH 5/5] Eliminate mi_run_to_main, introduce mi_clean_restart
  2020-10-12 18:56 ` [RESEND][PATCH 5/5] Eliminate mi_run_to_main, introduce mi_clean_restart Pedro Alves
@ 2020-10-13 18:19   ` Simon Marchi
  2020-10-13 21:36     ` Pedro Alves
  0 siblings, 1 reply; 14+ messages in thread
From: Simon Marchi @ 2020-10-13 18:19 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 2020-10-12 2:56 p.m., Pedro Alves wrote:
> diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
> index 693c7d2c467..0de3aa8703a 100644
> --- a/gdb/testsuite/lib/mi-support.exp
> +++ b/gdb/testsuite/lib/mi-support.exp
> @@ -1023,28 +1023,41 @@ proc mi_run_with_cli {args} {
>      return [eval mi_run_cmd_full 0 $args]
>  }
>
> -#
> -# Just like run-to-main but works with the MI interface
> -#
> -
> -proc mi_run_to_main { } {
> -    global suppress_flag
> -    if { $suppress_flag } {
> -	return -1
> -    }
> +# Starts fresh GDB binary and loads an optional executable into GDB.
> +# Usage: mi_clean_restart [executable]
> +# EXECUTABLE is the basename of the binary.
> +# Return -1 if starting gdb or loading the executable failed.
>
> +proc mi_clean_restart { args } {

Again, for a new optional argument I'd suggest using parse_args,
meaning calling mi_clean_restart with an explicit binfile would be:

  mi_clean_restart -binfile ${binfile}

But, this is not very important, the next person to add an argument to
mi_clean_restart can do it (if it ever happens).  The patch LGTM as it
is.

Simon

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/5] gdb/testsuite/: Use -qualified in runto_main / mi_runto_main
  2020-10-13 18:06   ` Simon Marchi
@ 2020-10-13 21:33     ` Pedro Alves
  0 siblings, 0 replies; 14+ messages in thread
From: Pedro Alves @ 2020-10-13 21:33 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 10/13/20 7:06 PM, Simon Marchi wrote:
> On 2020-10-11 8:47 p.m., Pedro Alves wrote:
>> diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
>> index 732aed27b27..693c7d2c467 100644
>> --- a/gdb/testsuite/lib/mi-support.exp
>> +++ b/gdb/testsuite/lib/mi-support.exp
>> @@ -1056,7 +1056,7 @@ proc mi_run_to_main { } {
>>  #   -1  if test suppressed, failed, timedout
>>  #    0  if test passed
>>
>> -proc mi_runto_helper {func run_or_continue} {
>> +proc mi_runto_helper {func run_or_continue {qualified 0}} {
> 
> For new options, I'd suggest using the parse_args procedure, instead of
> using arguments with default values.  That makes it nicer when a
> procedure has multiple optional arguments and want to specifiy just one
> (that isn't the first one).

I agree that using parse_args is nice.  I've used it recently
in the MI --qualified patch, and also in a local patch I have
that adds options to Dwarf::assemble.

Here this is an internal routine, just a helper, not
meant to be used as "public" api, so I didn't bother.

But it's not really much trouble.  I've done that change.

> 
> So a call to mi_runto_helper would look like:
> 
>   mi_runto_helper main run -qualified

Below's what I merged.

Yay, we now have:

  "qualified" in gdb_breakpoint/runto,
  "-qualified" in mi_runto_helper, and
  "--qualified" in the actual MI command...

:-)

From 8abd8ee8c878f52469896c716732a974e6abeebe Mon Sep 17 00:00:00 2001
From: Pedro Alves <pedro@palves.net>
Date: Wed, 2 Sep 2020 23:20:45 +0100
Subject: [PATCH] gdb/testsuite/: Use -qualified in runto_main / mi_runto_main

In some runtimes, there may be a "main" function in some class or
namespace.  The breakpoint created by runto_main may therefore have
unexpected locations on some other functions than the actual main.
These breakpoint locations can unexpectedly get hit during tests and
lead to failures.

I saw this while playing with AMD's ROCm toolchain -- I wrote a board
file to run the testsuite against device kernels.  There, the runtime
calls a "main" function before the device kernel code is reached:

 Thread 4 "bit_extract" hit Breakpoint 1, 0x00007ffeea140960 in lld::elf::LinkerDriver::main(llvm::ArrayRef<char const*>) () from /opt/rocm/lib/libamd_comgr.so.1
 (gdb) bt
 #0  0x00007ffeea140960 in lld::elf::LinkerDriver::main(llvm::ArrayRef<char const*>) () from /opt/rocm/lib/libamd_comgr.so.1
 #1  0x00007ffeea2257a5 in lld::elf::link(llvm::ArrayRef<char const*>, bool, llvm::raw_ostream&, llvm::raw_ostream&) () from /opt/rocm/lib/libamd_comgr.so.1
 #2  0x00007ffeea1bc374 in COMGR::linkWithLLD(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&) () from /opt/rocm/lib/libamd_comgr.so.1
 #3  0x00007ffeea1bfb09 in COMGR::InProcessDriver::execute(llvm::ArrayRef<char const*>) () from /opt/rocm/lib/libamd_comgr.so.1
 #4  0x00007ffeea1c4da9 in COMGR::AMDGPUCompiler::linkToExecutable() () from /opt/rocm/lib/libamd_comgr.so.1
 #5  0x00007ffeea1fde20 in dispatchCompilerAction(amd_comgr_action_kind_s, COMGR::DataAction*, COMGR::DataSet*, COMGR::DataSet*, llvm::raw_ostream&) () from /opt/rocm/lib/libamd_comgr.so.1
 #6  0x00007ffeea203a87 in amd_comgr_do_action () from /opt/rocm/lib/libamd_comgr.so.1
 ...

To avoid that, pass "qualified" to runto, in runto_main, so that
gdb_breakpoint ends up creating a breakpoint with -qualified.  This
avoids creating breakpoints locations for other unrelated "main"
functions.

Note: I first tried making runto itself use "-qualified", but that
caused regressions in the gdb.ada/ tests, which use runto without
specifying the whole fully-qualified function name (i.e., without the
package).  So I end up restricting the -qualified to
runto_main/mi_runto_main.

The gdb.base/ui-redirect.exp change is necessary because that testcase
is looking at what "save breakpoint" generates.

gdb/testsuite/ChangeLog:

	* gdb.base/ui-redirect.exp: Expect "break -qualified main" in
	saved breakpoints file.
	* gdb.guile/scm-breakpoint.exp: Expect "-qualified main" when
	inspecting breakpoint list.
	* lib/gdb.exp (runto_main): Add "qualified" to options.
	* lib/mi-support.exp (mi_runto_helper): Add 'qualified' parameter,
	and handle it.
	(mi_runto_main): Pass 1 as qualified argument.

Change-Id: I51468359ab0a518f05f7c0394c97f7e33b45fe69
---
 gdb/testsuite/ChangeLog                    | 11 +++++++++++
 gdb/testsuite/gdb.base/ui-redirect.exp     |  2 +-
 gdb/testsuite/gdb.guile/scm-breakpoint.exp |  2 +-
 gdb/testsuite/lib/gdb.exp                  |  2 +-
 gdb/testsuite/lib/mi-support.exp           | 16 +++++++++++++---
 5 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 19b4e2b138c..ea6241b77c8 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2020-10-13  Pedro Alves  <pedro@palves.net>
+
+	* gdb.base/ui-redirect.exp: Expect "break -qualified main" in
+	saved breakpoints file.
+	* gdb.guile/scm-breakpoint.exp: Expect "-qualified main" when
+	inspecting breakpoint list.
+	* lib/gdb.exp (runto_main): Add "qualified" to options.
+	* lib/mi-support.exp (mi_runto_helper): Add 'qualified' parameter,
+	and handle it.
+	(mi_runto_main): Pass 1 as qualified argument.
+
 2020-10-13  Pedro Alves  <pedro@palves.net>
 
 	* lib/mi-support.exp (mi_runto_main): New proc.
diff --git a/gdb/testsuite/gdb.base/ui-redirect.exp b/gdb/testsuite/gdb.base/ui-redirect.exp
index ef0a79178c7..9e0a694c798 100644
--- a/gdb/testsuite/gdb.base/ui-redirect.exp
+++ b/gdb/testsuite/gdb.base/ui-redirect.exp
@@ -47,7 +47,7 @@ gdb_breakpoint "foo"
 gdb_breakpoint "bar"
 
 set cmds [multi_line_input \
-	      "break main" \
+	      "break -qualified main" \
 	      "  commands" \
 	      "    print 1" \
 	      "  end" \
diff --git a/gdb/testsuite/gdb.guile/scm-breakpoint.exp b/gdb/testsuite/gdb.guile/scm-breakpoint.exp
index 7545392452e..3bcd5c81546 100644
--- a/gdb/testsuite/gdb.guile/scm-breakpoint.exp
+++ b/gdb/testsuite/gdb.guile/scm-breakpoint.exp
@@ -43,7 +43,7 @@ proc test_bkpt_basic { } {
 	gdb_scm_test_silent_cmd "guile (define blist (breakpoints))" \
 	    "get breakpoint list 1"
 	gdb_test "guile (print (car blist))" \
-	    "<gdb:breakpoint #1 BP_BREAKPOINT enabled noisy hit:1 ignore:0 @main>" \
+	    "<gdb:breakpoint #1 BP_BREAKPOINT enabled noisy hit:1 ignore:0 @-qualified main>" \
 	    "check main breakpoint"
 	gdb_test "guile (print (breakpoint-location (car blist)))" \
 	    "main" "check main breakpoint location"
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 608469953bf..4c9675f255f 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -689,7 +689,7 @@ proc runto { function args } {
 # If you don't want that, use gdb_start_cmd.
 
 proc runto_main { } {
-    return [runto main no-message]
+    return [runto main no-message qualified]
 }
 
 ### Continue, and expect to hit a breakpoint.
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 732aed27b27..ea59288443e 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1055,8 +1055,12 @@ proc mi_run_to_main { } {
 # It returns:
 #   -1  if test suppressed, failed, timedout
 #    0  if test passed
+#
+# Supported options:
+#
+#  -qualified -- pass --qualified to -break-insert
 
-proc mi_runto_helper {func run_or_continue} {
+proc mi_runto_helper {func run_or_continue args} {
   global suppress_flag
   if { $suppress_flag } {
     return -1
@@ -1065,10 +1069,16 @@ proc mi_runto_helper {func run_or_continue} {
   global mi_gdb_prompt expect_out
   global hex decimal fullname_syntax
 
+  parse_args {{qualified}}
+
   set test "mi runto $func"
   set bp [mi_make_breakpoint -type breakpoint -disp del \
 	      -func $func\(\\\(.*\\\)\)?]
-  mi_gdb_test "200-break-insert -t $func" "200\\^done,$bp" \
+  set extra_opts ""
+  if {$qualified} {
+      append extra_opts "--qualified"
+  }
+  mi_gdb_test "200-break-insert $extra_opts -t $func" "200\\^done,$bp" \
       "breakpoint at $func"
 
   if {$run_or_continue == "run"} {
@@ -1089,7 +1099,7 @@ proc mi_runto {func} {
 # Just like runto_main but works with the MI interface.
 
 proc mi_runto_main {} {
-    return [mi_runto_helper "main" "run"]
+    return [mi_runto_helper "main" "run" -qualified]
 }
 
 # Next to the next statement

base-commit: d3a071228e8f7cf9da017f2d0d6c28468a652795
-- 
2.14.5



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RESEND][PATCH 5/5] Eliminate mi_run_to_main, introduce mi_clean_restart
  2020-10-13 18:19   ` Simon Marchi
@ 2020-10-13 21:36     ` Pedro Alves
  2020-10-14  8:40       ` Tom de Vries
  0 siblings, 1 reply; 14+ messages in thread
From: Pedro Alves @ 2020-10-13 21:36 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 10/13/20 7:19 PM, Simon Marchi wrote:
> On 2020-10-12 2:56 p.m., Pedro Alves wrote:
>> diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
>> index 693c7d2c467..0de3aa8703a 100644
>> --- a/gdb/testsuite/lib/mi-support.exp
>> +++ b/gdb/testsuite/lib/mi-support.exp
>> @@ -1023,28 +1023,41 @@ proc mi_run_with_cli {args} {
>>      return [eval mi_run_cmd_full 0 $args]
>>  }
>>
>> -#
>> -# Just like run-to-main but works with the MI interface
>> -#
>> -
>> -proc mi_run_to_main { } {
>> -    global suppress_flag
>> -    if { $suppress_flag } {
>> -	return -1
>> -    }
>> +# Starts fresh GDB binary and loads an optional executable into GDB.
>> +# Usage: mi_clean_restart [executable]
>> +# EXECUTABLE is the basename of the binary.
>> +# Return -1 if starting gdb or loading the executable failed.
>>
>> +proc mi_clean_restart { args } {
> 
> Again, for a new optional argument I'd suggest using parse_args,
> meaning calling mi_clean_restart with an explicit binfile would be:
> 
>   mi_clean_restart -binfile ${binfile}
> 
> But, this is not very important, the next person to add an argument to
> mi_clean_restart can do it (if it ever happens).  The patch LGTM as it
> is.

Yeah, I left this one as is to have it mirror the CLI's clean_restart.

Thanks for the quick reviews.  I've merged the series now.

Pedro Alves

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RESEND][PATCH 5/5] Eliminate mi_run_to_main, introduce mi_clean_restart
  2020-10-13 21:36     ` Pedro Alves
@ 2020-10-14  8:40       ` Tom de Vries
  0 siblings, 0 replies; 14+ messages in thread
From: Tom de Vries @ 2020-10-14  8:40 UTC (permalink / raw)
  To: Pedro Alves, Simon Marchi, gdb-patches

On 10/13/20 11:36 PM, Pedro Alves wrote:
> On 10/13/20 7:19 PM, Simon Marchi wrote:
>> On 2020-10-12 2:56 p.m., Pedro Alves wrote:
>>> diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
>>> index 693c7d2c467..0de3aa8703a 100644
>>> --- a/gdb/testsuite/lib/mi-support.exp
>>> +++ b/gdb/testsuite/lib/mi-support.exp
>>> @@ -1023,28 +1023,41 @@ proc mi_run_with_cli {args} {
>>>      return [eval mi_run_cmd_full 0 $args]
>>>  }
>>>
>>> -#
>>> -# Just like run-to-main but works with the MI interface
>>> -#
>>> -
>>> -proc mi_run_to_main { } {
>>> -    global suppress_flag
>>> -    if { $suppress_flag } {
>>> -	return -1
>>> -    }
>>> +# Starts fresh GDB binary and loads an optional executable into GDB.
>>> +# Usage: mi_clean_restart [executable]
>>> +# EXECUTABLE is the basename of the binary.
>>> +# Return -1 if starting gdb or loading the executable failed.
>>>
>>> +proc mi_clean_restart { args } {
>>
>> Again, for a new optional argument I'd suggest using parse_args,
>> meaning calling mi_clean_restart with an explicit binfile would be:
>>
>>   mi_clean_restart -binfile ${binfile}
>>
>> But, this is not very important, the next person to add an argument to
>> mi_clean_restart can do it (if it ever happens).  The patch LGTM as it
>> is.
> 
> Yeah, I left this one as is to have it mirror the CLI's clean_restart.
> 
> Thanks for the quick reviews.  I've merged the series now.

Caused this and similar regressions:
...
FAIL: gdb.ada/mi_catch_ex.exp: continue to exception catchpoint hit
(unknown output after running)
...

Filed as https://sourceware.org/bugzilla/show_bug.cgi?id=26732

Thanks,
- Tom

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-10-14  8:41 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-12  0:47 [PATCH 0/5] runto_main and -qualified Pedro Alves
2020-10-12  0:47 ` [PATCH 1/5] 'runto main' -> 'runto_main' throughout Pedro Alves
2020-10-13 17:57   ` Simon Marchi
2020-10-12  0:47 ` [PATCH 2/5] Introduce mi_runto_main Pedro Alves
2020-10-13 18:00   ` Simon Marchi
2020-10-12  0:47 ` [PATCH 3/5] gdb/testsuite/: Use -qualified in runto_main / mi_runto_main Pedro Alves
2020-10-13 18:06   ` Simon Marchi
2020-10-13 21:33     ` Pedro Alves
2020-10-12  0:47 ` [PATCH 4/5] gdb/testsuite/: Use "-qualified" in explicit "break main", etc Pedro Alves
2020-10-13 18:07   ` Simon Marchi
2020-10-12 18:56 ` [RESEND][PATCH 5/5] Eliminate mi_run_to_main, introduce mi_clean_restart Pedro Alves
2020-10-13 18:19   ` Simon Marchi
2020-10-13 21:36     ` Pedro Alves
2020-10-14  8:40       ` Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).