+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * lib/gdb.exp (get_endianness): New proc.
+ * gdb.arch/aarch64-fp.exp: Use it.
+ * gdb.arch/altivec-regs.exp: Likewise.
+ * gdb.arch/e500-regs.exp: Likewise.
+ * gdb.arch/vsx-regs.exp: Likewise.
+ * gdb.base/dump.exp: Likewise.
+ * gdb.base/funcargs.exp: Likewise.
+ * gdb.base/gnu_vector.exp: Likewise.
+ * gdb.dwarf2/formdata16.exp: Likewise.
+ * gdb.dwarf2/implptrpiece.exp: Likewise.
+ * gdb.dwarf2/nonvar-access.exp: Likewise.
+ * gdb.python/py-inferior.exp: Likewise.
+ * gdb.trace/unavailable-dwarf-piece.exp: Likewise.
+
2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
PR gdb/21226
return -1
}
-set endianness "little"
-set test "show endian"
-gdb_test_multiple $test $test {
- -re "(.* )(big|little)( endian.*)$gdb_prompt $" {
- set endianness $expect_out(2,string)
- pass "endianness"
- }
-}
+set endianness [get_endianness]
gdb_test "break ${srcfile}:[gdb_get_line_number "return"]" \
"Breakpoint $decimal at 0x\[0-9a-fA-F\]+: file .*${srcfile}.*\\\." \
gdb_test "next" "" ""
-set endianness ""
-set msg "detect endianness"
-gdb_test_multiple "show endian" "$msg" {
- -re "(The target endianness is set automatically .currently )(big|little)( endian.*)$gdb_prompt $" {
- pass "$msg"
- set endianness $expect_out(2,string)
- }
- -re ".*$gdb_prompt $" {
- fail "$msg"
- }
-}
+set endianness [get_endianness]
# And then read the AltiVec registers back, to see that
# a) the register write above worked, and
#gdb_test "next" "" ""
-send_gdb "show endian\n"
-gdb_expect {
- -re "(The target endianness is set automatically .currently )(big|little)( endian.*)$gdb_prompt $" {
- pass "endianness"
- set endianness $expect_out(2,string)
- }
- -re ".*$gdb_prompt $" {
- fail "couldn't get endianness"
- }
- timeout { fail "(timeout) endianness" }
-}
+set endianness [get_endianness]
# And then read the E500 registers back, to see that
# a) the register write above worked, and
gdb_suppress_tests
}
-set endianness ""
-set msg "detect endianness"
-gdb_test_multiple "show endian" "$msg" {
- -re "(The target endianness is set automatically .currently )(big|little)( endian.*)$gdb_prompt $" {
- pass "$msg"
- set endianness $expect_out(2,string)
- }
- -re ".*$gdb_prompt $" {
- fail "$msg"
- }
-}
+set endianness [get_endianness]
# Data sets used throughout the test
# Get the endianness for the later use with endianless formats.
-gdb_test_multiple "show endian" "show endian" {
- -re ".* (big|little) endian.*$gdb_prompt $" {
- set endian $expect_out(1,string)
- pass "endianness: $endian"
- }
-}
+set endian [get_endianness]
# Now generate some dump files.
}
}
-gdb_test_multiple "show endian" "getting target endian" {
- -re ".*little endian.*$gdb_prompt $" {
- set target_bigendian_p 0
- # pass silently
- }
- -re ".*big endian.*$gdb_prompt $" {
- set target_bigendian_p 1
- # pass silently
- }
+switch [get_endianness] {
+ little { set target_bigendian_p 0 }
+ big { set target_bigendian_p 1 }
}
# Perform tests
}
# Get endianess for the scalar->vector casts
-gdb_test_multiple "show endian" "show endian" {
- -re ".* (big|little) endian.*$gdb_prompt $" {
- set endian $expect_out(1,string)
- pass "endianness: $endian"
- }
-}
+set endian [get_endianness]
# Test printing of character vector types
gdb_test "print c4" "\\\$$decimal = \\{1, 2, 3, 4\\}"
return -1
}
-set endianness "little"
-set test "show endian"
-gdb_test_multiple $test $test {
- -re "(.* )(big|little)( endian.*)\r\n$gdb_prompt $" {
- set endianness $expect_out(2,string)
- pass "endianness"
- }
-}
+set endianness [get_endianness]
set high "0x123456789abcdef0"
set low "0x0fedcba987654321"
return -1
}
-# Determine endianness.
-set endian "little"
-gdb_test_multiple "show endian" "determine endianness" {
- -re ".* (big|little) endian.*$gdb_prompt $" {
- set endian $expect_out(1,string)
- pass "endianness: $endian"
- }
-}
+# Determine byte order.
+set endian [get_endianness]
# Access the second byte of s through an implicit pointer to the third
# byte of s, using a negative offset. Compare that to the second byte of
return -1
}
-# Determine endianness.
-set endian "little"
-gdb_test_multiple "show endian" "determine endianness" {
- -re ".* (big|little) endian.*$gdb_prompt $" {
- set endian $expect_out(1,string)
- pass "endianness: $endian"
- }
-}
+# Determine byte order.
+set endian [get_endianness]
# Byte-aligned objects with simple location descriptions.
switch $endian { big {set val 0x345678} little {set val 0x785634} }
# Skip all tests if Python scripting is not enabled.
if { [skip_python_tests] } { continue }
-gdb_test_multiple "show endian" "getting target endian" {
- -re ".*little endian.*$gdb_prompt $" {
- set python_pack_char "<"
- # pass silently
- }
- -re ".*big endian.*$gdb_prompt $" {
- set python_pack_char ">"
- # pass silently
- }
+switch [get_endianness] {
+ little { set python_pack_char "<" }
+ big { set python_pack_char ">" }
}
# The following tests require execution.
gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*"
gdb_test_no_output "tstop"
- set endian ""
- gdb_test_multiple "show endian" "show endian" {
- -re ".* (big|little) endian.*$gdb_prompt $" {
- set endian $expect_out(1,string)
- pass "endianness: $endian"
- }
- }
+ set endian [get_endianness]
gdb_test "tfind 0" "Found trace frame 0, tracepoint .*"
if { $endian == "little" } {
}
}
+# Get the target's current endianness and return it.
+proc get_endianness { } {
+ global gdb_prompt
+
+ gdb_test_multiple "show endian" "determine endianness" {
+ -re ".* (little|big) endian.*\r\n$gdb_prompt $" {
+ # Pass silently.
+ return $expect_out(1,string)
+ }
+ }
+ return "little"
+}
+
# ROOT and FULL are file names. Returns the relative path from ROOT
# to FULL. Note that FULL must be in a subdirectory of ROOT.
# For example, given ROOT = /usr/bin and FULL = /usr/bin/ls, this