aboutsummaryrefslogtreecommitdiff
path: root/gdb/arm-linux-nat.c
diff options
context:
space:
mode:
authorAlan Hayward <alan.hayward@arm.com>2019-06-25 11:04:59 +0100
committerAlan Hayward <alan.hayward@arm.com>2019-07-10 11:59:34 +0100
commit166a82be89008621a31e6e56b2d52a049b53e341 (patch)
tree485bbea510454c2f43adfbd8050f8d38c6a87fd4 /gdb/arm-linux-nat.c
parent9fb4c7e9f00accbbf92fc0b0a53978fd50ff6bb0 (diff)
downloadgdb-166a82be89008621a31e6e56b2d52a049b53e341.zip
gdb-166a82be89008621a31e6e56b2d52a049b53e341.tar.gz
gdb-166a82be89008621a31e6e56b2d52a049b53e341.tar.bz2
Arm: Minor style cleanups
*When reading a target description, do the ptrace check before picking the target description. *In wmmxregset functions, declare the counter inside the for. *Call arm_linux_init_hwbp_cap from in arm_arch_setup - it doesn't belong in arm_read_description. gdb/ChangeLog: * arm-linux-nat.c (arm_linux_nat_target::read_description): Check ptrace earlier, gdb/gdbserver/ChangeLog: * linux-arm-low.c (arm_fill_wmmxregset, arm_store_wmmxregset): Move counter inside for. (arm_read_description): Check ptrace earlier. (arm_arch_setup): Call arm_linux_init_hwbp_cap here.
Diffstat (limited to 'gdb/arm-linux-nat.c')
-rw-r--r--gdb/arm-linux-nat.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index a1ad6fe..fe8a113 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -555,29 +555,22 @@ arm_linux_nat_target::read_description ()
if (arm_hwcap & HWCAP_VFP)
{
- int pid;
- char *buf;
- const struct target_desc * result = NULL;
+ /* Make sure that the kernel supports reading VFP registers. Support was
+ added in 2.6.30. */
+ int pid = inferior_ptid.lwp ();
+ errno = 0;
+ char *buf = (char *) alloca (ARM_VFP3_REGS_SIZE);
+ if (ptrace (PTRACE_GETVFPREGS, pid, 0, buf) < 0 && errno == EIO)
+ return nullptr;
/* NEON implies VFPv3-D32 or no-VFP unit. Say that we only support
Neon with VFPv3-D32. */
if (arm_hwcap & HWCAP_NEON)
- result = tdesc_arm_with_neon;
+ return tdesc_arm_with_neon;
else if ((arm_hwcap & (HWCAP_VFPv3 | HWCAP_VFPv3D16)) == HWCAP_VFPv3)
- result = tdesc_arm_with_vfpv3;
+ return tdesc_arm_with_vfpv3;
else
- result = tdesc_arm_with_vfpv2;
-
- /* Now make sure that the kernel supports reading these
- registers. Support was added in 2.6.30. */
- pid = inferior_ptid.lwp ();
- errno = 0;
- buf = (char *) alloca (ARM_VFP3_REGS_SIZE);
- if (ptrace (PTRACE_GETVFPREGS, pid, 0, buf) < 0
- && errno == EIO)
- result = NULL;
-
- return result;
+ return tdesc_arm_with_vfpv2;
}
return this->beneath ()->read_description ();