From: "Marcin Kościelnicki" <koriakin@0x04.net>
To: gdb-patches@sourceware.org
Cc: "Marcin Kościelnicki" <koriakin@0x04.net>
Subject: [PATCH 3/8] gdb/rs6000: Read backchain as unsigned.
Date: Sun, 06 Mar 2016 16:40:00 -0000 [thread overview]
Message-ID: <1457282097-7201-4-git-send-email-koriakin@0x04.net> (raw)
In-Reply-To: <1457282097-7201-1-git-send-email-koriakin@0x04.net>
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.
---
gdb/ChangeLog | 6 ++++++
gdb/corefile.c | 18 ++++++++++++++++++
gdb/gdbcore.h | 3 +++
gdb/rs6000-tdep.c | 6 +++---
4 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c2ef019..45c5276 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2016-03-06 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-05 Marcin KoÅcielnicki <koriakin@0x04.net>
* rs6000-tdep.c (rs6000_gen_return_address): New function.
diff --git a/gdb/corefile.c b/gdb/corefile.c
index dbdbafc..5ad4d40 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 5db80e5..8b101bc 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 565c620..2460eb5 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;
}
--
2.7.2
next prev parent reply other threads:[~2016-03-06 16:40 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-06 16:35 [PATCH 0/8] Add regular tracepoint support for powerpc Marcin Kościelnicki
2016-03-06 16:35 ` [PATCH 1/8] gdb: Add ax_pseudo_register_collect " Marcin Kościelnicki
2016-03-09 17:20 ` Ulrich Weigand
2016-03-06 16:35 ` [PATCH 6/8] gdb.trace/tfind.exp: Force call via global entry point on ppc64le Marcin Kościelnicki
2016-03-09 17:26 ` Ulrich Weigand
2016-03-06 16:35 ` [PATCH 2/8] gdb: Add gen_return_address for powerpc Marcin Kościelnicki
2016-03-09 17:20 ` Ulrich Weigand
2016-03-06 16:35 ` [PATCH 7/8] gdb.trace/entry-values.exp: Fixes for powerpc64 Marcin Kościelnicki
2016-03-09 17:29 ` Ulrich Weigand
2016-03-06 16:35 ` [PATCH 4/8] gdb.trace: Use manually-defined start labels in unavailable-dwarf-piece.exp Marcin Kościelnicki
2016-03-09 17:24 ` Ulrich Weigand
2016-03-09 17:27 ` Marcin Kościelnicki
2016-03-09 17:35 ` Ulrich Weigand
2016-03-06 16:35 ` [PATCH 8/8] gdb: Add tracepoint support for powerpc Marcin Kościelnicki
2016-03-09 17:33 ` Ulrich Weigand
2016-03-09 17:48 ` Marcin Kościelnicki
2016-03-06 16:40 ` [PATCH 5/8] gdb.trace/change-loc.exp: Don't depend on tracepoint ordering Marcin Kościelnicki
2016-03-09 17:25 ` Ulrich Weigand
2016-03-06 16:40 ` Marcin Kościelnicki [this message]
2016-03-09 17:21 ` [PATCH 3/8] gdb/rs6000: Read backchain as unsigned Ulrich Weigand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1457282097-7201-4-git-send-email-koriakin@0x04.net \
--to=koriakin@0x04.net \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox