gdb/riscv: Improve support for matching against target descriptions
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.arch / s390-vregs.exp
index 7d3c9bb7d03a03b85e20ff152e2e494df97938a9..88414345b6d9da34977c0711450971049b8abb96 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2015 Free Software Foundation, Inc.
+# Copyright 2015-2020 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
@@ -29,7 +29,7 @@ if [isnative] {
     remote_exec build "mkdir $coredir"
 }
 
-if { [prepare_for_testing ${testfile}.exp $testfile $srcfile \
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
          [list "additional_flags=-mzarch"]] } {
     return -1
 }
@@ -83,9 +83,9 @@ if [expr $before_pc + 6 != $after_pc] {
 # directory.
 
 if { $coredir != "" } {
-    gdb_test {print setrlimit (4, &(unsigned long [2]){~0UL, ~0UL})} \
+    gdb_test {print (int) setrlimit (4, &(unsigned long [2]){~0UL, ~0UL})} \
        " = .*" "setrlimit"
-    gdb_test "print chdir (\"${coredir}\")" " = 0" "chdir"
+    gdb_test "print (int) chdir (\"${coredir}\")" " = 0" "chdir"
 }
 
 # Initialize all vector registers with GDB "set" commands, using
@@ -146,12 +146,21 @@ if { $i != 32 } {
 gdb_continue_to_breakpoint "change vrs"
 set vregs [capture_command_output "info registers vector" ""]
 
+# Format a 128-bit value, given individual 4-byte values, as hex.
+# Suppress leading zeros.
+proc hex128 {a_high a_low b_high b_low} {
+    set result [format "%x%08x%08x%08x" $a_high $a_low $b_high $b_low]
+    regsub -- "^0*" $result "" result
+    if { $result eq "" } { set result 0 }
+    return $result
+}
+
 set j 1
 foreach {- r i val} [regexp -all -inline -line \
                         {^(\D*)(\d+)\s+.*?uint128 = 0x([0-9a-f]+?)} $vregs] {
     if { $r ne "v" } {
        fail "info registers vector: bad line $j"
-    } elseif { $val ne [format %08x%08x%08x%08x \
+    } elseif { $val ne [hex128 \
                            [expr $a_high * ($i + 1) * $a_high ] \
                            [expr $a_low * ($i + 1) * $a_low ] \
                            [expr $b_high * (32 - $i) * $b_high * 32] \
This page took 0.026736 seconds and 4 git commands to generate.