]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.arch/i386-byte.exp
gdb/testsuite: remove use of then keyword from gdb.arch/*.exp
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / i386-byte.exp
1 # Copyright 2010-2022 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16 # Please email any bugs, comments, and/or additions to this file to:
17 # bug-gdb@gnu.org
18
19 # This file is part of the gdb testsuite.
20
21
22 if {(![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"])} {
23 verbose "Skipping i386 byte register tests."
24 return
25 }
26
27 standard_testfile i386-pseudo.c
28
29 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug]] != "" } {
30 untested "failed to compile"
31 return
32 }
33
34 clean_restart ${binfile}
35
36 if {![runto_main]} {
37 return 0
38 }
39
40 set byte_regs(1) al
41 set byte_regs(2) bl
42 set byte_regs(3) cl
43 set byte_regs(4) dl
44 set byte_regs(5) ah
45 set byte_regs(6) bh
46 set byte_regs(7) ch
47 set byte_regs(8) dh
48
49 gdb_breakpoint [gdb_get_line_number "first breakpoint here"]
50 gdb_continue_to_breakpoint "continue to first breakpoint in main"
51
52 with_test_prefix "at first bp" {
53 for { set r 1 } { $r <= 4 } { incr r } {
54 gdb_test "print/x \$$byte_regs($r)" \
55 ".. = 0x[format %x $r]1" \
56 "check contents of %$byte_regs($r)"
57 set h [expr $r + 4]
58 gdb_test "print/x \$$byte_regs($h)" \
59 ".. = 0x[format %x $r]2" \
60 "check contents of %$byte_regs($h)"
61 }
62
63 for { set r 1 } { $r <= 4 } { incr r } {
64 gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
65 set h [expr $r + 4]
66 gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)"
67 }
68 }
69
70 gdb_breakpoint [gdb_get_line_number "second breakpoint here"]
71 gdb_continue_to_breakpoint "continue to second breakpoint in main"
72
73 with_test_prefix "at second bp" {
74 for { set r 1 } { $r <= 4 } { incr r } {
75 gdb_test "print \$$byte_regs($r)" \
76 ".. = $r" \
77 "check contents of %$byte_regs($r)"
78 set h [expr $r + 4]
79 gdb_test "print \$$byte_regs($h)" \
80 ".. = $h" \
81 "check contents of %$byte_regs($h)"
82 }
83 }