aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.arch
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2009-07-13 20:16:48 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2009-07-13 20:16:48 +0000
commit8f3139231259ed3202513d7a83d0a25cb051a62a (patch)
treeaad3fe502be9bbfa3e05b21b1e79911dfd3ffc2d /gdb/testsuite/gdb.arch
parent4662c76e915914dd6fe77a4878fa9a7c8385b7d1 (diff)
downloadgdb-8f3139231259ed3202513d7a83d0a25cb051a62a.zip
gdb-8f3139231259ed3202513d7a83d0a25cb051a62a.tar.gz
gdb-8f3139231259ed3202513d7a83d0a25cb051a62a.tar.bz2
gdb/
Fix memory access from signed 32bit inferior registers on 64bit GDB. * linux-nat.c (linux_xfer_partial <TARGET_OBJECT_MEMORY>): New variable addr_bit. Mask OFFSET by the ADDR_BIT width. gdb/testsuite/ * gdb.arch/amd64-i386-address.exp, gdb.arch/amd64-i386-address.S: New.
Diffstat (limited to 'gdb/testsuite/gdb.arch')
-rw-r--r--gdb/testsuite/gdb.arch/amd64-i386-address.S24
-rw-r--r--gdb/testsuite/gdb.arch/amd64-i386-address.exp43
2 files changed, 67 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.arch/amd64-i386-address.S b/gdb/testsuite/gdb.arch/amd64-i386-address.S
new file mode 100644
index 0000000..edec656
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/amd64-i386-address.S
@@ -0,0 +1,24 @@
+/* Copyright 2009 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/>.
+
+ This file is part of the gdb testsuite. */
+
+_start: .globl _start
+ movl $0xdeadf00d, %eax
+ pushl %eax
+ movl %esp, %ebx
+ int3
+ nop
+ nop
diff --git a/gdb/testsuite/gdb.arch/amd64-i386-address.exp b/gdb/testsuite/gdb.arch/amd64-i386-address.exp
new file mode 100644
index 0000000..22ede09
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/amd64-i386-address.exp
@@ -0,0 +1,43 @@
+# Copyright 2009 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/>.
+
+# This file is part of the gdb testsuite.
+
+# Test UNsigned extension of the 32-bit inferior address on a 64-bit host.
+# On native 32-bit host the test always PASSed.
+
+if {![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"]} then {
+ verbose "Skipping amd64->i386 adress test."
+ return
+}
+
+if [prepare_for_testing amd64-i386-address.exp amd64-i386-address amd64-i386-address.S [list debug "additional_flags=-m32 -nostdlib"]] {
+ return -1
+}
+
+gdb_run_cmd
+
+set test "trap stop"
+gdb_test_multiple "" $test {
+ -re "Program received signal SIGTRAP,.*_start .*$gdb_prompt $" {
+ pass $test
+ }
+}
+
+gdb_test "x/wx \$esp" "0x\[0-9a-f\]*:\t0xdeadf00d"
+
+# Failure case would be:
+# 0xff8d7f00: Cannot access memory at address 0xff8d7f00
+gdb_test "x/wx \$ebx" "0x\[0-9a-f\]*:\t0xdeadf00d"