Compare commits

...

5 Commits

Author SHA1 Message Date
Pedro Alves
bdfbda93f2 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
2020-10-12 01:45:51 +01:00
Pedro Alves
df47e3e9fe gdb/testsuite/: Use "-qualified" in explicit "break main", etc.
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
2020-10-12 01:45:51 +01:00
Pedro Alves
fc9cf3cb3c 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:🧝:LinkerDriver::main(llvm::ArrayRef<char const*>) () from /opt/rocm/lib/libamd_comgr.so.1
 (gdb) bt
 #0  0x00007ffeea140960 in lld:🧝:LinkerDriver::main(llvm::ArrayRef<char const*>) () from /opt/rocm/lib/libamd_comgr.so.1
 #1  0x00007ffeea2257a5 in lld:🧝: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
2020-10-12 01:45:51 +01:00
Pedro Alves
026fd25d4e Introduce mi_runto_main
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
2020-10-12 01:45:51 +01:00
Pedro Alves
c80c1bb3e4 'runto main' -> 'runto_main' throughout
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
2020-10-12 01:35:06 +01:00
170 changed files with 362 additions and 568 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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_clean_restart $binfile
mi_delete_breakpoints
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
if ![mi_run_to_main] then {
if {[mi_runto_main] < 0} {
fail "cannot run to main, testcase aborted"
return 0
}

View File

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

View File

@@ -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_clean_restart $binfile
mi_delete_breakpoints
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${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
}

View File

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

View File

@@ -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_clean_restart $binfile
mi_delete_breakpoints
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
if ![mi_run_to_main] then {
if {[mi_runto_main] < 0} {
fail "cannot run to main, testcase aborted"
return 0
}

View File

@@ -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_clean_restart $binfile
mi_delete_breakpoints
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
if ![mi_run_to_main] then {
if {[mi_runto_main] < 0} {
fail "cannot run to main, testcase aborted"
return 0
}

View File

@@ -28,15 +28,9 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable debug] != "" } {
return -1
}
if {[mi_gdb_start]} {
continue
}
mi_clean_restart $binfile
mi_delete_breakpoints
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
if ![mi_run_to_main] then {
if {[mi_runto_main] < 0} {
fail "cannot run to main, testcase aborted"
return 0
}

View File

@@ -32,16 +32,9 @@ foreach_with_prefix scenario {none all minimal} {
return -1
}
gdb_exit
if [mi_gdb_start] {
continue
}
mi_clean_restart $binfile
mi_delete_breakpoints
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
if ![mi_run_to_main] then {
if {[mi_runto_main] < 0} {
fail "cannot run to main, testcase aborted"
return 0
}

View File

@@ -34,16 +34,9 @@ foreach_with_prefix scenario {none all minimal} {
return -1
}
gdb_exit
if [mi_gdb_start] {
continue
}
mi_clean_restart $binfile
mi_delete_breakpoints
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
if ![mi_run_to_main] then {
if {[mi_runto_main] < 0} {
fail "cannot run to main, testcase aborted"
return 0
}

View File

@@ -33,16 +33,9 @@ foreach_with_prefix scenario {none all minimal} {
return -1
}
gdb_exit
if [mi_gdb_start] {
continue
}
mi_clean_restart $binfile
mi_delete_breakpoints
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
if ![mi_run_to_main] then {
if {[mi_runto_main] < 0} {
fail "cannot run to main, testcase aborted"
return 0
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -28,7 +28,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
return -1
}
if ![runto main] {
if ![runto_main] {
return -1
}

View File

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

View File

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

View File

@@ -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 |)\{.*

View File

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

View File

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

View File

@@ -26,7 +26,7 @@ save_vars { GDBFLAGS } {
clean_restart ${executable}
}
if ![runto main] {
if ![runto_main] {
fail "can't run to main"
return -1
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -42,7 +42,7 @@ if { [do_compile {-mcpu=native}] != ""
clean_restart ${binfile}
if { ![runto main] } {
if { ![runto_main] } {
fail "runto main"
return -1
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -47,7 +47,7 @@ gdb_breakpoint "foo"
gdb_breakpoint "bar"
set cmds [multi_line_input \
"break main" \
"break -qualified main" \
" commands" \
" print 1" \
" end" \

View File

@@ -33,7 +33,7 @@ proc test_watchpoint { hw } {
clean_restart ${testfile}
if { ![runto main] } then {
if { ![runto_main] } then {
fail "run to main"
return
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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 {.*"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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]]
@@ -59,7 +54,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" \

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More