aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Kościelnicki <koriakin@0x04.net>2016-03-06 16:38:52 +0100
committerMarcin Kościelnicki <koriakin@0x04.net>2016-03-09 18:43:54 +0100
commitcc2c4da8813b980a4e68272bb43583f4af6fe89c (patch)
treed9bca39562fdf1e4c32fded351f4c73c57a1b92a
parentgdb: Add gen_return_address for powerpc. (diff)
downloadbinutils-gdb-cc2c4da8813b980a4e68272bb43583f4af6fe89c.tar.gz
binutils-gdb-cc2c4da8813b980a4e68272bb43583f4af6fe89c.tar.bz2
binutils-gdb-cc2c4da8813b980a4e68272bb43583f4af6fe89c.zip
gdb/rs6000: Read backchain as unsigned.
Previously, backchain was read as a signed quantity, resulting in addresses like 0xfffffffffffeded0 instead of 0xfffeded0 returned by unwinder on 32-bit powerpc. While normally such addresses are masked off, this causes problems for tracepoints, since 0xfffffffffffeded0 is considered unavailable. Fixes a test failure in gdb.trace/entry-values.exp. gdb/ChangeLog: * corefile.c (safe_read_memory_unsigned_integer): New function. * gdbcore.h (safe_read_memory_unsigned_integer): New prototype. * rs6000-tdep.c (rs6000_frame_cache): Read backchain as unsigned.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/corefile.c18
-rw-r--r--gdb/gdbcore.h3
-rw-r--r--gdb/rs6000-tdep.c6
4 files changed, 30 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 74dec87054b..83eef374749 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2016-03-09 Marcin Kościelnicki <koriakin@0x04.net>
+ * corefile.c (safe_read_memory_unsigned_integer): New function.
+ * gdbcore.h (safe_read_memory_unsigned_integer): New prototype.
+ * rs6000-tdep.c (rs6000_frame_cache): Read backchain as unsigned.
+
+2016-03-09 Marcin Kościelnicki <koriakin@0x04.net>
+
* rs6000-tdep.c: Add "ax.h" and "ax-gdb.h" includes.
(rs6000_gen_return_address): New function.
(rs6000_gdbarch_init): Wire in the above.
diff --git a/gdb/corefile.c b/gdb/corefile.c
index dbdbafc41f1..5ad4d40ec66 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -306,6 +306,24 @@ safe_read_memory_integer (CORE_ADDR memaddr, int len,
return 1;
}
+/* Read memory at MEMADDR of length LEN and put the contents in
+ RETURN_VALUE. Return 0 if MEMADDR couldn't be read and non-zero
+ if successful. */
+
+int
+safe_read_memory_unsigned_integer (CORE_ADDR memaddr, int len,
+ enum bfd_endian byte_order,
+ ULONGEST *return_value)
+{
+ gdb_byte buf[sizeof (ULONGEST)];
+
+ if (target_read_memory (memaddr, buf, len))
+ return 0;
+
+ *return_value = extract_unsigned_integer (buf, len, byte_order);
+ return 1;
+}
+
LONGEST
read_memory_integer (CORE_ADDR memaddr, int len,
enum bfd_endian byte_order)
diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h
index 5db80e56a13..8b101bcabef 100644
--- a/gdb/gdbcore.h
+++ b/gdb/gdbcore.h
@@ -76,6 +76,9 @@ extern int safe_read_memory_integer (CORE_ADDR memaddr, int len,
extern ULONGEST read_memory_unsigned_integer (CORE_ADDR memaddr,
int len,
enum bfd_endian byte_order);
+extern int safe_read_memory_unsigned_integer (CORE_ADDR memaddr, int len,
+ enum bfd_endian byte_order,
+ ULONGEST *return_value);
/* Read an integer from debugged code memory, given address,
number of bytes, and byte order for code. */
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 565c6201bce..2460eb5b8d8 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -3336,10 +3336,10 @@ rs6000_frame_cache (struct frame_info *this_frame, void **this_cache)
if (!fdata.frameless)
{
/* Frameless really means stackless. */
- LONGEST backchain;
+ ULONGEST backchain;
- if (safe_read_memory_integer (cache->base, wordsize,
- byte_order, &backchain))
+ if (safe_read_memory_unsigned_integer (cache->base, wordsize,
+ byte_order, &backchain))
cache->base = (CORE_ADDR) backchain;
}