gdb/riscv: Fix assertion in inferior call code
authorAndrew Burgess <andrew.burgess@embecosm.com>
Sun, 8 Apr 2018 10:08:32 +0000 (11:08 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 10 Jul 2018 11:46:56 +0000 (12:46 +0100)
commit8c49aa89abb92516dfc3507b540f736ca6339c0c
treec4752e05a8c13645a97a1289410a19c61b10fb2c
parent42ecac1732194293568ab6093c742ca74c1dbdf6
gdb/riscv: Fix assertion in inferior call code

An assertion when setting up arguments for an inferior call checks the
size of the argument against xlen.  However, if xlen and flen are
different sizes, and the argument is being placed into a floating
pointer register then we should be comparing against flen not xlen.

This issue shows up as an assertion failure when running on an rv32g
target with a binary compiled using the rv32f abi and making an
inferior call involving large floating point arguments, for example
the test gdb.base/infcall-nested-structs.exp.

gdb/ChangeLog:

* riscv-tdep.c (riscv_is_fp_regno_p): New function.
(riscv_register_reggroup_p): Use new function, remove unneeded
parenthesis.
(riscv_push_dummy_call): Extend assert to compare against xlen or
flen based on register type.
gdb/ChangeLog
gdb/riscv-tdep.c