[RFA/commit/ia64-linux] Allow libunwind to fetch register 0
Pedro Alves
pedro@codesourcery.com
Tue Oct 25 17:27:00 GMT 2011
On Tuesday 25 October 2011 17:52:43, Joel Brobecker wrote:
> gdb/ia64-linux-nat.c | 11 +++++++++++
> 1 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
> index 65e077b..f43e91e 100644
> --- a/gdb/ia64-linux-nat.c
> +++ b/gdb/ia64-linux-nat.c
> @@ -681,6 +681,17 @@ ia64_linux_fetch_register (struct regcache *regcache, int regnum)
> PTRACE_TYPE_RET *buf;
> int pid, i;
>
> + /* r0 cannot be fetched but is always zero. */
> + if (regnum == 0)
IA64_GR0_REGNUM?
> + {
> + const char r0_value[8] = {0x00, 0x00, 0x00, 0x00,
> + 0x00, 0x00, 0x00, 0x00};
FYI, in C, this is equivalent to:
const char r0_value[8] = { 0 };
I'd write it as:
const char zero[8] = { 0 };
> +
> + gdb_assert (sizeof (r0_value) == register_size (gdbarch, regnum));
> + regcache_raw_supply (regcache, regnum, r0_value);
> + return;
> + }
> +
I don't speak ia64, but this is the right direction.
I think we should make ia64_cannot_fetch_register return true for
gr0 too though. Your new code in ia64_linux_fetch_register would
then be moved a bit further down after the ia64_cannot_fetch_register
check. It may be there's no code that trip on the below issue,
but it's best to avoid leaving the issue latent.
--
Pedro Alves
More information about the Gdb-patches
mailing list