diff options
23 files changed, 475 insertions, 306 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 4de54c7..eb0c799 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,28 @@ +2020-05-27 Luis Machado <luis.machado@linaro.org> + + * gdb.arch/aarch64-sighandler-regs.exp: Fix duplicated test names. + * gdb.arch/aarch64-tagged-pointer.exp: Likewise. + * gdb.arch/arm-disassembler-options.exp: Likewise. + * gdb.arch/arm-disp-step.exp: Likewise. + * gdb.arch/thumb-prologue.exp: Likewise. + * gdb.base/async.exp: Likewise. + * gdb.base/auxv.exp: Likewise. + * gdb.base/complex-parts.exp: Likewise. + * gdb.base/ena-dis-br.exp: Likewise. + * gdb.base/foll-exec.exp: Likewise. + * gdb.base/permissions.exp: Likewise. + * gdb.base/relocate.exp: Likewise. + * gdb.base/return2.exp: Likewise. + * gdb.base/sigbpt.exp: Likewise. + * gdb.base/siginfo-obj.exp: Likewise. + * gdb.cp/converts.exp: Likewise. + * gdb.cp/exceptprint.exp: Likewise. + * gdb.cp/inherit.exp: Likewise. + * gdb.cp/nsnoimports.exp: Likewise. + * gdb.cp/virtbase2.exp: Likewise. + * gdb.mi/mi-var-cmd.exp: Likewise. + * gdb.mi/var-cmd.c: Likewise. + 2020-05-26 Tom Tromey <tromey@adacore.com> * gdb.ada/arr_acc_idx_w_gap.exp: Add tests. diff --git a/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp b/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp index 9faab78..1dedd33 100644 --- a/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp +++ b/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp @@ -100,16 +100,18 @@ set mainframe [expr $handlerframe + 2] # Check register values -check_regs x $xreg_nums $reg_handler_value_64 "" -check_regs v $vreg_nums $reg_handler_value_128 ".q.u" -check_regs q $vreg_nums $reg_handler_value_128 ".u" -check_regs d $vreg_nums $reg_handler_value_64 ".u" -check_regs s $vreg_nums $reg_handler_value_32 ".u" -check_regs h $vreg_nums $reg_handler_value_16 ".u" -check_regs b $vreg_nums $reg_handler_value_8 ".u" -if { $sve_hw } { - check_regs z $vreg_nums $zreg_handler_value ".d.u" - check_regs p $preg_nums $preg_handler_value "" +with_test_prefix "handler frame 1st" { + check_regs x $xreg_nums $reg_handler_value_64 "" + check_regs v $vreg_nums $reg_handler_value_128 ".q.u" + check_regs q $vreg_nums $reg_handler_value_128 ".u" + check_regs d $vreg_nums $reg_handler_value_64 ".u" + check_regs s $vreg_nums $reg_handler_value_32 ".u" + check_regs h $vreg_nums $reg_handler_value_16 ".u" + check_regs b $vreg_nums $reg_handler_value_8 ".u" + if { $sve_hw } { + check_regs z $vreg_nums $zreg_handler_value ".d.u" + check_regs p $preg_nums $preg_handler_value "" + } } # Switch to the frame for main(), and check register values @@ -118,16 +120,19 @@ gdb_test "frame $mainframe" \ "#$mainframe.*in main ().*" \ "set to main frame" -check_regs x $xreg_nums $reg_main_value_64 "" -check_regs v $vreg_nums $reg_main_value_128 ".q.u" -check_regs q $vreg_nums $reg_main_value_128 ".u" -check_regs d $vreg_nums $reg_main_value_64 ".u" -check_regs s $vreg_nums $reg_main_value_32 ".u" -check_regs h $vreg_nums $reg_main_value_16 ".u" -check_regs b $vreg_nums $reg_main_value_8 ".u" -if { $sve_hw } { - check_regs z $vreg_nums $zreg_main_value ".d.u" - check_regs p $preg_nums $preg_main_value "" + +with_test_prefix "main frame" { + check_regs x $xreg_nums $reg_main_value_64 "" + check_regs v $vreg_nums $reg_main_value_128 ".q.u" + check_regs q $vreg_nums $reg_main_value_128 ".u" + check_regs d $vreg_nums $reg_main_value_64 ".u" + check_regs s $vreg_nums $reg_main_value_32 ".u" + check_regs h $vreg_nums $reg_main_value_16 ".u" + check_regs b $vreg_nums $reg_main_value_8 ".u" + if { $sve_hw } { + check_regs z $vreg_nums $zreg_main_value ".d.u" + check_regs p $preg_nums $preg_main_value "" + } } # Switch back to the signal handler frame, and check register values @@ -136,14 +141,16 @@ gdb_test "frame $handlerframe" \ "#$handlerframe.*handler \\\(sig=4\\\).*" \ "set to signal handler frame" -check_regs x $xreg_nums $reg_handler_value_64 "" -check_regs v $vreg_nums $reg_handler_value_128 ".q.u" -check_regs q $vreg_nums $reg_handler_value_128 ".u" -check_regs d $vreg_nums $reg_handler_value_64 ".u" -check_regs s $vreg_nums $reg_handler_value_32 ".u" -check_regs h $vreg_nums $reg_handler_value_16 ".u" -check_regs b $vreg_nums $reg_handler_value_8 ".u" -if { $sve_hw } { - check_regs z $vreg_nums $zreg_handler_value ".d.u" - check_regs p $preg_nums $preg_handler_value "" +with_test_prefix "handler frame 2nd" { + check_regs x $xreg_nums $reg_handler_value_64 "" + check_regs v $vreg_nums $reg_handler_value_128 ".q.u" + check_regs q $vreg_nums $reg_handler_value_128 ".u" + check_regs d $vreg_nums $reg_handler_value_64 ".u" + check_regs s $vreg_nums $reg_handler_value_32 ".u" + check_regs h $vreg_nums $reg_handler_value_16 ".u" + check_regs b $vreg_nums $reg_handler_value_8 ".u" + if { $sve_hw } { + check_regs z $vreg_nums $zreg_handler_value ".d.u" + check_regs p $preg_nums $preg_handler_value "" +} } diff --git a/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp b/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp index be19d8c..957571f 100644 --- a/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp +++ b/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp @@ -35,17 +35,17 @@ gdb_continue_to_breakpoint "breakpoint here" # Test that GDB manages caches correctly for tagged address. # Read from P2, -gdb_test "x p2" "$hex:\[\t \]+0x000004d2" +gdb_test "x p2" "$hex:\[\t \]+0x000004d2" "x p2" gdb_test_no_output "set variable i = 5678" # Test that *P2 is updated. -gdb_test "x p2" "$hex:\[\t \]+0x0000162e" +gdb_test "x p2" "$hex:\[\t \]+0x0000162e" "x p2, updated" # Read from SP1->i, -gdb_test "print sp1->i" " = 1234" +gdb_test "print sp1->i" " = 1234" "print SP1->i" # Write to SP2->i, gdb_test_no_output "set variable sp2->i = 5678" # Test that SP1->i is updated. -gdb_test "print sp1->i" " = 5678" +gdb_test "print sp1->i" " = 5678" "print SP1->i, updated" gdb_test "x/d &sp2->i" "$hex:\[\t \]+5678" gdb_test "x/d &sp1->i" "$hex:\[\t \]+5678" diff --git a/gdb/testsuite/gdb.arch/arm-disassembler-options.exp b/gdb/testsuite/gdb.arch/arm-disassembler-options.exp index 82ead79..b347cc5 100644 --- a/gdb/testsuite/gdb.arch/arm-disassembler-options.exp +++ b/gdb/testsuite/gdb.arch/arm-disassembler-options.exp @@ -52,5 +52,5 @@ gdb_test "set architecture $arch2" \ gdb_test "show disassembler-options" \ "The current disassembler options are '$option'.*" \ - "show disassembler-options $option" + "show disassembler-options $option, modified architecture" diff --git a/gdb/testsuite/gdb.arch/arm-disp-step.exp b/gdb/testsuite/gdb.arch/arm-disp-step.exp index 034b836..29189d0 100644 --- a/gdb/testsuite/gdb.arch/arm-disp-step.exp +++ b/gdb/testsuite/gdb.arch/arm-disp-step.exp @@ -37,12 +37,12 @@ proc test_ldm_stm_pc {} { # Try to set breakpoint on test_ldm_stm_pc. If symbol 'test_ldm_stm_pc' # can't be resolved, test case is compiled in Thumb mode, skip it. - gdb_test_multiple "break *test_ldm_stm_pc" "break test_ldm_stm_pc" { + gdb_test_multiple "break *test_ldm_stm_pc" "" { -re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" { - pass "break test_ldm_stm_pc" + pass $gdb_test_name } -re "No symbol.*\r\n$gdb_prompt $" { - pass "break test_ldm_stm_pc" + pass $gdb_test_name return 0 } } @@ -68,9 +68,9 @@ proc test_ldr_literal {} { global srcfile global gdb_prompt - gdb_test_multiple "break *test_ldr_literal" "break test_ldr_literal" { + gdb_test_multiple "break *test_ldr_literal" "" { -re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" { - pass "break test_ldr_literal" + pass $gdb_test_name } -re "No symbol.*\r\n$gdb_prompt $" { return 0 @@ -101,9 +101,9 @@ proc test_ldr_literal_16 {} { global srcfile global gdb_prompt - gdb_test_multiple "break *test_ldr_literal_16" "break test_ldr_literal_16" { + gdb_test_multiple "break *test_ldr_literal_16" "" { -re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" { - pass "break test_ldr_literal" + pass $gdb_test_name } -re "No symbol.*\r\n$gdb_prompt $" { return 0 @@ -191,9 +191,9 @@ proc test_cbz_cbnz {} { global srcfile global gdb_prompt - gdb_test_multiple "break *test_zero_cbnz" "break test_zero_cbnz" { + gdb_test_multiple "break *test_zero_cbnz" "" { -re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" { - pass "break test_ldr_literal" + pass $gdb_test_name } -re "No symbol.*\r\n$gdb_prompt $" { return 0 @@ -226,9 +226,9 @@ proc test_adr {} { global srcfile global gdb_prompt - gdb_test_multiple "break *test_adr" "break test_adr" { + gdb_test_multiple "break *test_adr" "" { -re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" { - pass "break test_adr" + pass $gdb_test_name } -re "No symbol.*\r\n$gdb_prompt $" { return 0 @@ -249,9 +249,9 @@ proc test_adr_32bit {} { global srcfile global gdb_prompt - gdb_test_multiple "break *test_adr_32bit" "break test_adr_32bit" { + gdb_test_multiple "break *test_adr_32bit" "" { -re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" { - pass "break test_adr" + pass $gdb_test_name } -re "No symbol.*\r\n$gdb_prompt $" { return 0 @@ -309,7 +309,7 @@ proc test_pop_pc {} { "break test_pop_pc_3_right" gdb_test "break *test_pop_pc_3_wrong" \ "Breakpoint.*at.* file .*$srcfile, line.*" \ - "break test_pop_pc_1_wrong" + "break test_pop_pc_3_wrong" gdb_continue_to_breakpoint "continue to test_pop_pc_1" \ ".*b.*\{r1\, pc\}.*" @@ -334,12 +334,12 @@ proc test_str_pc {} { global srcfile global gdb_prompt - gdb_test_multiple "break *test_str_pc" "break test_str_pc" { + gdb_test_multiple "break *test_str_pc" "" { -re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" { - pass "break test_str_pc" + pass $gdb_test_name } -re "No symbol.*\r\n$gdb_prompt $" { - pass "break test_str_pc" + pass $gdb_test_name return } } @@ -371,10 +371,9 @@ proc test_str_pc {} { proc test_add_rn_pc {} { global srcfile gdb_prompt - set test "break test_add_rn_pc" - gdb_test_multiple "break *test_add_rn_pc" $test { + gdb_test_multiple "break *test_add_rn_pc" "" { -re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" { - pass $test + pass $gdb_test_name } -re "No symbol.*\r\n$gdb_prompt $" { return diff --git a/gdb/testsuite/gdb.arch/thumb-prologue.exp b/gdb/testsuite/gdb.arch/thumb-prologue.exp index b463fd7..0c6de8a 100644 --- a/gdb/testsuite/gdb.arch/thumb-prologue.exp +++ b/gdb/testsuite/gdb.arch/thumb-prologue.exp @@ -83,4 +83,4 @@ gdb_test "stepi 2" "in write_sp \\(\\)" "stepi over mov sp, 128" gdb_test "backtrace 10" \ "#0\[ \t\]*$hex in write_sp .*\r\n#1\[ \t\]*$hex in switch_stack_to_other .*\r\n#2\[ \t\]*$hex in main.*" \ - "backtrace in write_sp" + "backtrace in write_sp, 2nd stop" diff --git a/gdb/testsuite/gdb.base/async.exp b/gdb/testsuite/gdb.base/async.exp index 1a4d3fb..32711d0 100644 --- a/gdb/testsuite/gdb.base/async.exp +++ b/gdb/testsuite/gdb.base/async.exp @@ -87,7 +87,7 @@ set test "get next insn" gdb_test_multiple {x/2i $pc} "$test" { -re "=> $hex .* 0x(\[0-9a-f\]*) .*$gdb_prompt $" { set next_insn_addr $expect_out(1,string) - pass "$test" + pass $gdb_test_name } } set next_insn_is_stmt [hex_in_list $next_insn_addr $is_stmt] @@ -102,11 +102,11 @@ test_background "stepi&" "" ".*$prefix x = 5; .*" # Get the next instruction address. set next_insn_addr "" -set test "get next insn" +set test "get next insn, 2nd" gdb_test_multiple {x/2i $pc} "$test" { -re "=> $hex .* 0x(\[0-9a-f\]*) .*$gdb_prompt $" { set next_insn_addr $expect_out(1,string) - pass "$test" + pass $gdb_test_name } } set next_insn_is_stmt \ diff --git a/gdb/testsuite/gdb.base/auxv.exp b/gdb/testsuite/gdb.base/auxv.exp index 9834a35..07c07c4 100644 --- a/gdb/testsuite/gdb.base/auxv.exp +++ b/gdb/testsuite/gdb.base/auxv.exp @@ -126,8 +126,8 @@ set live_data [fetch_auxv "info auxv on live process"] set gcore_works [gdb_gcore_cmd "$gcorefile" "gcore"] # Let the program continue and die. -gdb_test continue ".*Program received signal.*" -gdb_test continue ".*Program terminated with signal.*" +gdb_test continue ".*Program received signal.*" "continue until signal" +gdb_test continue ".*Program terminated with signal.*" "continue and terminate" # Now collect the core dump it left. set test "generate native core dump" diff --git a/gdb/testsuite/gdb.base/complex-parts.exp b/gdb/testsuite/gdb.base/complex-parts.exp index 38aad39..7719ff1 100644 --- a/gdb/testsuite/gdb.base/complex-parts.exp +++ b/gdb/testsuite/gdb.base/complex-parts.exp @@ -35,23 +35,35 @@ gdb_test "ptype z1" " = complex double" gdb_test "ptype z2" " = complex float" gdb_test "ptype z3" " = complex long double" -gdb_test "p \$_cimag (z1)" " = 4.5" -gdb_test "ptype \$" " = double" +with_test_prefix "double imaginary" { + gdb_test "p \$_cimag (z1)" " = 4.5" + gdb_test "ptype \$" " = double" +} -gdb_test "p \$_cimag (z2)" " = -5.5" -gdb_test "ptype \$" " = float" +with_test_prefix "float imaginary" { + gdb_test "p \$_cimag (z2)" " = -5.5" + gdb_test "ptype \$" " = float" +} -gdb_test "p \$_cimag (z3)" " = 6.5" -gdb_test "ptype \$" " = long double" +with_test_prefix "long double imaginary" { + gdb_test "p \$_cimag (z3)" " = 6.5" + gdb_test "ptype \$" " = long double" +} -gdb_test "p \$_creal (z1)" " = 1.5" -gdb_test "ptype \$" " = double" +with_test_prefix "double real" { + gdb_test "p \$_creal (z1)" " = 1.5" + gdb_test "ptype \$" " = double" +} -gdb_test "p \$_creal (z2)" " = 2.5" -gdb_test "ptype \$" " = float" +with_test_prefix "float real" { + gdb_test "p \$_creal (z2)" " = 2.5" + gdb_test "ptype \$" " = float" +} -gdb_test "p \$_creal (z3)" " = 3.5" -gdb_test "ptype \$" " = long double" +with_test_prefix "long double real" { + gdb_test "p \$_creal (z3)" " = 3.5" + gdb_test "ptype \$" " = long double" +} gdb_test "p \$_cimag (d1)" "expected a complex number" gdb_test "p \$_cimag (f1)" "expected a complex number" diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp index c338a0d..d43e47e 100644 --- a/gdb/testsuite/gdb.base/ena-dis-br.exp +++ b/gdb/testsuite/gdb.base/ena-dis-br.exp @@ -48,7 +48,7 @@ proc break_at { breakpoint where } { gdb_test_multiple "$test" "$test" { -re "Breakpoint (\[0-9\]*) at .*$where.*$gdb_prompt $" { set bp $expect_out(1,string) - pass "$test" + pass $gdb_test_name } } return $bp @@ -104,7 +104,12 @@ gdb_test "info break $bp" \ # Verify that we don't stop at a disabled breakpoint. gdb_continue_to_end "no stop" -rerun_to_main + +set count 1 +with_test_prefix "run $count" { + rerun_to_main + incr count +} gdb_continue_to_end "no stop at auto-disabled break marker2" # Verify that we can set a breakpoint to be self-deleting after the @@ -149,7 +154,9 @@ if ![runto_main] then { set bp [break_at $bp_location7 "line $bp_location7"] -set bp2 [break_at marker1 " line $bp_location15"] +with_test_prefix "enable count" { + set bp2 [break_at marker1 " line $bp_location15"] +} gdb_test "enable count" \ "Argument required \\(hit count\\)\\." \ @@ -181,7 +188,9 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } -set bp [break_at "marker1" " line $bp_location15.*"] +with_test_prefix "ignore count" { + set bp [break_at "marker1" " line $bp_location15.*"] +} # Verify that an ignore of a non-existent breakpoint is gracefully # handled. @@ -216,7 +225,11 @@ gdb_test "info break $bp" \ "info ignored break marker1" gdb_continue_to_end "no stop at ignored break marker1" -rerun_to_main + +with_test_prefix "run $count" { + rerun_to_main + incr count +} # See the comments in condbreak.exp for "run until breakpoint at marker1" # for an explanation of the xfail below. @@ -236,7 +249,9 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } -set bp [break_at marker1 " line $bp_location15.*"] +with_test_prefix "ignore count and auto-delete" { + set bp [break_at marker1 " line $bp_location15.*"] +} gdb_test "ignore $bp 1" \ "Will ignore next crossing of breakpoint \[0-9\]*.*" \ @@ -249,7 +264,11 @@ gdb_test "info break $bp" \ "info break marker1 after hitting breakpoint" gdb_continue_to_end "no stop at ignored & auto-deleted break marker1" -rerun_to_main + +with_test_prefix "run $count" { + rerun_to_main + incr count +} gdb_test "continue" \ ".*marker1 .*:$bp_location15.*" \ @@ -262,7 +281,9 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } -set bp [break_at marker1 " line $bp_location15"] +with_test_prefix "disabled breakpoint ignore count" { + set bp [break_at marker1 " line $bp_location15"] +} gdb_test "ignore $bp 10" \ "Will ignore next 10 crossings of breakpoint \[0-9\]*.*" \ @@ -271,7 +292,10 @@ gdb_test "ignore $bp 10" \ gdb_test_no_output "disable $bp" "disable break marker1" gdb_continue_to_end "no stop at ignored & disabled break marker1" -rerun_to_main + +with_test_prefix "run $count" { + rerun_to_main +} gdb_test "info break $bp" \ "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+n.*ignore next 10 hits.*" \ @@ -315,9 +339,18 @@ set b2 0 set b3 0 set b4 0 set b1 [break_at main ""] -set b2 [break_at main ""] -set b3 [break_at main ""] -set b4 [break_at main ""] + +with_test_prefix "2nd breakpoint" { + set b2 [break_at main ""] +} + +with_test_prefix "3rd breakpoint" { + set b3 [break_at main ""] +} + +with_test_prefix "4th breakpoint" { + set b4 [break_at main ""] +} # Perform tests for disable/enable commands on multiple # locations and breakpoints. diff --git a/gdb/testsuite/gdb.base/foll-exec.exp b/gdb/testsuite/gdb.base/foll-exec.exp index 825c7e2..b0e155d 100644 --- a/gdb/testsuite/gdb.base/foll-exec.exp +++ b/gdb/testsuite/gdb.base/foll-exec.exp @@ -78,10 +78,13 @@ proc do_exec_tests {} { fail "couldn't run ${testfile}" return } - # Execute the code setting up variable PROG. - set tbreak_line [gdb_get_line_number " tbreak-execlp " $srcfile] - gdb_test "tbreak ${tbreak_line}" - gdb_continue_to_breakpoint "line tbreak-execlp" ".*execlp \\(.*" + + with_test_prefix "1st run" { + # Execute the code setting up variable PROG. + set tbreak_line [gdb_get_line_number " tbreak-execlp " $srcfile] + gdb_test "tbreak ${tbreak_line}" "" "insert breakpoint" + gdb_continue_to_breakpoint "line tbreak-execlp" ".*execlp \\(.*" + } # Verify that we can see various global and local variables # in this program, and that they have expected values. Some @@ -234,10 +237,13 @@ proc do_exec_tests {} { fail "couldn't run ${testfile} (3rd try)" return } - # Execute the code setting up variable PROG. - set tbreak_line [gdb_get_line_number " tbreak-execlp " $srcfile] - gdb_test "tbreak ${tbreak_line}" - gdb_continue_to_breakpoint "line tbreak-execlp" ".*execlp \\(.*" + + with_test_prefix "2nd run" { + # Execute the code setting up variable PROG. + set tbreak_line [gdb_get_line_number " tbreak-execlp " $srcfile] + gdb_test "tbreak ${tbreak_line}" "" "insert breakpoint" + gdb_continue_to_breakpoint "line tbreak-execlp" ".*execlp \\(.*" + } # Verify that we can follow through follow an execl() # call. (We must jump around earlier exec* calls.) @@ -299,10 +305,13 @@ proc do_exec_tests {} { fail "couldn't run ${testfile} (4th try)" return } - # Execute the code setting up variable PROG. - set tbreak_line [gdb_get_line_number " tbreak-execlp " $srcfile] - gdb_test "tbreak ${tbreak_line}" - gdb_continue_to_breakpoint "line tbreak-execlp" ".*execlp \\(.*" + + with_test_prefix "3rd run" { + # Execute the code setting up variable PROG. + set tbreak_line [gdb_get_line_number " tbreak-execlp " $srcfile] + gdb_test "tbreak ${tbreak_line}" "" "insert breakpoint" + gdb_continue_to_breakpoint "line tbreak-execlp" ".*execlp \\(.*" + } # Verify that we can follow through follow an execv() # call. (We must jump around earlier exec* calls.) diff --git a/gdb/testsuite/gdb.base/permissions.exp b/gdb/testsuite/gdb.base/permissions.exp index 4a41f74..6cc6f70 100644 --- a/gdb/testsuite/gdb.base/permissions.exp +++ b/gdb/testsuite/gdb.base/permissions.exp @@ -34,43 +34,48 @@ gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir -gdb_test "show may-write-registers" \ - "Permission to write into registers is on." +with_test_prefix "observer mode off" { -gdb_test "show may-write-memory" \ - "Permission to write into target memory is on." + gdb_test "show may-write-registers" \ + "Permission to write into registers is on." -gdb_test "show may-insert-breakpoints" \ - "Permission to insert breakpoints in the target is on." + gdb_test "show may-write-memory" \ + "Permission to write into target memory is on." -gdb_test "show may-insert-tracepoints" \ - "Permission to insert tracepoints in the target is on." + gdb_test "show may-insert-breakpoints" \ + "Permission to insert breakpoints in the target is on." -gdb_test "show may-insert-fast-tracepoints" \ - "Permission to insert fast tracepoints in the target is on." + gdb_test "show may-insert-tracepoints" \ + "Permission to insert tracepoints in the target is on." -gdb_test "show may-interrupt" \ - "Permission to interrupt or signal the target is on." + gdb_test "show may-insert-fast-tracepoints" \ + "Permission to insert fast tracepoints in the target is on." + + gdb_test "show may-interrupt" \ + "Permission to interrupt or signal the target is on." +} gdb_test "set observer on" "Observer mode is now on." "enable observer mode" -gdb_test "show may-write-memory" \ - "Permission to write into target memory is off." +with_test_prefix "observer mode on" { + gdb_test "show may-write-memory" \ + "Permission to write into target memory is off." -gdb_test "show may-write-registers" \ - "Permission to write into registers is off." + gdb_test "show may-write-registers" \ + "Permission to write into registers is off." -gdb_test "show may-insert-breakpoints" \ - "Permission to insert breakpoints in the target is off." + gdb_test "show may-insert-breakpoints" \ + "Permission to insert breakpoints in the target is off." -gdb_test "show may-insert-tracepoints" \ - "Permission to insert tracepoints in the target is off." + gdb_test "show may-insert-tracepoints" \ + "Permission to insert tracepoints in the target is off." -gdb_test "show may-insert-fast-tracepoints" \ - "Permission to insert fast tracepoints in the target is on." + gdb_test "show may-insert-fast-tracepoints" \ + "Permission to insert fast tracepoints in the target is on." -gdb_test "show may-interrupt" \ - "Permission to interrupt or signal the target is off." + gdb_test "show may-interrupt" \ + "Permission to interrupt or signal the target is off." +} gdb_test "set observer off" "Observer mode is now off." "disable observer mode" @@ -87,14 +92,14 @@ if ![runto_main] then { gdb_test "print x = 45" "$decimal = 45" "set a global" -gdb_test "print x" "$decimal = 45" +gdb_test "print x" "$decimal = 45" "validate setting a global" gdb_test "set may-write-memory off" gdb_test "print x = 92" "Writing to memory is not allowed.*" \ - "try to set a global" + "set a global, 2nd time" -gdb_test "print x" "$decimal = 45" +gdb_test "print x" "$decimal = 45" "validate setting a global, 2nd time" # FIXME Add tests for other flags when a testsuite-able target becomes # available. diff --git a/gdb/testsuite/gdb.base/relocate.exp b/gdb/testsuite/gdb.base/relocate.exp index 68b0ede..906d16b 100644 --- a/gdb/testsuite/gdb.base/relocate.exp +++ b/gdb/testsuite/gdb.base/relocate.exp @@ -152,9 +152,11 @@ gdb_test "add-symbol-file ${binfile} 0" \ "add symbol table from file \".*${testfile}\\.o\" at\[ \t\r\n\]+\.text_addr = 0x0\[\r\n\]+\\(y or n\\) " \ "y" -# Print the addresses of static variables. -set static_foo_addr [get_var_address static_foo] -set static_bar_addr [get_var_address static_bar] +with_test_prefix "print addresses, static vars" { + # Print the addresses of static variables. + set static_foo_addr [get_var_address static_foo] + set static_bar_addr [get_var_address static_bar] +} # Make sure they have different addresses. if { "${static_foo_addr}" == "${static_bar_addr}" } { @@ -163,9 +165,11 @@ if { "${static_foo_addr}" == "${static_bar_addr}" } { pass "static variables have different addresses" } -# Print the addresses of global variables. -set global_foo_addr [get_var_address global_foo] -set global_bar_addr [get_var_address global_bar] +with_test_prefix "print addresses, global vars" { + # Print the addresses of global variables. + set global_foo_addr [get_var_address global_foo] + set global_bar_addr [get_var_address global_bar] +} # Make sure they have different addresses. if { "${global_foo_addr}" == "${global_bar_addr}" } { @@ -174,9 +178,11 @@ if { "${global_foo_addr}" == "${global_bar_addr}" } { pass "global variables have different addresses" } -# Print the addresses of functions. -set function_foo_addr [get_var_address function_foo] -set function_bar_addr [get_var_address function_bar] +with_test_prefix "print addresses, functions" { + # Print the addresses of functions. + set function_foo_addr [get_var_address function_foo] + set function_bar_addr [get_var_address function_bar] +} # Make sure they have different addresses. if { "${function_foo_addr}" == "${function_bar_addr}" } { @@ -220,20 +226,26 @@ gdb_test "symbol-file -o $offset $binfile" \ "Reading symbols from ${binfile}\.\.\." \ "symbol-file with offset" -# Make sure the address of a static variable is moved by offset. -set new_static_foo_addr [get_var_address static_foo] -gdb_assert {${new_static_foo_addr} == ${static_foo_addr} + $offset} \ - "static variable foo is moved by offset" +with_test_prefix "static vars" { + # Make sure the address of a static variable is moved by offset. + set new_static_foo_addr [get_var_address static_foo] + gdb_assert {${new_static_foo_addr} == ${static_foo_addr} + $offset} \ + "static variable foo is moved by offset" +} -# Make sure the address of a global variable is moved by offset. -set new_global_foo_addr [get_var_address global_foo] -gdb_assert {${new_global_foo_addr} == ${global_foo_addr} + $offset} \ - "global variable foo is moved by offset" +with_test_prefix "global vars" { + # Make sure the address of a global variable is moved by offset. + set new_global_foo_addr [get_var_address global_foo] + gdb_assert {${new_global_foo_addr} == ${global_foo_addr} + $offset} \ + "global variable foo is moved by offset" +} -# Make sure the address of a function is moved by offset. -set new_function_foo_addr [get_var_address function_foo] -gdb_assert {${new_function_foo_addr} == ${function_foo_addr} + $offset} \ - "function foo is moved by offset" +with_test_prefix "functions" { + # Make sure the address of a function is moved by offset. + set new_function_foo_addr [get_var_address function_foo] + gdb_assert {${new_function_foo_addr} == ${function_foo_addr} + $offset} \ + "function foo is moved by offset" +} # Load the object using add-symbol-file with an offset and check that # all addresses are moved by that offset. @@ -246,20 +258,26 @@ gdb_test "add-symbol-file -o $offset $binfile" \ "add symbol table from file \".*${testfile}\\.o\" with all sections offset by $offset\[\r\n\]+\\(y or n\\) " \ "y" -# Make sure the address of a static variable is moved by offset. -set new_static_foo_addr [get_var_address static_foo] -gdb_assert { ${new_static_foo_addr} == ${static_foo_addr} + $offset } \ - "static variable foo is moved by offset" +with_test_prefix "static scope, 2nd" { + # Make sure the address of a static variable is moved by offset. + set new_static_foo_addr [get_var_address static_foo] + gdb_assert { ${new_static_foo_addr} == ${static_foo_addr} + $offset } \ + "static variable foo is moved by offset" +} -# Make sure the address of a global variable is moved by offset. -set new_global_foo_addr [get_var_address global_foo] -gdb_assert { ${new_global_foo_addr} == ${global_foo_addr} + $offset } \ - "global variable foo is moved by offset" +with_test_prefix "global vars, 2nd" { + # Make sure the address of a global variable is moved by offset. + set new_global_foo_addr [get_var_address global_foo] + gdb_assert { ${new_global_foo_addr} == ${global_foo_addr} + $offset } \ + "global variable foo is moved by offset" +} -# Make sure the address of a function is moved by offset. -set new_function_foo_addr [get_var_address function_foo] -gdb_assert { ${new_function_foo_addr} == ${function_foo_addr} + $offset } \ - "function foo is moved by offset" +with_test_prefix "functions, 2nd" { + # Make sure the address of a function is moved by offset. + set new_function_foo_addr [get_var_address function_foo] + gdb_assert { ${new_function_foo_addr} == ${function_foo_addr} + $offset } \ + "function foo is moved by offset" +} # Re-load the object giving an explicit address for .text @@ -271,10 +289,12 @@ gdb_test "add-symbol-file $binfile -o $offset $text" \ "add symbol table from file \".*${testfile}\\.o\" at\[ \t\r\n\]+\.text_addr = ${text}\[\r\n\]+with other sections offset by ${offset}\[\r\n\]+\\(y or n\\) " \ "y" -# Make sure function has a different addresses now. -set function_foo_addr [get_var_address function_foo] -gdb_assert { ${function_foo_addr} != ${new_function_foo_addr} } \ - "function foo has a different address" +with_test_prefix "functions, 3rd" { + # Make sure function has a different addresses now. + set function_foo_addr [get_var_address function_foo] + gdb_assert { ${function_foo_addr} != ${new_function_foo_addr} } \ + "function foo has a different address" +} # Re-load the object giving an explicit address for .data @@ -286,10 +306,12 @@ gdb_test "add-symbol-file $binfile -o $offset -s .data $data" \ "add symbol table from file \".*${testfile}\\.o\" at\[ \t\r\n\]+\.data_addr = ${data}\[\r\n\]+with other sections offset by ${offset}\[\r\n\]+\\(y or n\\) " \ "y" -# Make sure variable has a different addresses now. -set global_foo_addr [get_var_address global_foo] -gdb_assert { ${global_foo_addr} != ${new_global_foo_addr} } \ - "global variable foo has a different address" +with_test_prefix "global vars, 3rd" { + # Make sure variable has a different addresses now. + set global_foo_addr [get_var_address global_foo] + gdb_assert { ${global_foo_addr} != ${new_global_foo_addr} } \ + "global variable foo has a different address" +} # Now try loading the object as an exec-file; we should be able to print # the values of variables after we do this. diff --git a/gdb/testsuite/gdb.base/return2.exp b/gdb/testsuite/gdb.base/return2.exp index ad1dcc8..e93f4d8 100644 --- a/gdb/testsuite/gdb.base/return2.exp +++ b/gdb/testsuite/gdb.base/return2.exp @@ -50,7 +50,7 @@ proc return_1 { type } { gdb_test "print ${type}_resultval == testval.${type}_testval" ".* = 1" \ "${type} value returned successfully" gdb_test "print ${type}_resultval != ${type}_returnval" ".* = 1" \ - "validate result value not equal to program return value" + "validate result value not equal to program return value, ${type}" } proc return_void { } { diff --git a/gdb/testsuite/gdb.base/sigbpt.exp b/gdb/testsuite/gdb.base/sigbpt.exp index fb3a676..bd7e1d8 100644 --- a/gdb/testsuite/gdb.base/sigbpt.exp +++ b/gdb/testsuite/gdb.base/sigbpt.exp @@ -138,7 +138,9 @@ proc stepi_out { name args } { # disable SIGSEGV, ensuring that further signals stop the # inferior. Stops a SIGSEGV infinite loop when a broke system # keeps re-executing the faulting instruction. - rerun_to_main + with_test_prefix $name { + rerun_to_main + } gdb_test "handle ${signame} nostop print pass" ".*" "${name}; pass ${signame}" gdb_test "continue" "keeper.*" "${name}; continue to keeper" gdb_test "handle ${signame} stop print nopass" ".*" "${name}; nopass ${signame}" @@ -212,7 +214,9 @@ proc cont_out { name args } { # disable SIGSEGV, ensuring that further signals stop the # inferior. Stops a SIGSEGV infinite loop when a broke system # keeps re-executing the faulting instruction. - rerun_to_main + with_test_prefix $name { + rerun_to_main + } gdb_test "handle ${signame} nostop print pass" ".*" "${name}; pass ${signame}" gdb_test "continue" "keeper.*" "${name}; continue to keeper" gdb_test "handle ${signame} stop print nopass" ".*" "${name}; nopass ${signame}" diff --git a/gdb/testsuite/gdb.base/siginfo-obj.exp b/gdb/testsuite/gdb.base/siginfo-obj.exp index 1ce2d20..0ea3c23 100644 --- a/gdb/testsuite/gdb.base/siginfo-obj.exp +++ b/gdb/testsuite/gdb.base/siginfo-obj.exp @@ -45,7 +45,8 @@ if ![runto_main] then { } # Run to the signal. -gdb_test "continue" ".*Program received signal SIGSEGV.*" "continue to signal" +gdb_test "continue" ".*Program received signal SIGSEGV.*" \ + "continue to signal, 1st" # Try to generate a core file, for a later test. set gcorefile [standard_output_file $testfile.gcore] @@ -86,13 +87,14 @@ gdb_test_multiple "p \$_siginfo" "$test" { set bp_location [gdb_get_line_number "set breakpoint here"] -gdb_test "break $bp_location" -gdb_test "continue" ".* handler .*" "continue to handler" - -gdb_test "p ssi_addr" " = \\(void \\*\\) $ssi_addr" -gdb_test "p ssi_errno" " = $ssi_errno" -gdb_test "p ssi_code" " = $ssi_code" -gdb_test "p ssi_signo" " = $ssi_signo" +with_test_prefix "validate siginfo fields" { + gdb_test "break $bp_location" + gdb_test "continue" ".* handler .*" "continue to handler" + gdb_test "p ssi_addr" " = \\(void \\*\\) $ssi_addr" + gdb_test "p ssi_errno" " = $ssi_errno" + gdb_test "p ssi_code" " = $ssi_code" + gdb_test "p ssi_signo" " = $ssi_signo" +} # Again, but this time, patch si_addr and check that the inferior sees # the changed value. @@ -104,7 +106,8 @@ if ![runto_main] then { } # Run to the signal. -gdb_test "continue" ".*Program received signal SIGSEGV.*" "continue to signal" +gdb_test "continue" ".*Program received signal SIGSEGV.*" \ + "continue to signal, 2nd" set test "set si_addr" gdb_test "p \$_siginfo._sifields._sigfault.si_addr = 0x666" " = \\(void \\*\\) 0x666" @@ -112,13 +115,14 @@ gdb_test "p \$_siginfo.si_errno = 666" " = 666" gdb_test "p \$_siginfo.si_code = 999" " = 999" gdb_test "p \$_siginfo.si_signo = 11" " = 11" -gdb_test "break $bp_location" -gdb_test "continue" ".* handler .*" "continue to handler" - -gdb_test "p ssi_addr" " = \\(void \\*\\) 0x666" -gdb_test "p ssi_errno" " = 666" -gdb_test "p ssi_code" " = 999" -gdb_test "p ssi_signo" " = 11" +with_test_prefix "validate modified siginfo fields" { + gdb_test "break $bp_location" + gdb_test "continue" ".* handler .*" "continue to handler" + gdb_test "p ssi_addr" " = \\(void \\*\\) 0x666" + gdb_test "p ssi_errno" " = 666" + gdb_test "p ssi_code" " = 999" + gdb_test "p ssi_signo" " = 11" +} # Test siginfo preservation in core files. if {$gcore_created} { diff --git a/gdb/testsuite/gdb.cp/converts.exp b/gdb/testsuite/gdb.cp/converts.exp index 730c7f6..5ef57fe 100644 --- a/gdb/testsuite/gdb.cp/converts.exp +++ b/gdb/testsuite/gdb.cp/converts.exp @@ -36,8 +36,10 @@ gdb_test "p foo0_3 (bppp)" "Cannot resolve.*" \ gdb_test "p foo1_1 (a)" "= 11" "pointer to pointer" gdb_test "p foo1_2 (a)" "= 12" "pointer to array" -gdb_test "p foo1_3 (a)" "Cannot resolve.*" "pointer to pointer of wrong type" -gdb_test "p foo1_3 (bp)" "Cannot resolve.*" "pointer to pointer of wrong type" +gdb_test "p foo1_3 (a)" "Cannot resolve.*" \ + "pointer to pointer of wrong type, a" +gdb_test "p foo1_3 (bp)" "Cannot resolve.*" \ + "pointer to pointer of wrong type, bp" gdb_test "p foo1_4 (bp)" "= 14" "pointer to ancestor pointer" gdb_test "p foo1_5 (bp)" "= 15" "pointer to void pointer" gdb_test "p foo1_6 (bp)" "Cannot resolve.*" "pointer to void pointer pointer" @@ -94,28 +96,36 @@ gdb_test "p foo1_7(ta)" \ # Test for strict type checking set error_str "Cannot resolve function %s to any overloaded instance" -gdb_test "show check type" "Strict type checking is on\." -gdb_test "p foo1_type_check (123)" [format $error_str "foo1_type_check"] -gdb_test "p foo2_type_check (0, 1)" [format $error_str "foo2_type_check"] -gdb_test "p foo2_type_check (1, 0)" [format $error_str "foo2_type_check"] -gdb_test "p foo2_type_check (1, 1)" [format $error_str "foo2_type_check"] -gdb_test "p foo3_type_check (0, 0, 1)" [format $error_str "foo3_type_check"] -gdb_test "p foo3_type_check (0, 1, 0)" [format $error_str "foo3_type_check"] -gdb_test "p foo3_type_check (1, 0, 0)" [format $error_str "foo3_type_check"] -gdb_test "p foo3_type_check (0, 1, 1)" [format $error_str "foo3_type_check"] -gdb_test "p foo3_type_check (1, 1, 0)" [format $error_str "foo3_type_check"] -gdb_test "p foo3_type_check (1, 1, 1)" [format $error_str "foo3_type_check"] +gdb_test "show check type" "Strict type checking is on\." \ + "confirm check type on" + +with_test_prefix "strict type checking on" { + gdb_test "p foo1_type_check (123)" [format $error_str "foo1_type_check"] + gdb_test "p foo2_type_check (0, 1)" [format $error_str "foo2_type_check"] + gdb_test "p foo2_type_check (1, 0)" [format $error_str "foo2_type_check"] + gdb_test "p foo2_type_check (1, 1)" [format $error_str "foo2_type_check"] + gdb_test "p foo3_type_check (0, 0, 1)" [format $error_str "foo3_type_check"] + gdb_test "p foo3_type_check (0, 1, 0)" [format $error_str "foo3_type_check"] + gdb_test "p foo3_type_check (1, 0, 0)" [format $error_str "foo3_type_check"] + gdb_test "p foo3_type_check (0, 1, 1)" [format $error_str "foo3_type_check"] + gdb_test "p foo3_type_check (1, 1, 0)" [format $error_str "foo3_type_check"] + gdb_test "p foo3_type_check (1, 1, 1)" [format $error_str "foo3_type_check"] +} gdb_test_no_output "set check type off" -gdb_test "show check type" "Strict type checking is off\." -gdb_test "p foo1_type_check (123)" " = 1000" -gdb_test "p foo2_type_check (0, 1)" " = 1001" -gdb_test "p foo2_type_check (1, 0)" " = 1001" -gdb_test "p foo2_type_check (1, 1)" " = 1001" -gdb_test "p foo3_type_check (0, 0, 1)" " = 1002" -gdb_test "p foo3_type_check (0, 1, 0)" " = 1002" -gdb_test "p foo3_type_check (1, 0, 0)" " = 1002" -gdb_test "p foo3_type_check (0, 1, 1)" " = 1002" -gdb_test "p foo3_type_check (1, 1, 0)" " = 1002" -gdb_test "p foo3_type_check (1, 1, 1)" " = 1002" -gdb_test "p foo3_2 (1,1)" " = 32" +gdb_test "show check type" "Strict type checking is off\." \ + "confirm check type off" + +with_test_prefix "strict type checking off" { + gdb_test "p foo1_type_check (123)" " = 1000" + gdb_test "p foo2_type_check (0, 1)" " = 1001" + gdb_test "p foo2_type_check (1, 0)" " = 1001" + gdb_test "p foo2_type_check (1, 1)" " = 1001" + gdb_test "p foo3_type_check (0, 0, 1)" " = 1002" + gdb_test "p foo3_type_check (0, 1, 0)" " = 1002" + gdb_test "p foo3_type_check (1, 0, 0)" " = 1002" + gdb_test "p foo3_type_check (0, 1, 1)" " = 1002" + gdb_test "p foo3_type_check (1, 1, 0)" " = 1002" + gdb_test "p foo3_type_check (1, 1, 1)" " = 1002" + gdb_test "p foo3_2 (1,1)" " = 32" +} diff --git a/gdb/testsuite/gdb.cp/exceptprint.exp b/gdb/testsuite/gdb.cp/exceptprint.exp index 1248987..ad5f0c4 100644 --- a/gdb/testsuite/gdb.cp/exceptprint.exp +++ b/gdb/testsuite/gdb.cp/exceptprint.exp @@ -76,16 +76,20 @@ if {![runto_main]} { return -1 } -gdb_test "catch catch int if \$_exception == 23" \ - "Catchpoint \[0-9\]+ \\(catch\\)" \ - "catch catch" -gdb_test "catch throw int if \$_exception == 23" \ - "Catchpoint \[0-9\]+ \\(throw\\)" \ - "catch throw" -gdb_test "catch rethrow int if \$_exception == 23" \ - "Catchpoint \[0-9\]+ \\(rethrow\\)" \ - "catch rethrow" +with_test_prefix "2nd run" { + gdb_test "catch catch int if \$_exception == 23" \ + "Catchpoint \[0-9\]+ \\(catch\\)" \ + "catch catch" + gdb_test "catch throw int if \$_exception == 23" \ + "Catchpoint \[0-9\]+ \\(throw\\)" \ + "catch throw" + gdb_test "catch rethrow int if \$_exception == 23" \ + "Catchpoint \[0-9\]+ \\(rethrow\\)" \ + "catch rethrow" +} # This tests both the case where the regular expression does not # match, and the case where it does. -do_exceptprint_tests int 23 +with_test_prefix "2nd run" { + do_exceptprint_tests int 23 +} diff --git a/gdb/testsuite/gdb.cp/inherit.exp b/gdb/testsuite/gdb.cp/inherit.exp index 9616015..59c72da 100644 --- a/gdb/testsuite/gdb.cp/inherit.exp +++ b/gdb/testsuite/gdb.cp/inherit.exp @@ -693,9 +693,16 @@ proc do_tests { } { return } - test_print_si_members + with_test_prefix "single inheritance" { + test_print_si_members + } + test_print_si_classes - test_print_mi_members + + with_test_prefix "multiple inheritance" { + test_print_mi_members + } + test_print_mi_member_types test_print_mi_classes test_print_anon_union diff --git a/gdb/testsuite/gdb.cp/nsnoimports.exp b/gdb/testsuite/gdb.cp/nsnoimports.exp index 98b4c56..bbf255c 100644 --- a/gdb/testsuite/gdb.cp/nsnoimports.exp +++ b/gdb/testsuite/gdb.cp/nsnoimports.exp @@ -25,37 +25,43 @@ if ![runto_main] then { continue } -gdb_test "print A::_a" "= 11" -gdb_test "print A::B::ab" "= 22" -gdb_test "print A::B::C::abc" "= 33" +with_test_prefix "main scope" { + gdb_test "print A::_a" "= 11" + gdb_test "print A::B::ab" "= 22" + gdb_test "print A::B::C::abc" "= 33" -gdb_test "print _a" "No symbol .* in current context." -gdb_test "print ab" "No symbol .* in current context." -gdb_test "print abc" "No symbol .* in current context." + gdb_test "print _a" "No symbol .* in current context." + gdb_test "print ab" "No symbol .* in current context." + gdb_test "print abc" "No symbol .* in current context." +} ############################################ gdb_breakpoint A::B::first gdb_continue_to_breakpoint "A::B::first" -gdb_test "print A::_a" "= 11" -gdb_test "print A::B::ab" "= 22" -gdb_test "print A::B::C::abc" "= 33" +with_test_prefix "A::B::first scope" { + gdb_test "print A::_a" "= 11" + gdb_test "print A::B::ab" "= 22" + gdb_test "print A::B::C::abc" "= 33" -gdb_test "print _a" "= 11" -gdb_test "print ab" "= 22" -gdb_test "print C::abc" "= 33" + gdb_test "print _a" "= 11" + gdb_test "print ab" "= 22" + gdb_test "print C::abc" "= 33" -gdb_test "print abc" "No symbol .* in current context." + gdb_test "print abc" "No symbol .* in current context." +} ############################################ gdb_breakpoint A::B::C::second gdb_continue_to_breakpoint "A::B::C::second" -gdb_test "print A::_a" "= 11" -gdb_test "print A::B::ab" "= 22" -gdb_test "print A::B::C::abc" "= 33" +with_test_prefix "A::B::C::second scope" { + gdb_test "print A::_a" "= 11" + gdb_test "print A::B::ab" "= 22" + gdb_test "print A::B::C::abc" "= 33" -gdb_test "print _a" "= 11" -gdb_test "print ab" "= 22" -gdb_test "print abc" "= 33" + gdb_test "print _a" "= 11" + gdb_test "print ab" "= 22" + gdb_test "print abc" "= 33" +} diff --git a/gdb/testsuite/gdb.cp/virtbase2.exp b/gdb/testsuite/gdb.cp/virtbase2.exp index 6e968a5..7b53929 100644 --- a/gdb/testsuite/gdb.cp/virtbase2.exp +++ b/gdb/testsuite/gdb.cp/virtbase2.exp @@ -63,23 +63,29 @@ proc make_scope_list { scopes } { } proc test_variables_in_base { scopes } { - foreach scope [make_scope_list $scopes] { - gdb_test "print ${scope}i" " = 55" - gdb_test "print ${scope}d" " = 6.25" - gdb_test "print ${scope}x" " = 22" - } + with_test_prefix "$scopes" { + foreach scope [make_scope_list $scopes] { + gdb_test "print ${scope}i" " = 55" + gdb_test "print ${scope}d" " = 6.25" + gdb_test "print ${scope}x" " = 22" + } + } } proc test_variables_in_superbase { scopes } { - foreach scope [make_scope_list $scopes] { - gdb_test "print ${scope}x" " = 22" - } + with_test_prefix "$scopes" { + foreach scope [make_scope_list $scopes] { + gdb_test "print ${scope}x" " = 22" + } + } } proc test_variables_in_super { scopes } { - foreach scope [make_scope_list $scopes] { - gdb_test "print ${scope}w" " = 17" - } + with_test_prefix "$scopes" { + foreach scope [make_scope_list $scopes] { + gdb_test "print ${scope}w" " = 17" + } + } } with_test_prefix "derived::func_d" { diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp index 9ce6a51..260917a 100644 --- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp @@ -70,7 +70,9 @@ mi_gdb_test "113-var-create argc * argc" \ "113\\^error,msg=\"-var-create: unable to create variable object\"" \ "create out of scope variable" -mi_runto do_locals_tests +with_test_prefix "first run" { + mi_runto do_locals_tests +} set line_dlt_first_real [gdb_get_line_number "linteger = 1234;"] @@ -253,7 +255,7 @@ mi_gdb_test "-var-assign global_simple 0" \ mi_gdb_test "-var-assign linteger 3333" \ "\\^done,value=\"3333\"" \ - "assign to linteger" + "assign to linteger, 1st" # Allow lpcharacter to update, optionally. Because it points to a # char variable instead of a zero-terminated string, if linteger is @@ -278,7 +280,7 @@ mi_gdb_test "-var-evaluate-expression linteger" \ mi_gdb_test "-var-assign lpinteger \"&linteger + 3\"" \ "\\^done,value=\"$hex\"" \ - "assign to lpinteger" + "assign to lpinteger, 1st" mi_gdb_test "-var-update *" \ "\\^done,changelist=\\\[\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ @@ -296,11 +298,11 @@ mi_gdb_test "-var-evaluate-expression lpinteger" \ mi_gdb_test "-var-assign linteger 4321" \ "\\^done,value=\"4321\"" \ - "assign to linteger" + "assign to linteger, 2nd" mi_gdb_test "-var-assign lpinteger &linteger" \ "\\^done,value=\"$hex\"" \ - "assign to lpinteger" + "assign to lpinteger, 2nd" mi_gdb_test "-var-assign lcharacter 'z'" \ "\\^done,value=\"122 'z'\"" \ @@ -312,33 +314,33 @@ mi_gdb_test "-var-evaluate-expression lcharacter" \ mi_gdb_test "-var-assign llong 1313L" \ "\\^done,value=\"1313\"" \ - "assign to llong" + "assign to llong, 1st" mi_gdb_test "-var-evaluate-expression llong" \ "\\^done,value=\"1313\"" \ "eval llong" mi_gdb_test "-var-assign llong 1212L" \ "\\^done,value=\"1212\"" \ - "assign to llong" + "assign to llong, 2nd" mi_gdb_test "-var-assign lplong &llong+4" \ "\\^done,value=\"$hex\"" \ - "assign to lplong" + "assign to lplong, 1st" mi_gdb_test "-var-evaluate-expression lplong" \ "\\^done,value=\"$hex\"" \ "eval lplong" mi_gdb_test "-var-assign lplong &llong" \ "\\^done,value=\"$hex\"" \ - "assign to lplong" + "assign to lplong, 2nd" mi_gdb_test "-var-assign lfloat 3.4567" \ "\\^done,value=\"3.45.*\"" \ - "assign to lfloat" + "assign to lfloat, 1st" mi_gdb_test "-var-evaluate-expression lfloat" \ "\\^done,value=\"3.45.*\"" \ "eval lfloat" mi_gdb_test "-var-assign lfloat 1.2345" \ "\\^done,value=\"1.23.*\"" \ - "assign to lfloat" + "assign to lfloat, 2nd" mi_gdb_test "-var-assign lpfloat &lfloat+4" \ "\\^done,value=\"$hex\"" \ @@ -648,7 +650,9 @@ mi_gdb_test "-var-delete endvar" \ mi_delete_breakpoints -mi_runto do_locals_tests +with_test_prefix "second run" { + mi_runto do_locals_tests +} 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" diff --git a/gdb/testsuite/gdb.mi/var-cmd.c b/gdb/testsuite/gdb.mi/var-cmd.c index 39c4602..0529b67 100644 --- a/gdb/testsuite/gdb.mi/var-cmd.c +++ b/gdb/testsuite/gdb.mi/var-cmd.c @@ -366,23 +366,25 @@ void do_frozen_tests () int v2 = 4; /*: - mi_create_varobj V1 v1 "create varobj for v1" - mi_create_varobj V2 v2 "create varobj for v2" - - mi_list_varobj_children "V1" { - {"V1.i" "i" "0" "int"} - {"V1.nested" "nested" "2" "struct {...}"} - } "list children of v1" - - mi_list_varobj_children "V1.nested" { - {"V1.nested.j" "j" "0" "int"} - {"V1.nested.k" "k" "0" "int"} - } "list children of v1.nested" - - mi_check_varobj_value V1.i 1 "check V1.i: 1" - mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2" - mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3" - mi_check_varobj_value V2 4 "check V2: 4" + with_test_prefix "create varobj V1 and V2" { + mi_create_varobj V1 v1 "create varobj for v1" + mi_create_varobj V2 v2 "create varobj for v2" + + mi_list_varobj_children "V1" { + {"V1.i" "i" "0" "int"} + {"V1.nested" "nested" "2" "struct {...}"} + } "list children of v1" + + mi_list_varobj_children "V1.nested" { + {"V1.nested.j" "j" "0" "int"} + {"V1.nested.k" "k" "0" "int"} + } "list children of v1.nested" + + mi_check_varobj_value V1.i 1 "check V1.i: 1" + mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2" + mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3" + mi_check_varobj_value V2 4 "check V2: 4" + } :*/ v2 = 5; /*: @@ -400,40 +402,50 @@ void do_frozen_tests () v1.nested.j = 8; v1.nested.k = 9; /*: - set_frozen V1 1 - mi_varobj_update * {} "update varobjs: nothing changed" - mi_check_varobj_value V1.i 1 "check V1.i: 1" - mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2" - mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3" + with_test_prefix "frozen V1" { + set_frozen V1 1 + mi_varobj_update * {} "update varobjs: nothing changed" + mi_check_varobj_value V1.i 1 "check V1.i: 1" + mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2" + mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3" + } # Check that explicit update for elements of structures # works. - # Update v1.j - mi_varobj_update V1.nested.j {V1.nested.j} "update V1.nested.j" - mi_check_varobj_value V1.i 1 "check V1.i: 1" - mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8" - mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3" - # Update v1.nested, check that children is updated. - mi_varobj_update V1.nested {V1.nested.k} "update V1.nested" - mi_check_varobj_value V1.i 1 "check V1.i: 1" - mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8" - mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9" - # Update v1.i - mi_varobj_update V1.i {V1.i} "update V1.i" - mi_check_varobj_value V1.i 7 "check V1.i: 7" + with_test_prefix "update v1.j" { + # Update v1.j + mi_varobj_update V1.nested.j {V1.nested.j} "update V1.nested.j" + mi_check_varobj_value V1.i 1 "check V1.i: 1" + mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8" + mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3" + } + with_test_prefix "update v1.nested" { + # Update v1.nested, check that children is updated. + mi_varobj_update V1.nested {V1.nested.k} "update V1.nested" + mi_check_varobj_value V1.i 1 "check V1.i: 1" + mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8" + mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9" + } + with_test_prefix "update v1.i" { + # Update v1.i + mi_varobj_update V1.i {V1.i} "update V1.i" + mi_check_varobj_value V1.i 7 "check V1.i: 7" + } :*/ v1.i = 10; v1.nested.j = 11; v1.nested.k = 12; /*: # Check that unfreeze itself does not updates the values. - set_frozen V1 0 - mi_check_varobj_value V1.i 7 "check V1.i: 7" - mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8" - mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9" - mi_varobj_update V1 {V1.i V1.nested.j V1.nested.k} "update V1" - mi_check_varobj_value V1.i 10 "check V1.i: 10" - mi_check_varobj_value V1.nested.j 11 "check V1.nested.j: 11" - mi_check_varobj_value V1.nested.k 12 "check V1.nested.k: 12" + with_test_prefix "unfrozen V1" { + set_frozen V1 0 + mi_check_varobj_value V1.i 7 "check V1.i: 7" + mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8" + mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9" + mi_varobj_update V1 {V1.i V1.nested.j V1.nested.k} "update V1" + mi_check_varobj_value V1.i 10 "check V1.i: 10" + mi_check_varobj_value V1.nested.j 11 "check V1.nested.j: 11" + mi_check_varobj_value V1.nested.k 12 "check V1.nested.k: 12" + } :*/ /*: END: frozen :*/ |