aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-12-20 08:41:55 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-01-06 07:59:49 -0300
commit65ccd641bacea33be23d51da737c2de7543d0f5e (patch)
treea3dbd16426b4a51dcb8450ede9d47c5a90e58a66 /sysdeps/unix/sysv/linux
parentc1fc366ec9e78e17ad3e2ecdb4c4cc662decc32b (diff)
downloadglibc-65ccd641bacea33be23d51da737c2de7543d0f5e.tar.xz
glibc-65ccd641bacea33be23d51da737c2de7543d0f5e.zip
debug: Remove catchsegv and libSegfault (BZ #14913)
Trapping SIGSEGV within the process is error-prone, adds security issues, and modern analysis design tends to happen out of the process (either by attaching a debugger or by post-mortem analysis). The libSegfault also has some design problems, it uses non async-signal-safe function (backtrace) on signal handler. There are multiple alternatives if users do want to use similar functionality, such as sigsegv gnulib module or libsegfault.
Diffstat (limited to 'sysdeps/unix/sysv/linux')
-rw-r--r--sysdeps/unix/sysv/linux/alpha/register-dump.h239
-rw-r--r--sysdeps/unix/sysv/linux/arm/register-dump.h135
-rw-r--r--sysdeps/unix/sysv/linux/csky/register-dump.h190
-rw-r--r--sysdeps/unix/sysv/linux/i386/register-dump.h250
-rw-r--r--sysdeps/unix/sysv/linux/ia64/register-dump.h180
-rw-r--r--sysdeps/unix/sysv/linux/m68k/register-dump.h176
-rw-r--r--sysdeps/unix/sysv/linux/mips/register-dump.h120
-rw-r--r--sysdeps/unix/sysv/linux/riscv/register-dump.h63
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/register-dump.h128
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/register-dump.h131
-rw-r--r--sysdeps/unix/sysv/linux/segfault.c2
-rw-r--r--sysdeps/unix/sysv/linux/sh/register-dump.h263
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/register-dump.h342
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/register-dump.h273
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/register-dump.h345
15 files changed, 0 insertions, 2837 deletions
diff --git a/sysdeps/unix/sysv/linux/alpha/register-dump.h b/sysdeps/unix/sysv/linux/alpha/register-dump.h
deleted file mode 100644
index 5ecdd0c2ac..0000000000
--- a/sysdeps/unix/sysv/linux/alpha/register-dump.h
+++ /dev/null
@@ -1,239 +0,0 @@
-/* Dump registers.
- Copyright (C) 2004-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <string.h>
-#include <ucontext.h>
-#include <sys/uio.h>
-#include <_itoa.h>
-
-/* We will print the register dump in this format:
-
- V0: XXXXXXXXXXXXXXXX T0: XXXXXXXXXXXXXXXX T1: XXXXXXXXXXXXXXXX
- T2: XXXXXXXXXXXXXXXX T3: XXXXXXXXXXXXXXXX T4: XXXXXXXXXXXXXXXX
- T5: XXXXXXXXXXXXXXXX T6: XXXXXXXXXXXXXXXX T7: XXXXXXXXXXXXXXXX
- S0: XXXXXXXXXXXXXXXX S1: XXXXXXXXXXXXXXXX S2: XXXXXXXXXXXXXXXX
- S3: XXXXXXXXXXXXXXXX S4: XXXXXXXXXXXXXXXX S5: XXXXXXXXXXXXXXXX
- S6: XXXXXXXXXXXXXXXX A0: XXXXXXXXXXXXXXXX A1: XXXXXXXXXXXXXXXX
- A2: XXXXXXXXXXXXXXXX A3: XXXXXXXXXXXXXXXX A4: XXXXXXXXXXXXXXXX
- A5: XXXXXXXXXXXXXXXX T8: XXXXXXXXXXXXXXXX T9: XXXXXXXXXXXXXXXX
- T10: XXXXXXXXXXXXXXXX T11: XXXXXXXXXXXXXXXX RA: XXXXXXXXXXXXXXXX
- T12: XXXXXXXXXXXXXXXX AT: XXXXXXXXXXXXXXXX GP: XXXXXXXXXXXXXXXX
- SP: XXXXXXXXXXXXXXXX PC: XXXXXXXXXXXXXXXX
-
- FP0: XXXXXXXXXXXXXXXX FP1: XXXXXXXXXXXXXXXX FP2: XXXXXXXXXXXXXXXX
- FP3: XXXXXXXXXXXXXXXX FP4: XXXXXXXXXXXXXXXX FP5: XXXXXXXXXXXXXXXX
- FP6: XXXXXXXXXXXXXXXX FP7: XXXXXXXXXXXXXXXX FP8: XXXXXXXXXXXXXXXX
- FP9: XXXXXXXXXXXXXXXX FP10: XXXXXXXXXXXXXXXX FP11: XXXXXXXXXXXXXXXX
- FP12: XXXXXXXXXXXXXXXX FP13: XXXXXXXXXXXXXXXX FP14: XXXXXXXXXXXXXXXX
- FP15: XXXXXXXXXXXXXXXX FP16: XXXXXXXXXXXXXXXX FP17: XXXXXXXXXXXXXXXX
- FP18: XXXXXXXXXXXXXXXX FP19: XXXXXXXXXXXXXXXX FP20: XXXXXXXXXXXXXXXX
- FP21: XXXXXXXXXXXXXXXX FP22: XXXXXXXXXXXXXXXX FP23: XXXXXXXXXXXXXXXX
- FP24: XXXXXXXXXXXXXXXX FP25: XXXXXXXXXXXXXXXX FP26: XXXXXXXXXXXXXXXX
- FP27: XXXXXXXXXXXXXXXX FP28: XXXXXXXXXXXXXXXX FP29: XXXXXXXXXXXXXXXX
- FP30: XXXXXXXXXXXXXXXX FPCR: XXXXXXXXXXXXXXXX
-
- TA0: XXXXXXXXXXXXXXXX TA1: XXXXXXXXXXXXXXXX TA2: XXXXXXXXXXXXXXXX
-*/
-
-static void
-hexvalue (unsigned long int value, char *buf, size_t len)
-{
- char *cp = _itoa_word (value, buf + len, 16, 0);
- while (cp > buf)
- *--cp = '0';
-}
-
-static void
-register_dump (int fd, struct ucontext_t *ctx)
-{
- struct iovec iov[31 * 2 + 2 /* REGS + PC. */
- + 31 * 2 + 2 /* FREGS + FPCR. */
- + (3 * 2) /* TA0, TA1, TA3. */
- + 1 /* '\n'. */];
- size_t nr = 0;
-
-#define ADD_STRING(str) \
- iov[nr].iov_base = (char *) str; \
- iov[nr].iov_len = strlen (str); \
- ++nr
-#define ADD_MEM(str, len) \
- iov[nr].iov_base = str; \
- iov[nr].iov_len = len; \
- ++nr
-
- char regs[31][16];
- char pc[16];
- for (int i = 0; i < 31; i++)
- hexvalue (ctx->uc_mcontext.sc_regs[i], regs[i], 16);
- hexvalue (ctx->uc_mcontext.sc_pc, pc, 16);
-
- /* Generate the output. */
- ADD_STRING ("Register dump:\n\n V0: ");
- ADD_MEM (regs[0], 16);
- ADD_STRING (" T0: ");
- ADD_MEM (regs[1], 16);
- ADD_STRING (" T1: ");
- ADD_MEM (regs[2], 16);
- ADD_STRING ("\n T2: ");
- ADD_MEM (regs[3], 16);
- ADD_STRING (" T3: ");
- ADD_MEM (regs[4], 16);
- ADD_STRING (" T4: ");
- ADD_MEM (regs[5], 16);
- ADD_STRING ("\n T5: ");
- ADD_MEM (regs[6], 16);
- ADD_STRING (" T6: ");
- ADD_MEM (regs[7], 16);
- ADD_STRING (" T7: ");
- ADD_MEM (regs[8], 16);
- ADD_STRING ("\n S0: ");
- ADD_MEM (regs[9], 16);
- ADD_STRING (" S1: ");
- ADD_MEM (regs[10], 16);
- ADD_STRING (" S2: ");
- ADD_MEM (regs[11], 16);
- ADD_STRING ("\n S3: ");
- ADD_MEM (regs[12], 16);
- ADD_STRING (" S4: ");
- ADD_MEM (regs[13], 16);
- ADD_STRING (" S5: ");
- ADD_MEM (regs[14], 16);
- ADD_STRING ("\n S6: ");
- ADD_MEM (regs[15], 16);
- ADD_STRING (" A0: ");
- ADD_MEM (regs[16], 16);
- ADD_STRING (" A1: ");
- ADD_MEM (regs[17], 16);
- ADD_STRING ("\n A2: ");
- ADD_MEM (regs[18], 16);
- ADD_STRING (" A3: ");
- ADD_MEM (regs[19], 16);
- ADD_STRING (" A4: ");
- ADD_MEM (regs[20], 16);
- ADD_STRING ("\n A5: ");
- ADD_MEM (regs[21], 16);
- ADD_STRING (" T8: ");
- ADD_MEM (regs[22], 16);
- ADD_STRING (" T9: ");
- ADD_MEM (regs[23], 16);
- ADD_STRING ("\n T10: ");
- ADD_MEM (regs[24], 16);
- ADD_STRING (" T11: ");
- ADD_MEM (regs[25], 16);
- ADD_STRING (" RA: ");
- ADD_MEM (regs[26], 16);
- ADD_STRING ("\n T12: ");
- ADD_MEM (regs[27], 16);
- ADD_STRING (" AT: ");
- ADD_MEM (regs[28], 16);
- ADD_STRING (" GP: ");
- ADD_MEM (regs[29], 16);
- ADD_STRING ("\n SP: ");
- ADD_MEM (regs[30], 16);
- ADD_STRING (" PC: ");
- ADD_MEM (pc, 16);
-
- char fpregs[31][16];
- char fpcr[16];
- for (int i = 0; i < 31; i++)
- hexvalue (ctx->uc_mcontext.sc_fpregs[i], fpregs[i], 16);
- hexvalue (ctx->uc_mcontext.sc_fpcr, fpcr, 16);
-
- ADD_STRING ("\n\n FP0: ");
- ADD_MEM (fpregs[0], 16);
- ADD_STRING (" FP1: ");
- ADD_MEM (fpregs[1], 16);
- ADD_STRING (" FP2: ");
- ADD_MEM (fpregs[2], 16);
- ADD_STRING ("\n FP3: ");
- ADD_MEM (fpregs[3], 16);
- ADD_STRING (" FP4: ");
- ADD_MEM (fpregs[4], 16);
- ADD_STRING (" FP5: ");
- ADD_MEM (fpregs[5], 16);
- ADD_STRING ("\n FP6: ");
- ADD_MEM (fpregs[6], 16);
- ADD_STRING (" FP7: ");
- ADD_MEM (fpregs[7], 16);
- ADD_STRING (" FP8: ");
- ADD_MEM (fpregs[8], 16);
- ADD_STRING ("\n FP9: ");
- ADD_MEM (fpregs[9], 16);
- ADD_STRING (" FP10: ");
- ADD_MEM (fpregs[10], 16);
- ADD_STRING (" FP11: ");
- ADD_MEM (fpregs[11], 16);
- ADD_STRING ("\n FP12: ");
- ADD_MEM (fpregs[12], 16);
- ADD_STRING (" FP13: ");
- ADD_MEM (fpregs[13], 16);
- ADD_STRING (" FP14: ");
- ADD_MEM (fpregs[14], 16);
- ADD_STRING ("\n FP15: ");
- ADD_MEM (fpregs[15], 16);
- ADD_STRING (" FP16: ");
- ADD_MEM (fpregs[16], 16);
- ADD_STRING (" FP17: ");
- ADD_MEM (fpregs[17], 16);
- ADD_STRING ("\n FP18: ");
- ADD_MEM (fpregs[18], 16);
- ADD_STRING (" FP19: ");
- ADD_MEM (fpregs[19], 16);
- ADD_STRING (" FP20: ");
- ADD_MEM (fpregs[20], 16);
- ADD_STRING ("\n FP21: ");
- ADD_MEM (fpregs[21], 16);
- ADD_STRING (" FP22: ");
- ADD_MEM (fpregs[22], 16);
- ADD_STRING (" FP23: ");
- ADD_MEM (fpregs[23], 16);
- ADD_STRING ("\n FP24: ");
- ADD_MEM (fpregs[24], 16);
- ADD_STRING (" FP25: ");
- ADD_MEM (fpregs[25], 16);
- ADD_STRING (" FP26: ");
- ADD_MEM (fpregs[26], 16);
- ADD_STRING ("\n FP27: ");
- ADD_MEM (fpregs[27], 16);
- ADD_STRING (" FP28: ");
- ADD_MEM (fpregs[28], 16);
- ADD_STRING (" FP29: ");
- ADD_MEM (fpregs[29], 16);
- ADD_STRING ("\n FP30: ");
- ADD_MEM (fpregs[30], 16);
- ADD_STRING (" FPCR: ");
- ADD_MEM (fpcr, 16);
-
- char traparg[3][16];
- hexvalue (ctx->uc_mcontext.sc_traparg_a0, traparg[0], 16);
- hexvalue (ctx->uc_mcontext.sc_traparg_a1, traparg[1], 16);
- hexvalue (ctx->uc_mcontext.sc_traparg_a2, traparg[2], 16);
- ADD_STRING ("\n\n TA0: ");
- ADD_MEM (traparg[0], 16);
- ADD_STRING (" TA1: ");
- ADD_MEM (traparg[1], 16);
- ADD_STRING (" TA2: ");
- ADD_MEM (traparg[2], 16);
-
- ADD_STRING ("\n");
-
- /* Write the stuff out. */
- writev (fd, iov, nr);
-}
-
-#define REGISTER_DUMP register_dump (fd, ctx)
diff --git a/sysdeps/unix/sysv/linux/arm/register-dump.h b/sysdeps/unix/sysv/linux/arm/register-dump.h
deleted file mode 100644
index 1cbdbe38e1..0000000000
--- a/sysdeps/unix/sysv/linux/arm/register-dump.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* Dump registers.
- Copyright (C) 1998-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <sys/uio.h>
-#include <_itoa.h>
-#include <sys/ucontext.h>
-
-/* We will print the register dump in this format:
-
- R0: XXXXXXXX R1: XXXXXXXX R2: XXXXXXXX R3: XXXXXXXX
- R4: XXXXXXXX R5: XXXXXXXX R6: XXXXXXXX R7: XXXXXXXX
- R8: XXXXXXXX R9: XXXXXXXX SL: XXXXXXXX FP: XXXXXXXX
- IP: XXXXXXXX SP: XXXXXXXX LR: XXXXXXXX PC: XXXXXXXX
-
- CPSR: XXXXXXXX
-
- Trap: XXXXXXXX Error: XXXXXXXX OldMask: XXXXXXXX
- Addr: XXXXXXXX
-
- */
-
-static void
-hexvalue (unsigned long int value, char *buf, size_t len)
-{
- char *cp = _itoa_word (value, buf + len, 16, 0);
- while (cp > buf)
- *--cp = '0';
-}
-
-static void
-register_dump (int fd, const ucontext_t *ctx)
-{
- char regs[21][8];
- struct iovec iov[97];
- size_t nr = 0;
-
-#define ADD_STRING(str) \
- iov[nr].iov_base = (char *) str; \
- iov[nr].iov_len = strlen (str); \
- ++nr
-#define ADD_MEM(str, len) \
- iov[nr].iov_base = str; \
- iov[nr].iov_len = len; \
- ++nr
-
- /* Generate strings of register contents. */
- hexvalue (ctx->uc_mcontext.arm_r0, regs[0], 8);
- hexvalue (ctx->uc_mcontext.arm_r1, regs[1], 8);
- hexvalue (ctx->uc_mcontext.arm_r2, regs[2], 8);
- hexvalue (ctx->uc_mcontext.arm_r3, regs[3], 8);
- hexvalue (ctx->uc_mcontext.arm_r4, regs[4], 8);
- hexvalue (ctx->uc_mcontext.arm_r5, regs[5], 8);
- hexvalue (ctx->uc_mcontext.arm_r6, regs[6], 8);
- hexvalue (ctx->uc_mcontext.arm_r7, regs[7], 8);
- hexvalue (ctx->uc_mcontext.arm_r8, regs[8], 8);
- hexvalue (ctx->uc_mcontext.arm_r9, regs[9], 8);
- hexvalue (ctx->uc_mcontext.arm_r10, regs[10], 8);
- hexvalue (ctx->uc_mcontext.arm_fp, regs[11], 8);
- hexvalue (ctx->uc_mcontext.arm_ip, regs[12], 8);
- hexvalue (ctx->uc_mcontext.arm_sp, regs[13], 8);
- hexvalue (ctx->uc_mcontext.arm_lr, regs[14], 8);
- hexvalue (ctx->uc_mcontext.arm_pc, regs[15], 8);
- hexvalue (ctx->uc_mcontext.arm_cpsr, regs[16], 8);
- hexvalue (ctx->uc_mcontext.trap_no, regs[17], 8);
- hexvalue (ctx->uc_mcontext.error_code, regs[18], 8);
- hexvalue (ctx->uc_mcontext.oldmask, regs[19], 8);
- hexvalue (ctx->uc_mcontext.fault_address, regs[20], 8);
-
- /* Generate the output. */
- ADD_STRING ("Register dump:\n\n R0: ");
- ADD_MEM (regs[0], 8);
- ADD_STRING (" R1: ");
- ADD_MEM (regs[1], 8);
- ADD_STRING (" R2: ");
- ADD_MEM (regs[2], 8);
- ADD_STRING (" R3: ");
- ADD_MEM (regs[3], 8);
- ADD_STRING ("\n R4: ");
- ADD_MEM (regs[4], 8);
- ADD_STRING (" R5: ");
- ADD_MEM (regs[5], 8);
- ADD_STRING (" R6: ");
- ADD_MEM (regs[6], 8);
- ADD_STRING (" R7: ");
- ADD_MEM (regs[7], 8);
- ADD_STRING ("\n R8: ");
- ADD_MEM (regs[8], 8);
- ADD_STRING (" R9: ");
- ADD_MEM (regs[9], 8);
- ADD_STRING (" SL: ");
- ADD_MEM (regs[10], 8);
- ADD_STRING (" FP: ");
- ADD_MEM (regs[11], 8);
- ADD_STRING ("\n IP: ");
- ADD_MEM (regs[12], 8);
- ADD_STRING (" SP: ");
- ADD_MEM (regs[13], 8);
- ADD_STRING (" LR: ");
- ADD_MEM (regs[14], 8);
- ADD_STRING (" PC: ");
- ADD_MEM (regs[15], 8);
- ADD_STRING ("\n\n CPSR: ");
- ADD_MEM (regs[16], 8);
- ADD_STRING ("\n\n Trap: ");
- ADD_MEM (regs[17], 8);
- ADD_STRING (" Error: ");
- ADD_MEM (regs[18], 8);
- ADD_STRING (" OldMask: ");
- ADD_MEM (regs[19], 8);
- ADD_STRING ("\n Addr: ");
- ADD_MEM (regs[20], 8);
-
- ADD_STRING ("\n");
-
- /* Write the stuff out. */
- writev (fd, iov, nr);
-}
-
-
-#define REGISTER_DUMP register_dump (fd, ctx)
diff --git a/sysdeps/unix/sysv/linux/csky/register-dump.h b/sysdeps/unix/sysv/linux/csky/register-dump.h
deleted file mode 100644
index f313a6979a..0000000000
--- a/sysdeps/unix/sysv/linux/csky/register-dump.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/* Dump registers.
- Copyright (C) 2018-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <sys/uio.h>
-#include <_itoa.h>
-#include <bits/sigcontext.h>
-#include <sys/ucontext.h>
-
-/* abiv1 register dump in this format:
-
- PSR: XXXXXXXX PC: XXXXXXXX SP: XXXXXXXX LR: XXXXXXXX
- MASK: XXXXXXXX
-
- A0: XXXXXXXX A1: XXXXXXXX A2: XXXXXXXX A3: XXXXXXXX
- R6: XXXXXXXX R7: XXXXXXXX R8: XXXXXXXX R9: XXXXXXXX
- R10: XXXXXXXX R11: XXXXXXXX R12: XXXXXXXX R13: XXXXXXXX
- R14: XXXXXXXX R1: XXXXXXXX
-
- abiv2 register dump in this format:
-
- PSR: XXXXXXXX PC: XXXXXXXX SP: XXXXXXXX LR: XXXXXXXX
- MASK: XXXXXXXX
-
- A0: XXXXXXXX A1: XXXXXXXX A2: XXXXXXXX A3: XXXXXXXX
- R4: XXXXXXXX R5: XXXXXXXX R6: XXXXXXXX R7: XXXXXXXX
- R8: XXXXXXXX R9: XXXXXXXX R10: XXXXXXXX R11: XXXXXXXX
- R12: XXXXXXXX R13: XXXXXXXX R14: XXXXXXXX R15: XXXXXXXX
- R16: XXXXXXXX R17: XXXXXXXX R18: XXXXXXXX R19: XXXXXXXX
- R20: XXXXXXXX R21: XXXXXXXX R22: XXXXXXXX R23: XXXXXXXX
- R24: XXXXXXXX R25: XXXXXXXX R26: XXXXXXXX R27: XXXXXXXX
- R28: XXXXXXXX R29: XXXXXXXX R30: XXXXXXXX R31: XXXXXXXX
-
- */
-
-static void
-hexvalue (unsigned long int value, char *buf, size_t len)
-{
- char *cp = _itoa_word (value, buf + len, 16, 0);
- while (cp > buf)
- *--cp = '0';
-}
-
-static void
-register_dump (int fd, const struct ucontext_t *ctx)
-{
- char regs[35][8];
- struct iovec iov[97];
- size_t nr = 0;
-
-#define ADD_STRING(str) \
- iov[nr].iov_base = (char *) str; \
- iov[nr].iov_len = strlen (str); \
- ++nr
-#define ADD_MEM(str, len) \
- iov[nr].iov_base = str; \
- iov[nr].iov_len = len; \
- ++nr
-
- /* Generate strings of register contents. */
- hexvalue (ctx->uc_mcontext.__gregs.__sr, regs[0], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__pc, regs[1], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__usp, regs[2], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__lr, regs[3], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__a0, regs[4], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__a1, regs[5], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__a2, regs[6], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__a3, regs[7], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__regs[0], regs[8], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__regs[1], regs[9], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__regs[2], regs[10], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__regs[3], regs[11], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__regs[4], regs[12], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__regs[5], regs[13], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__regs[6], regs[14], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__regs[7], regs[15], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__regs[8], regs[16], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__regs[9], regs[17], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__exregs[0], regs[18], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__exregs[1], regs[19], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__exregs[2], regs[20], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__exregs[3], regs[21], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__exregs[4], regs[22], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__exregs[5], regs[23], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__exregs[6], regs[24], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__exregs[7], regs[25], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__exregs[8], regs[26], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__exregs[9], regs[27], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__exregs[10], regs[28], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__exregs[11], regs[29], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__exregs[12], regs[30], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__exregs[13], regs[31], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__exregs[14], regs[32], 8);
- hexvalue (ctx->uc_mcontext.__gregs.__tls, regs[33], 8);
-
- /* Generate the output. */
- ADD_STRING ("Register dump:\n\n PSR: ");
- ADD_MEM (regs[0], 8);
- ADD_STRING (" PC: ");
- ADD_MEM (regs[1], 8);
- ADD_STRING (" SP: ");
- ADD_MEM (regs[2], 8);
- ADD_STRING (" LR: ");
- ADD_MEM (regs[3], 8);
- ADD_STRING ("\n\n A0: ");
- ADD_MEM (regs[4], 8);
- ADD_STRING (" A1: ");
- ADD_MEM (regs[5], 8);
- ADD_STRING (" A2: ");
- ADD_MEM (regs[6], 8);
- ADD_STRING (" A3: ");
- ADD_MEM (regs[7], 8);
- ADD_STRING ("\n R4: ");
- ADD_MEM (regs[8], 8);
- ADD_STRING (" R5: ");
- ADD_MEM (regs[9], 8);
- ADD_STRING (" R6: ");
- ADD_MEM (regs[10], 8);
- ADD_STRING (" R7: ");
- ADD_MEM (regs[11], 8);
- ADD_STRING ("\n R8: ");
- ADD_MEM (regs[12], 8);
- ADD_STRING (" R9: ");
- ADD_MEM (regs[13], 8);
- ADD_STRING (" R10: ");
- ADD_MEM (regs[14], 8);
- ADD_STRING (" R11: ");
- ADD_MEM (regs[15], 8);
- ADD_STRING ("\n R12: ");
- ADD_MEM (regs[16], 8);
- ADD_STRING (" R13: ");
- ADD_MEM (regs[17], 8);
- ADD_STRING (" R14: ");
- ADD_MEM (regs[2], 8);
- ADD_STRING (" R15: ");
- ADD_MEM (regs[3], 8);
- ADD_STRING ("\n R16: ");
- ADD_MEM (regs[18], 8);
- ADD_STRING (" R17: ");
- ADD_MEM (regs[19], 8);
- ADD_STRING (" R18: ");
- ADD_MEM (regs[20], 8);
- ADD_STRING (" R19: ");
- ADD_MEM (regs[21], 8);
- ADD_STRING ("\n R20: ");
- ADD_MEM (regs[22], 8);
- ADD_STRING (" R21: ");
- ADD_MEM (regs[23], 8);
- ADD_STRING (" R22: ");
- ADD_MEM (regs[24], 8);
- ADD_STRING (" R23: ");
- ADD_MEM (regs[25], 8);
- ADD_ST