X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=gdb%2Farm-fbsd-nat.c;h=b161b7ed9080895702dd253f246b484f5f7e66d7;hb=2ab317fb8290ea96bdb446957d2e221634fd25c8;hp=f9fb8e1999a9c49d257efc50f2d38ec98e89db1f;hpb=f9e5d80cf75c4c549c392b6bb1bd33e103824657;p=binutils-gdb.git diff --git a/gdb/arm-fbsd-nat.c b/gdb/arm-fbsd-nat.c index f9fb8e1999a..b161b7ed908 100644 --- a/gdb/arm-fbsd-nat.c +++ b/gdb/arm-fbsd-nat.c @@ -1,6 +1,6 @@ /* Native-dependent code for FreeBSD/arm. - Copyright (C) 2017-2021 Free Software Foundation, Inc. + Copyright (C) 2017-2022 Free Software Foundation, Inc. This file is part of GDB. @@ -18,13 +18,17 @@ along with this program. If not, see . */ #include "defs.h" +#include "inferior.h" #include "target.h" +#include "elf/common.h" + #include #include #include #include "fbsd-nat.h" +#include "arm-tdep.h" #include "arm-fbsd-tdep.h" #include "inf-ptrace.h" @@ -49,6 +53,27 @@ arm_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum) fetch_register_set (regcache, regnum, PT_GETVFPREGS, &arm_fbsd_vfpregset); #endif +#ifdef PT_GETREGSET + gdbarch *gdbarch = regcache->arch (); + arm_gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + if (tdep->tls_regnum > 0) + { + const struct regcache_map_entry arm_fbsd_tlsregmap[] = + { + { 1, tdep->tls_regnum, 4 }, + { 0 } + }; + + const struct regset arm_fbsd_tlsregset = + { + arm_fbsd_tlsregmap, + regcache_supply_regset, regcache_collect_regset + }; + + fetch_regset (regcache, regnum, NT_ARM_TLS, &arm_fbsd_tlsregset); + } +#endif } /* Store register REGNUM back into the inferior. If REGNUM is -1, do @@ -63,6 +88,27 @@ arm_fbsd_nat_target::store_registers (struct regcache *regcache, int regnum) store_register_set (regcache, regnum, PT_GETVFPREGS, PT_SETVFPREGS, &arm_fbsd_vfpregset); #endif +#ifdef PT_GETREGSET + gdbarch *gdbarch = regcache->arch (); + arm_gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + if (tdep->tls_regnum > 0) + { + const struct regcache_map_entry arm_fbsd_tlsregmap[] = + { + { 1, tdep->tls_regnum, 4 }, + { 0 } + }; + + const struct regset arm_fbsd_tlsregset = + { + arm_fbsd_tlsregmap, + regcache_supply_regset, regcache_collect_regset + }; + + store_regset (regcache, regnum, NT_ARM_TLS, &arm_fbsd_tlsregset); + } +#endif } /* Implement the to_read_description method. */ @@ -71,8 +117,12 @@ const struct target_desc * arm_fbsd_nat_target::read_description () { const struct target_desc *desc; + bool tls = false; - desc = arm_fbsd_read_description_auxv (this); +#ifdef PT_GETREGSET + tls = have_regset (inferior_ptid, NT_ARM_TLS) != 0; +#endif + desc = arm_fbsd_read_description_auxv (this, tls); if (desc == NULL) desc = this->beneath ()->read_description (); return desc;