From 5a1f5858d43f5e99d8faa000263051a89ede63d4 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Wed, 13 Jul 2005 14:48:58 +0000 Subject: [PATCH] * linux-low.c (fetch_register, usr_store_inferior_registers): Handle left-padded registers. * linux-low.h (struct linux_target_ops): Add left_pad_xfer. * linux-ppc64-low.c (the_low_target): Set left_pad_xfer. --- gdb/gdbserver/ChangeLog | 7 +++++++ gdb/gdbserver/linux-low.c | 14 ++++++++++++-- gdb/gdbserver/linux-low.h | 3 +++ gdb/gdbserver/linux-ppc64-low.c | 5 +++++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 71a799df238..19d5e528752 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,10 @@ +2005-07-13 Daniel Jacobowitz + + * linux-low.c (fetch_register, usr_store_inferior_registers): Handle + left-padded registers. + * linux-low.h (struct linux_target_ops): Add left_pad_xfer. + * linux-ppc64-low.c (the_low_target): Set left_pad_xfer. + 2005-07-01 Steve Ellcey * configure.ac (BFD_NEED_DECLARATION): Replace with AC_CHECK_DECLS. diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index fbc3033f672..904ff6b90bd 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -1126,7 +1126,12 @@ fetch_register (int regno) goto error_exit; } } - supply_register (regno, buf); + if (the_low_target.left_pad_xfer + && register_size (regno) < sizeof (PTRACE_XFER_TYPE)) + supply_register (regno, (buf + sizeof (PTRACE_XFER_TYPE) + - register_size (regno))); + else + supply_register (regno, buf); error_exit:; } @@ -1168,7 +1173,12 @@ usr_store_inferior_registers (int regno) & - sizeof (PTRACE_XFER_TYPE); buf = alloca (size); memset (buf, 0, size); - collect_register (regno, buf); + if (the_low_target.left_pad_xfer + && register_size (regno) < sizeof (PTRACE_XFER_TYPE)) + collect_register (regno, (buf + sizeof (PTRACE_XFER_TYPE) + - register_size (regno))); + else + collect_register (regno, buf); for (i = 0; i < size; i += sizeof (PTRACE_XFER_TYPE)) { errno = 0; diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h index 22ed57d714a..79b1bb71de0 100644 --- a/gdb/gdbserver/linux-low.h +++ b/gdb/gdbserver/linux-low.h @@ -64,6 +64,9 @@ struct linux_target_ops int (*stopped_by_watchpoint) (void); CORE_ADDR (*stopped_data_address) (void); + /* Whether to left-pad registers for PEEKUSR/POKEUSR if they are smaller + than an xfer unit. */ + int left_pad_xfer; }; extern struct linux_target_ops the_low_target; diff --git a/gdb/gdbserver/linux-ppc64-low.c b/gdb/gdbserver/linux-ppc64-low.c index 6a8c17da003..00374e726b3 100644 --- a/gdb/gdbserver/linux-ppc64-low.c +++ b/gdb/gdbserver/linux-ppc64-low.c @@ -109,4 +109,9 @@ struct linux_target_ops the_low_target = { NULL, 0, ppc_breakpoint_at, + NULL, + NULL, + NULL, + NULL, + 1 }; -- 2.30.2