# and we need to read/write using a ".float" extension. This is passed in
# REG_EXTENSION. If no extension is needed then REG_EXTENSION is the empty
# string.
-proc check_setting_registers_to_zero { reg_set reg_extension } {
+#
+# PRINT_FMT is used when inspecting the registers, and should be a
+# character that can be used in a GDB print command as an output
+# format, e.g. 'd' (decimal), or 'f' (float).
+proc check_setting_registers_to_zero { reg_set reg_extension print_fmt } {
foreach reg_desc ${reg_set} {
set primary_name [lindex ${reg_desc} 0]
set alias_names [lindex ${reg_desc} 1]
gdb_test_no_output "set \$${primary_name}${reg_extension} = 0" \
"set register ${primary_name} to an initial value of zero"
- gdb_test "p/d \$${primary_name}${reg_extension}" " = 0" \
+ gdb_test "p/${print_fmt} \$${primary_name}${reg_extension}" " = 0" \
"check the initial value of ${primary_name} is now zero"
foreach reg_alias ${alias_names} {
- gdb_test "p/d \$${reg_alias}${reg_extension}" " = 0" \
+ gdb_test "p/${print_fmt} \$${reg_alias}${reg_extension}" " = 0" \
"check the initial value of ${reg_alias} is now zero"
}
}
# of the aliases.
#
# The REG_EXTENSION field is used as in CHECK_SETTING_REGISTERS_TO_ZERO.
-proc check_setting_registers_to_value { reg_set reg_extension reg_value } {
+#
+# PRINT_FMT is used when inspecting the registers, and should be a
+# character that can be used in a GDB print command as an output
+# format, e.g. 'd' (decimal), or 'f' (float).
+proc check_setting_registers_to_value { reg_set reg_extension reg_value print_fmt } {
foreach reg_desc ${reg_set} {
set primary_name [lindex ${reg_desc} 0]
set alias_names [lindex ${reg_desc} 1]
set reg_value [incr reg_value]
gdb_test_no_output "set \$${primary_name}${reg_extension} = $reg_value" \
"write non-zero value to ${primary_name}"
- gdb_test "p/d \$${primary_name}${reg_extension}" " = $reg_value" \
+ gdb_test "p/${print_fmt} \$${primary_name}${reg_extension}" " = $reg_value" \
"read ${primary_name} after non-zero write to ${primary_name}"
foreach reg_alias ${alias_names} {
- gdb_test "p/d \$${reg_alias}${reg_extension}" " = $reg_value" \
+ gdb_test "p/${print_fmt} \$${reg_alias}${reg_extension}" " = $reg_value" \
"read ${reg_alias} after non-zero write to ${primary_name}"
}
gdb_test_no_output "set \$${reg_alias}${reg_extension} = $reg_value" \
"write non-zero value to ${reg_alias}"
- gdb_test "p/d \$${primary_name}${reg_extension}" " = $reg_value" \
+ gdb_test "p/${print_fmt} \$${primary_name}${reg_extension}" " = $reg_value" \
"read ${primary_name} after non-zero write to ${reg_alias}"
foreach other_reg_alias ${alias_names} {
- gdb_test "p/d \$${other_reg_alias}${reg_extension}" " = $reg_value" \
+ gdb_test "p/${print_fmt} \$${other_reg_alias}${reg_extension}" " = $reg_value" \
"read ${other_reg_alias} after non-zero write to ${reg_alias}"
}
}
# Now check that we can write zero, and read zero back to all of the integer
# and floating point registers.
-check_setting_registers_to_zero ${xreg_names} ""
+check_setting_registers_to_zero ${xreg_names} "" "d"
if { ! $skip_freg_tests } {
- check_setting_registers_to_zero ${freg_names} ${freg_extension}
+ check_setting_registers_to_zero ${freg_names} ${freg_extension} "f"
}
# Set each register in turn to a new value, and confirm that the new value can
# value passed in to each test invocation here is arbitrary, they are
# significantly different so that the float tests don't reuse value from the
# integer tests.
-check_setting_registers_to_value ${xreg_names} "" 100
+check_setting_registers_to_value ${xreg_names} "" 100 "d"
if { ! $skip_freg_tests } {
- check_setting_registers_to_value ${freg_names} ${freg_extension} 500
+ check_setting_registers_to_value ${freg_names} ${freg_extension} 500 "f"
}