summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Webb <swebb@blackberry.com>2022-07-05 21:22:36 -0400
committerStephen M. Webb <stephen.webb@bregmasoft.ca>2022-07-15 14:25:48 -0400
commit958efd8150db6ea57a995f4fd07d9f707693c3d4 (patch)
tree6cb3426181f79d87dbc62a58cd2f17c3ba174767
parent4640cd26d5e045b738bacc20ed92a7cf8e801c0f (diff)
downloadlibunwind-958efd8150db6ea57a995f4fd07d9f707693c3d4.tar.gz
Autodetect presence of elf_fpregset_t
Data of this type was added for the s390x port doesn't exists on all OSes. It needs to be autodetected and optioned out. Fixes #373
-rw-r--r--configure.ac2
-rw-r--r--src/coredump/_UCD_create.c4
-rw-r--r--src/coredump/_UCD_get_threadinfo_prstatus.c2
-rw-r--r--src/coredump/_UCD_internal.h4
4 files changed, 11 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index bc4bef3a..cf908365 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,7 +48,7 @@ AC_CHECK_SIZEOF(off_t)
CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE"
AC_CHECK_MEMBERS([struct dl_phdr_info.dlpi_subs],,,[#include <link.h>])
-AC_CHECK_TYPES([struct elf_prstatus, struct prstatus, procfs_status], [], [],
+AC_CHECK_TYPES([struct elf_prstatus, struct prstatus, procfs_status, elf_fpregset_t], [], [],
[$ac_includes_default
#if HAVE_SYS_PROCFS_H
# include <sys/procfs.h>
diff --git a/src/coredump/_UCD_create.c b/src/coredump/_UCD_create.c
index 9994b6cb..e5ccd356 100644
--- a/src/coredump/_UCD_create.c
+++ b/src/coredump/_UCD_create.c
@@ -219,7 +219,9 @@ _UCD_create(const char *filename)
}
ui->prstatus = &ui->threads[0].prstatus;
+#ifdef HAVE_ELF_FPREGSET_T
ui->fpregset = &ui->threads[0].fpregset;
+#endif
return ui;
@@ -237,7 +239,9 @@ void _UCD_select_thread(struct UCD_info *ui, int n)
{
if (n >= 0 && n < ui->n_threads) {
ui->prstatus = &ui->threads[n].prstatus;
+#ifdef HAVE_ELF_FPREGSET_T
ui->fpregset = &ui->threads[n].fpregset;
+#endif
}
}
diff --git a/src/coredump/_UCD_get_threadinfo_prstatus.c b/src/coredump/_UCD_get_threadinfo_prstatus.c
index 50833d84..4644d1b1 100644
--- a/src/coredump/_UCD_get_threadinfo_prstatus.c
+++ b/src/coredump/_UCD_get_threadinfo_prstatus.c
@@ -67,7 +67,9 @@ _save_thread_notes(uint32_t n_namesz, uint32_t n_descsz, uint32_t n_type, char *
}
if (n_type == NT_FPREGSET)
{
+#ifdef HAVE_ELF_FPREGSET_T
memcpy(&ui->threads[ui->n_threads-1].fpregset, desc, sizeof(elf_fpregset_t));
+#endif
}
return UNW_ESUCCESS;
}
diff --git a/src/coredump/_UCD_internal.h b/src/coredump/_UCD_internal.h
index 6ac04b9e..d5a36f6b 100644
--- a/src/coredump/_UCD_internal.h
+++ b/src/coredump/_UCD_internal.h
@@ -90,7 +90,9 @@ typedef procfs_status UCD_proc_status_t;
struct UCD_thread_info
{
UCD_proc_status_t prstatus;
+#ifdef HAVE_ELF_FPREGSET_T
elf_fpregset_t fpregset;
+#endif
};
struct UCD_info
@@ -102,7 +104,9 @@ struct UCD_info
unsigned phdrs_count;
void *note_phdr; /* allocated or NULL */
UCD_proc_status_t *prstatus; /* points inside note_phdr */
+#ifdef HAVE_ELF_FPREGSET_T
elf_fpregset_t *fpregset;
+#endif
int n_threads;
struct UCD_thread_info *threads;
struct elf_dyn_info edi;