aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2017-09-14 15:07:48 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2017-09-14 15:07:48 +0000
commit27efb0a2422308cb6ba1170bbaa32546fce5a85b (patch)
treee5c1a0ac2a9ebd01a2b81e125ca78ff6beb485b5 /usr.bin
parentca2b367f5c8deac7704e2f6e6c96c1500bc4c0c0 (diff)
downloadsrc-27efb0a2422308cb6ba1170bbaa32546fce5a85b.tar.gz
src-27efb0a2422308cb6ba1170bbaa32546fce5a85b.zip
Add a NT_ARM_VFP ELF core note to hold VFP registers for each thread.
The core note matches the format and layout of NT_ARM_VFP on Linux. Debuggers use the AT_HWCAP flags to determine how many VFP registers are actually used and their format. Reviewed by: mmel (earlier version w/o gcore) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D12293
Notes
Notes: svn path=/head/; revision=323584
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/gcore/elfcore.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/usr.bin/gcore/elfcore.c b/usr.bin/gcore/elfcore.c
index ff1010001c3f..ae52d61c9281 100644
--- a/usr.bin/gcore/elfcore.c
+++ b/usr.bin/gcore/elfcore.c
@@ -109,6 +109,9 @@ static void *elf_note_prpsinfo(void *, size_t *);
static void *elf_note_prstatus(void *, size_t *);
static void *elf_note_thrmisc(void *, size_t *);
static void *elf_note_ptlwpinfo(void *, size_t *);
+#if defined(__arm__)
+static void *elf_note_arm_vfp(void *, size_t *);
+#endif
#if defined(__i386__) || defined(__amd64__)
static void *elf_note_x86_xstate(void *, size_t *);
#endif
@@ -368,6 +371,9 @@ elf_putnotes(pid_t pid, struct sbuf *sb, size_t *sizep)
elf_putnote(NT_FPREGSET, elf_note_fpregset, tids + i, sb);
elf_putnote(NT_THRMISC, elf_note_thrmisc, tids + i, sb);
elf_putnote(NT_PTLWPINFO, elf_note_ptlwpinfo, tids + i, sb);
+#if defined(__arm__)
+ elf_putnote(NT_ARM_VFP, elf_note_arm_vfp, tids + i, sb);
+#endif
#if defined(__i386__) || defined(__amd64__)
elf_putnote(NT_X86_XSTATE, elf_note_x86_xstate, tids + i, sb);
#endif
@@ -718,6 +724,31 @@ elf_note_ptlwpinfo(void *arg, size_t *sizep)
return (p);
}
+#if defined(__arm__)
+static void *
+elf_note_arm_vfp(void *arg, size_t *sizep)
+{
+ lwpid_t tid;
+ struct vfpreg *vfp;
+ static bool has_vfp = true;
+ struct vfpreg info;
+
+ tid = *(lwpid_t *)arg;
+ if (has_vfp) {
+ if (ptrace(PT_GETVFPREGS, tid, (void *)&info, 0) != 0)
+ has_vfp = false;
+ }
+ if (!has_vfp) {
+ *sizep = 0;
+ return (NULL);
+ }
+ vfp = calloc(1, sizeof(*vfp));
+ memcpy(vfp, &info, sizeof(*vfp));
+ *sizep = sizeof(*vfp);
+ return (vfp);
+}
+#endif
+
#if defined(__i386__) || defined(__amd64__)
static void *
elf_note_x86_xstate(void *arg, size_t *sizep)