gdb/testsuite/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Sat, 3 Mar 2012 14:19:19 +0000 (14:19 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Sat, 3 Mar 2012 14:19:19 +0000 (14:19 +0000)
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.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.cp/mb-templates.exp

index f2436d346254795033955512b7c36afac0f8378e..cc39a9a88bf6f75b4bd5d51e40fad1624e0f70ed 100644 (file)
@@ -1,3 +1,11 @@
+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.
index 128f9f7796183ce54ea8634e575f140f0fe46d19..d386c0290986602bb25f899674d3a2a4df9557ed 100644 (file)
@@ -26,7 +26,8 @@ if { [istarget "spu*-*-*"] } {
 
 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
@@ -37,10 +38,7 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
      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"]
 
@@ -52,15 +50,12 @@ gdb_test "break $srcfile:$bp_location if i==1" \
     "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
     }
 }
 
@@ -70,16 +65,16 @@ gdb_test "continue" \
 
 # 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
@@ -102,7 +97,7 @@ gdb_test "continue" \
 # 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 {
@@ -118,10 +113,10 @@ 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 {
This page took 0.038356 seconds and 4 git commands to generate.