| if $tracelevel { |
| strace $tracelevel |
| } |
| |
| # Test single-stepping zero-overhead-loops and delay slots |
| |
| if ![istarget "arc-*-*"] then { |
| verbose "Skipping ARC single-step tests." |
| return |
| } |
| |
| if ![istarget "*linux*"] then { |
| verbose "Skipping ARC linux single-step tests." |
| return |
| } |
| |
| set testfile "arc-step" |
| set srcfile ${testfile}.s |
| set binfile ${objdir}/${subdir}/${testfile} |
| if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ""] != "" } { |
| gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." |
| } |
| |
| gdb_exit |
| gdb_start |
| gdb_reinitialize_dir $srcdir/$subdir |
| gdb_load ${binfile} |
| |
| # |
| # Run to `main' where we begin our tests. |
| # |
| |
| gdb_test "adv _main" ".* in _main .*" "advance to _main" |
| |
| gdb_test "stepi" ".* Lmov .*" "step mov instruction" |
| gdb_test "p \$r0" ".*= 1" "r0 value after mov instruction" |
| |
| gdb_test "stepi" ".* Lmov_s .*" "step mov_s instruction" |
| gdb_test "p \$r0" ".*= 2" "r0 value after mov_s instruction" |
| |
| gdb_test "stepi" ".* Lb .*" "step b instruction" |
| |
| gdb_test "stepi" ".* Lb_s .*" "step b_s instruction" |
| |
| gdb_test "stepi" ".* Lbdotd .*" "step b.d instruction" |
| gdb_test "p \$r0" ".*= 5" "r0 value after b.d instruction" |
| |
| gdb_test "stepi" ".* Lbl .*" "step bl instruction" |
| |
| gdb_test "stepi" ".* Lj_sdotd .*" "step j_s.d \[blink\] instruction" |
| gdb_test "p \$r0" ".*= 6" "r0 value after j_s.d \[blink\] instruction" |
| |
| gdb_test "stepi" ".* Lj .*" "step j instruction" |
| |
| gdb_test "stepi" ".*" "step mov instruction" |
| gdb_test "stepi" ".* ZOLstart .*" "step lp instruction" |
| |
| gdb_test "p \$lp_count" ".*= 3" "lp_count value" |
| gdb_test "p \$lp_end - \$lp_start" \ |
| ".* = 8" "lp_end - lp_start == 8" |
| |
| gdb_test "p \$r0" ".* = 6" "r0 value before loop" |
| |
| # step thru the loop, checking the value of r0 |
| |
| # first iteration |
| gdb_test "stepi" ".* ZOLmiddle .*" "step add instruction (inside ZOL)" |
| gdb_test "p \$r0" ".* = 7" "r0 value after 1 iteration" |
| gdb_test "stepi" ".* ZOLstart .*" "step across end of ZOL" |
| |
| # second iteration |
| gdb_test "stepi" ".* ZOLmiddle .*" "step add instruction (inside ZOL)" |
| gdb_test "p \$r0" ".* = 8" "r0 value after 1 iteration" |
| gdb_test "stepi" ".* ZOLstart .*" "step across end of ZOL" |
| |
| # last iteration |
| gdb_test "stepi" ".* ZOLmiddle .*" "step add instruction (inside ZOL)" |
| gdb_test "p \$r0" ".* = 9" "r0 value after 1 iteration" |
| gdb_test "stepi" ".* ZOLend .*" "step out of end of ZOL" |
| |
| # exit(r0) |
| gdb_test "continue" ".*Program exited.*011.*" \ |
| "value of r0 on exit" |