diff options
-rw-r--r-- | gdb/riscv-fbsd-nat.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gdb/riscv-fbsd-nat.c b/gdb/riscv-fbsd-nat.c index 40cb40d..ad89a19 100644 --- a/gdb/riscv-fbsd-nat.c +++ b/gdb/riscv-fbsd-nat.c @@ -19,6 +19,7 @@ #include "defs.h" #include "regcache.h" +#include "inferior.h" #include "target.h" #include <sys/types.h> @@ -34,6 +35,9 @@ struct riscv_fbsd_nat_target final : public fbsd_nat_target { void fetch_registers (struct regcache *, int) override; void store_registers (struct regcache *, int) override; +#if __has_feature(capabilities) + const struct target_desc *read_description () override; +#endif }; static riscv_fbsd_nat_target the_riscv_fbsd_nat_target; @@ -51,6 +55,11 @@ riscv_fbsd_nat_target::fetch_registers (struct regcache *regcache, &riscv_fbsd_gregset); fetch_register_set<struct fpreg> (regcache, regnum, PT_GETFPREGS, &riscv_fbsd_fpregset); +#if __has_feature(capabilities) + if (riscv_isa_clen (regcache->arch ()) != 0) + fetch_register_set<struct capreg> (regcache, regnum, PT_GETCAPREGS, + &riscv_fbsd_capregset); +#endif } /* Store register REGNUM back into the inferior. If REGNUM is -1, do @@ -64,8 +73,31 @@ riscv_fbsd_nat_target::store_registers (struct regcache *regcache, &riscv_fbsd_gregset); store_register_set<struct fpreg> (regcache, regnum, PT_GETFPREGS, PT_SETFPREGS, &riscv_fbsd_fpregset); +#ifdef notyet + if (riscv_isa_clen (regcache->arch ()) != 0) + store_register_set<struct capreg> (regcache, regnum, PT_GETCAPREGS, + PT_SETCAPREGS, &riscv_fbsd_capregset); +#endif } +#if __has_feature(capabilities) +/* Implement the read_description method. */ + +const struct target_desc * +riscv_fbsd_nat_target::read_description () +{ + struct riscv_gdbarch_features features; + struct reg *reg; + + features.xlen = sizeof (reg->ra); + features.flen = sizeof (uint64_t); + if (have_register_set<struct capreg> (inferior_ptid, PT_GETCAPREGS)) + features.clen = sizeof (uintcap_t); + + return riscv_lookup_target_description (features); +} +#endif + void _initialize_riscv_fbsd_nat (); void _initialize_riscv_fbsd_nat () |