summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.arch/arc-step-jtag.exp
blob: a51f00e4b54c0617190e1c99787e3ddac1c78990 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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 "*elf32*"] then {
    verbose "Skipping ARC JTAG single-step tests."
    return
}

set testfile "arc-step-jtag"
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

if { [ gdb_load ${binfile} ] != 0 } {
    gdb_suppress_entire_file "Load failed, so all tests in this file will automatically fail."
}

#
# 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_dslot .*"    "step b.d branch"
gdb_test "stepi"     	".* Lbdotd .*"          "step b.d delay slot"
gdb_test "p \$r0"    	".*= 5"                 "r0 value after b.d delay slot"

gdb_test "stepi"     	".* Lbl .*"       "step bl instruction"

gdb_test "stepi"     	".* Lj_sdotd_dslot .*"  "step j_s.d \[blink\] branch"
gdb_test "stepi"     	".* Lj_sdotd .*"        "step j_s.d \[blink\] delay slot"
gdb_test "p \$r0"    	".*= 6"                 "r0 value after j_s.d \[blink\] delay slot"

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 2 iterations"
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 3 iterations"
gdb_test "stepi"        ".* ZOLend .*"    "step out of end of ZOL"

# exit(r0)
gdb_test "continue"     ".*Program exited.*011.*" \
                                          "value of r0 on exit"