+2012-03-03 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Code cleanup.
+ * gdb.cp/mb-templates.exp: New variables executable. Use it for
+ binfile. use clean_restart. Replace gdb_expect by gdb_test_multiple.
+ Replace GDB restart by kill and delete_breakpoints. Replace breakpoint
+ number 1 by $bpnum. Four times.
+
2012-03-03 Yao Qi <yao@codesourcery.com>
* gdb.trace/strace.exp: run strace_info_marker in linux native gdb.
set testfile "mb-templates"
set srcfile ${testfile}.cc
-set binfile ${objdir}/${subdir}/${testfile}
+set executable ${testfile}
+set binfile ${objdir}/${subdir}/${executable}
if [get_compiler_info ${binfile} "c++"] {
return -1
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${executable}
set bp_location [gdb_get_line_number "set breakpoint here"]
"initial condition: set breakpoint"
gdb_run_cmd
-gdb_expect {
+
+set test "initial condition: run to breakpoint"
+gdb_test_multiple "" $test {
-re "Breakpoint \[0-9\]+,.*foo<int> \\(i=1\\).*$gdb_prompt $" {
- pass "initial condition: run to breakpoint"
- }
- -re "$gdb_prompt $" {
- fail "initial condition: run to breakpoint"
- }
- timeout {
- fail "initial condition: run to breakpoint (timeout)"
+ pass $test
+ break
}
}
# Set breakpoint with multiple locations.
# Separately set the condition.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+
+delete_breakpoints
+gdb_test "kill" "" "kill" \
+ {Kill the program being debugged\? \(y or n\) } "y"
gdb_test "break $srcfile:$bp_location" \
"Breakpoint.*at.*: $srcfile:$bp_location. \\(2 locations\\).*" \
"separate condition: set breakpoint"
-gdb_test_no_output "condition 1 i==1" \
+gdb_test_no_output {condition $bpnum i==1} \
"separate condition: set condition"
gdb_run_cmd
# Try disabling a single location. We also test
# that at least in simple cases, the enable/disable
# state of locations surive "run".
-gdb_test_no_output "disable 1.1" "disabling location: disable"
+gdb_test_no_output {disable $bpnum.1} "disabling location: disable"
gdb_run_cmd
gdb_expect {
}
# Try disabling entire breakpoint
-gdb_test_no_output "enable 1.1" "disabling location: enable"
+gdb_test_no_output {enable $bpnum.1} "disabling location: enable"
-gdb_test_no_output "disable 1" "disable breakpoint: disable"
+gdb_test_no_output {disable $bpnum} "disable breakpoint: disable"
gdb_run_cmd
gdb_expect {