aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.arch/i386-byte.exp
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2010-03-02 13:14:36 +0000
committerH.J. Lu <hjl.tools@gmail.com>2010-03-02 13:14:36 +0000
commit1ba53b71caf9544b0c1dc040af4052561c32d47b (patch)
tree8e3eb732fad2c1b52dc3a76c54ab65e5d1c198f2 /gdb/testsuite/gdb.arch/i386-byte.exp
parent5488d830ec018f8528fe806eeeaa39ce5ff7ffb1 (diff)
downloadbinutils-1ba53b71caf9544b0c1dc040af4052561c32d47b.zip
binutils-1ba53b71caf9544b0c1dc040af4052561c32d47b.tar.gz
binutils-1ba53b71caf9544b0c1dc040af4052561c32d47b.tar.bz2
Support x86 pseudo byte, word and dword registers.
gdb/ 2010-03-02 H.J. Lu <hongjiu.lu@intel.com> * amd64-tdep.c (amd64_byte_names): New. (amd64_word_names): Likewise. (amd64_dword_names): Likewise. (amd64_pseudo_register_name): Likewise. (amd64_pseudo_register_read): Likewise. (amd64_pseudo_register_write): Likewise. (amd64_init_abi): Set num_byte_regs, num_word_regs, num_dword_regs and num_mmx_regs. Call set_gdbarch_pseudo_register_read, set_gdbarch_pseudo_register_write and set_tdesc_pseudo_register_name. Don't call set_gdbarch_num_pseudo_regs. Don't set mm0_regnum. * i386-tdep.c (i386_num_mmx_regs): Removed. (i386_num_pseudo_regs): Likewise. (i386_byte_names): New. (i386_word_names): Likewise. (i386_byte_regnum_p): Likewise. (i386_word_regnum_p): Likewise. (i386_mmx_regnum_p): Updated. (i386_pseudo_register_name): Make it global. Handle byte and word pseudo-registers. (i386_pseudo_register_read): Likewise. (i386_pseudo_register_write): Likewise. (i386_pseudo_register_type): Handle byte, word and dword pseudo-registers (i386_register_reggroup_p): Don't include pseudo registers, except for MXX, in any register groups. Don't include pseudo byte, word, dword registers in general_reggroup. (i386_gdbarch_init): Set num_byte_regs, num_word_regs, num_dword_regs, al_regnum, ax_regnum and eax_regnum. Put MMX pseudo-registers after word pseudo-registers. Call set_gdbarch_num_pseudo_regs after calling gdbarch_init_osabi. * i386-tdep.h (gdbarch_tdep): Add num_mmx_regs, num_byte_regs, al_regnum, num_word_regs, ax_regnum, num_dword_regs and eax_regnum. (i386_byte_regnum_p): New. (i386_word_regnum_p): Likewise. (i386_dword_regnum_p): Likewise. (i386_pseudo_register_name): Likewise. (i386_pseudo_register_read): Likewise. (i386_pseudo_register_write): Likewise. gdb/testsuite/ 2010-03-02 H.J. Lu <hongjiu.lu@intel.com> * gdb.arch/amd64-byte.exp: New. * gdb.arch/amd64-dword.exp: Likewise. * gdb.arch/amd64-pseudo.c: Likewise. * gdb.arch/amd64-word.exp: Likewise. * gdb.arch/i386-byte.exp: Likewise. * gdb.arch/i386-pseudo.c: Likewise. * gdb.arch/i386-word.exp: Likewise.
Diffstat (limited to 'gdb/testsuite/gdb.arch/i386-byte.exp')
-rw-r--r--gdb/testsuite/gdb.arch/i386-byte.exp98
1 files changed, 98 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.arch/i386-byte.exp b/gdb/testsuite/gdb.arch/i386-byte.exp
new file mode 100644
index 0000000..865257d
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/i386-byte.exp
@@ -0,0 +1,98 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@gnu.org
+
+# This file is part of the gdb testsuite.
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+if { ![istarget i?86-*-*] } {
+ verbose "Skipping i386 byte register tests."
+ return
+}
+
+set testfile "i386-byte"
+set srcfile i386-pseudo.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if [get_compiler_info ${binfile}] {
+ return -1
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug]] != "" } {
+ untested ${testfile}
+ return
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto_main] then {
+ gdb_suppress_tests
+}
+
+set byte_regs(1) al
+set byte_regs(2) bl
+set byte_regs(3) cl
+set byte_regs(4) dl
+set byte_regs(5) ah
+set byte_regs(6) bh
+set byte_regs(7) ch
+set byte_regs(8) dh
+
+gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
+ "Breakpoint .* at .*${srcfile}.*" \
+ "set first breakpoint in main"
+gdb_continue_to_breakpoint "continue to first breakpoint in main"
+
+for { set r 1 } { $r <= 4 } { incr r } {
+ gdb_test "print/x \$$byte_regs($r)" \
+ ".. = 0x[format %x $r]1" \
+ "check contents of %$byte_regs($r)"
+ set h [expr $r + 4]
+ gdb_test "print/x \$$byte_regs($h)" \
+ ".. = 0x[format %x $r]2" \
+ "check contents of %$byte_regs($h)"
+}
+
+for { set r 1 } { $r <= 4 } { incr r } {
+ gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
+ set h [expr $r + 4]
+ gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)"
+}
+
+gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
+ "Breakpoint .* at .*${srcfile}.*" \
+ "set second breakpoint in main"
+gdb_continue_to_breakpoint "continue to second breakpoint in main"
+
+for { set r 1 } { $r <= 4 } { incr r } {
+ gdb_test "print \$$byte_regs($r)" \
+ ".. = $r" \
+ "check contents of %$byte_regs($r)"
+ set h [expr $r + 4]
+ gdb_test "print \$$byte_regs($h)" \
+ ".. = $h" \
+ "check contents of %$byte_regs($h)"
+}