aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/gdbserver/ChangeLog7
-rw-r--r--gdb/gdbserver/linux-mips-low.c8
-rw-r--r--gdb/mips-linux-nat.c5
4 files changed, 26 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 82e249f..8d425a7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2018-05-22 Maciej W. Rozycki <macro@mips.com>
+
+ * mips-linux-nat.c (mips64_linux_register_addr): Return -1 if
+ the width of the requested register exceeds the width of the
+ `ptrace' data type.
+
2018-05-21 Tom Tromey <tom@tromey.com>
* printcmd.c (output_command): Remove.
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 3c55457..c577b3d 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,10 @@
+2018-05-22 Maciej W. Rozycki <macro@mips.com>
+
+ * linux-mips-low.c (mips_cannot_fetch_register): Return 1 if the
+ width of the requested register exceeds the width of the
+ `ptrace' data type.
+ (mips_cannot_store_register): Likewise.
+
2018-05-21 Maciej W. Rozycki <macro@mips.com>
* linux-mips-low.c (mips_fetch_register): New function. Update
diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c
index ff87dd7..7fae2e6 100644
--- a/gdb/gdbserver/linux-mips-low.c
+++ b/gdb/gdbserver/linux-mips-low.c
@@ -211,6 +211,10 @@ mips_cannot_fetch_register (int regno)
tdesc = current_process ()->tdesc;
+ /* On n32 we can't access 64-bit registers via PTRACE_PEEKUSR. */
+ if (register_size (tdesc, regno) > sizeof (PTRACE_XFER_TYPE))
+ return 1;
+
if (find_regno (tdesc, "r0") == regno)
return 1;
@@ -227,6 +231,10 @@ mips_cannot_store_register (int regno)
tdesc = current_process ()->tdesc;
+ /* On n32 we can't access 64-bit registers via PTRACE_POKEUSR. */
+ if (register_size (tdesc, regno) > sizeof (PTRACE_XFER_TYPE))
+ return 1;
+
if (find_regno (tdesc, "r0") == regno)
return 1;
diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
index b1dbb79..a9f0b79 100644
--- a/gdb/mips-linux-nat.c
+++ b/gdb/mips-linux-nat.c
@@ -145,6 +145,11 @@ mips64_linux_register_addr (struct gdbarch *gdbarch, int regno, int store)
if (regno < 0 || regno >= gdbarch_num_regs (gdbarch))
error (_("Bogon register number %d."), regno);
+ /* On n32 we can't access 64-bit registers via PTRACE_PEEKUSR
+ or PTRACE_POKEUSR. */
+ if (register_size (gdbarch, regno) > sizeof (PTRACE_TYPE_RET))
+ return (CORE_ADDR) -1;
+
if (regno > MIPS_ZERO_REGNUM && regno < MIPS_ZERO_REGNUM + 32)
regaddr = regno;
else if ((regno >= mips_regnum (gdbarch)->fp0)