diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 71a799df23..19d5e52875 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 fbc3033f67..904ff6b90b 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 22ed57d714..79b1bb71de 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 6a8c17da00..00374e726b 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 };