X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fsparc-ravenscar-thread.c;h=c619f6e3c10c917c8231b833b5350434097f8b97;hb=3844e605e61777555aed09ab8ce88db2da95bc0b;hp=28d64f9fd0ccedd3e9528622b26e790c2260df88;hpb=ac7936dfd0c85e5de2dfec45ca0dbf72baeffa51;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/sparc-ravenscar-thread.c b/gdb/sparc-ravenscar-thread.c index 28d64f9fd0..c619f6e3c1 100644 --- a/gdb/sparc-ravenscar-thread.c +++ b/gdb/sparc-ravenscar-thread.c @@ -1,6 +1,6 @@ /* Ravenscar SPARC target support. - Copyright (C) 2004-2017 Free Software Foundation, Inc. + Copyright (C) 2004-2019 Free Software Foundation, Inc. This file is part of GDB. @@ -25,11 +25,11 @@ #include "ravenscar-thread.h" #include "sparc-ravenscar-thread.h" -static void sparc_ravenscar_fetch_registers (struct regcache *regcache, - int regnum); -static void sparc_ravenscar_store_registers (struct regcache *regcache, - int regnum); -static void sparc_ravenscar_prepare_to_store (struct regcache *regcache); +struct sparc_ravenscar_ops : public ravenscar_arch_ops +{ + void fetch_registers (struct regcache *, int) override; + void store_registers (struct regcache *, int) override; +}; /* Register offsets from a referenced address (exempli gratia the Thread_Descriptor). The referenced address depends on the register @@ -68,7 +68,7 @@ supply_register_at_address (struct regcache *regcache, int regnum, buf = (gdb_byte *) alloca (buf_size); read_memory (register_addr, buf, buf_size); - regcache_raw_supply (regcache, regnum, buf); + regcache->raw_supply (regnum, buf); } /* Return true if, for a non-running thread, REGNUM has been saved on the @@ -100,8 +100,8 @@ register_in_thread_descriptor_p (int regnum) /* to_fetch_registers when inferior_ptid is different from the running thread. */ -static void -sparc_ravenscar_fetch_registers (struct regcache *regcache, int regnum) +void +sparc_ravenscar_ops::fetch_registers (struct regcache *regcache, int regnum) { struct gdbarch *gdbarch = regcache->arch (); const int sp_regnum = gdbarch_sp_regnum (gdbarch); @@ -112,7 +112,7 @@ sparc_ravenscar_fetch_registers (struct regcache *regcache, int regnum) ULONGEST stack_address; /* The tid is the thread_id field, which is a pointer to the thread. */ - thread_descriptor_address = (CORE_ADDR) ptid_get_tid (inferior_ptid); + thread_descriptor_address = (CORE_ADDR) inferior_ptid.tid (); /* Read the saved SP in the context buffer. */ current_address = thread_descriptor_address @@ -140,20 +140,11 @@ sparc_ravenscar_fetch_registers (struct regcache *regcache, int regnum) } } -/* to_prepare_to_store when inferior_ptid is different from the running - thread. */ - -static void -sparc_ravenscar_prepare_to_store (struct regcache *regcache) -{ - /* Nothing to do. */ -} - /* to_store_registers when inferior_ptid is different from the running thread. */ -static void -sparc_ravenscar_store_registers (struct regcache *regcache, int regnum) +void +sparc_ravenscar_ops::store_registers (struct regcache *regcache, int regnum) { struct gdbarch *gdbarch = regcache->arch (); int buf_size = register_size (gdbarch, regnum); @@ -162,7 +153,7 @@ sparc_ravenscar_store_registers (struct regcache *regcache, int regnum) if (register_in_thread_descriptor_p (regnum)) register_address = - ptid_get_tid (inferior_ptid) + sparc_register_offsets [regnum]; + inferior_ptid.tid () + sparc_register_offsets [regnum]; else if (register_on_stack_p (regnum)) { regcache_cooked_read_unsigned (regcache, SPARC_SP_REGNUM, @@ -172,18 +163,13 @@ sparc_ravenscar_store_registers (struct regcache *regcache, int regnum) else return; - regcache_raw_collect (regcache, regnum, buf); + regcache->raw_collect (regnum, buf); write_memory (register_address, buf, buf_size); } -static struct ravenscar_arch_ops sparc_ravenscar_ops = -{ - sparc_ravenscar_fetch_registers, - sparc_ravenscar_store_registers, - sparc_ravenscar_prepare_to_store -}; +static struct sparc_ravenscar_ops sparc_ravenscar_ops; /* Register ravenscar_arch_ops in GDBARCH. */