From cd115d615c6558175a56c3d0896b6f1c62864cd1 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Mon, 5 Nov 2018 22:00:31 +0000 Subject: [PATCH] gdb/riscv: Update test to support targets without FP hardware Update gdb.arch/riscv-reg-aliases.exp test to support targets without floating point registers. gdb/testsuite/ChangeLog: * gdb.arch/riscv-reg-aliases.exp: Handle targets without floating point hardware. --- gdb/testsuite/ChangeLog | 5 ++++ gdb/testsuite/gdb.arch/riscv-reg-aliases.exp | 24 +++++++++++++++----- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index eaed8d75bbd..01fc0dbadf0 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-11-08 Andrew Burgess + + * gdb.arch/riscv-reg-aliases.exp: Handle targets without floating + point hardware. + 2018-11-07 Andrew Burgess * gdb.dwarf2/void-type.exp: Rename types, and make var_a an 'int'. diff --git a/gdb/testsuite/gdb.arch/riscv-reg-aliases.exp b/gdb/testsuite/gdb.arch/riscv-reg-aliases.exp index b4a2c982897..746ba7dda5d 100644 --- a/gdb/testsuite/gdb.arch/riscv-reg-aliases.exp +++ b/gdb/testsuite/gdb.arch/riscv-reg-aliases.exp @@ -151,17 +151,23 @@ check_zero_register_value "after write to \$x0" # we should access the register using 'REG_NAME.float'. In the following we # figure out if the field name is needed or not by looking at how GDB prints # on register. +set skip_freg_tests 0 set freg_extension "INVALID" set message "check format of float registers" -gdb_test_multiple "p \$ft0" $message { - -re " = {float = \[^\r\n\]+}\r\n$gdb_prompt $" { - set freg_extension ".float" +gdb_test_multiple "info registers \$ft0" $message { + -re "Invalid register `ft0'\r\n$gdb_prompt $" { + set skip_freg_tests 1 + set freg_extension "NONE" pass $message } - -re " = \[^{}\r\n\]+\r\n$gdb_prompt $" { + -re "ft0 \+\[0-9\]\+.*\r\n$gdb_prompt $" { set freg_extension "" pass $message } + -re "ft0 \+\{float = .*\r\n$gdb_prompt $" { + set freg_extension ".float" + pass $message + } } gdb_assert ![string eq "${freg_extension}" "INVALID"] \ "check that floating point format has been understood" @@ -169,7 +175,10 @@ gdb_assert ![string eq "${freg_extension}" "INVALID"] \ # 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 ${freg_names} ${freg_extension} + +if { ! $skip_freg_tests } { + check_setting_registers_to_zero ${freg_names} ${freg_extension} +} # Set each register in turn to a new value, and confirm that the new value can # be read back from the primary name, and from all of the alias names. The @@ -177,4 +186,7 @@ check_setting_registers_to_zero ${freg_names} ${freg_extension} # 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 ${freg_names} ${freg_extension} 500 + +if { ! $skip_freg_tests } { + check_setting_registers_to_value ${freg_names} ${freg_extension} 500 +} -- 2.30.2