From: Luis Machado Date: Mon, 14 Jun 2021 17:19:35 +0000 (-0300) Subject: Print additional information on capability store errors X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1152bf21e4b301a723cbd7ba73ccd5b9919395a6;p=thirdparty%2Fbinutils-gdb.git Print additional information on capability store errors Augment the warnings about not being able to write to capability registers or write capabilities to memory. Show the command that needs to be entered in the shell to enable this particular mode. gdb/ChangeLog: 2021-06-24 Luis Machado * aarch64-linux-nat.c (store_cregs_to_thread) (aarch64_linux_nat_target::write_capability): Update error message. gdbserver/ChangeLog: 2021-06-24 Luis Machado * linux-aarch64-low.cc (aarch64_target::qxfer_capability): Update error message. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0ad646af651..83fc5888053 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2021-06-24 Luis Machado + + * aarch64-linux-nat.c (store_cregs_to_thread) + (aarch64_linux_nat_target::write_capability): Update error message. + 2021-05-24 Luis Machado * aarch64-linux-tdep.c (aarch64_linux_cregmap): Update to match diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index 4b74c423f5d..70263da9259 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -546,7 +546,8 @@ store_cregs_to_thread (const struct regcache *regcache) regcache->raw_collect (regno++, &cregset.cctlr); if (ptrace (PTRACE_SETREGSET, tid, NT_ARM_MORELLO, &iovec) < 0) - perror_with_name (_("Unable to store capability registers.")); + perror_with_name (_("Unable to store capability registers.\n" + "Please run \"sysctl cheri.ptrace_forge_cap=1\".")); } /* Implement the "fetch_registers" target_ops method. */ @@ -1123,7 +1124,8 @@ aarch64_linux_nat_target::write_capability (CORE_ADDR addr, memcpy (&cap.val, buffer.data () + 1, 16); if (!aarch64_linux_write_capability (tid, addr, cap)) - perror_with_name (_("Unable to write capability from address.")); + perror_with_name (_("Unable to write capability to address.\n" + "Please run \"sysctl cheri.ptrace_forge_cap=1\".")); return true; } diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog index a56de0f5377..c9b2bec8979 100644 --- a/gdbserver/ChangeLog +++ b/gdbserver/ChangeLog @@ -1,3 +1,8 @@ +2021-06-24 Luis Machado + + * linux-aarch64-low.cc (aarch64_target::qxfer_capability): Update + error message. + 2021-03-17 Luis Machado * linux-aarch64-low.cc (aarch64_target::qxfer_capability): Handle diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc index d0eaff553ae..ce3fee522ce 100644 --- a/gdbserver/linux-aarch64-low.cc +++ b/gdbserver/linux-aarch64-low.cc @@ -3289,7 +3289,8 @@ aarch64_target::qxfer_capability (const CORE_ADDR address, if (!aarch64_linux_write_capability (tid, address, cap)) { - warning (_("Unable to write capability to address.")); + warning (_("Unable to write capability to address.\n" + "Please run \"sysctl cheri.ptrace_forge_cap=1\".")); return 0; } }