From: Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Cc: Ulrich Weigand <uweigand@de.ibm.com>,
Sergio Durigan Junior <sergiodj@redhat.com>,
Pedro Alves <palves@redhat.com>
Subject: Re: [PATCH] [PR tdep/17379] Fix internal-error when stack pointer is invalid
Date: Fri, 12 Sep 2014 12:31:00 -0000 [thread overview]
Message-ID: <1410525085-29172-1-git-send-email-emachado@linux.vnet.ibm.com> (raw)
In-Reply-To: <5412C3F0.9000703@redhat.com>
Thank you all for the review. I've just pushed the following patch with the
suggested additional fixes.
https://sourceware.org/ml/gdb-cvs/2014-09/msg00055.html
Thanks and regards,
--
Edjunior
gdb/ChangeLog
2014-09-12 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
Ulrich Weigand <uweigand@de.ibm.com>
PR tdep/17379
* rs6000-tdep.c (rs6000_frame_cache): Use safe_read_memory_integer
instead of read_memory_unsigned_integer.
gdb/testcase/ChangeLog
2014-09-12 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
PR tdep/17379
* gdb.arch/powerpc-stackless.S: New file.
* gdb.arch/powerpc-stackless.exp: New file.
---
gdb/rs6000-tdep.c | 11 +++++--
gdb/testsuite/gdb.arch/powerpc-stackless.S | 24 +++++++++++++++
gdb/testsuite/gdb.arch/powerpc-stackless.exp | 42 ++++++++++++++++++++++++++
3 files changed, 74 insertions(+), 3 deletions(-)
create mode 100644 gdb/testsuite/gdb.arch/powerpc-stackless.S
create mode 100644 gdb/testsuite/gdb.arch/powerpc-stackless.exp
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 730afe7..dabf448 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -3190,9 +3190,14 @@ rs6000_frame_cache (struct frame_info *this_frame, void **this_cache)
}
if (!fdata.frameless)
- /* Frameless really means stackless. */
- cache->base
- = read_memory_unsigned_integer (cache->base, wordsize, byte_order);
+ {
+ /* Frameless really means stackless. */
+ LONGEST backchain;
+
+ if (safe_read_memory_integer (cache->base, wordsize,
+ byte_order, &backchain))
+ cache->base = (CORE_ADDR) backchain;
+ }
trad_frame_set_value (cache->saved_regs,
gdbarch_sp_regnum (gdbarch), cache->base);
diff --git a/gdb/testsuite/gdb.arch/powerpc-stackless.S b/gdb/testsuite/gdb.arch/powerpc-stackless.S
new file mode 100644
index 0000000..bbf92bb
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/powerpc-stackless.S
@@ -0,0 +1,24 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2014 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <ppc-asm.h>
+
+FUNC_START(main)
+ li sp,0
+ mtlr sp
+ blr
+FUNC_END(main)
diff --git a/gdb/testsuite/gdb.arch/powerpc-stackless.exp b/gdb/testsuite/gdb.arch/powerpc-stackless.exp
new file mode 100644
index 0000000..420bcbc
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/powerpc-stackless.exp
@@ -0,0 +1,42 @@
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Testcase for PR tdep/17379.
+
+if {![istarget "powerpc*-*-*"]} then {
+ verbose "Skipping powerpc-stackless.exp"
+ return
+}
+
+standard_testfile .S
+
+if { [prepare_for_testing $testfile.exp $testfile $srcfile] } {
+ untested powerpc-stackless.exp
+ return -1
+}
+
+# Run until SIGSEGV.
+gdb_run_cmd
+
+set test "run until SIGSEGV"
+gdb_test_multiple "" $test {
+ -re "Program received signal SIGSEGV.*$gdb_prompt $" {
+ pass $test
+ }
+}
+
+# Ensure that 'info registers' works properly and does not generate
+# an internal-error.
+gdb_test "info registers" "r0.*" "info registers"
--
1.7.9.5
next prev parent reply other threads:[~2014-09-12 12:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-11 23:03 Edjunior Barbosa Machado
2014-09-11 23:21 ` Sergio Durigan Junior
2014-09-12 2:47 ` Edjunior Barbosa Machado
2014-09-12 3:20 ` Sergio Durigan Junior
2014-09-12 8:39 ` Ulrich Weigand
2014-09-12 9:59 ` Pedro Alves
2014-09-12 12:31 ` Edjunior Barbosa Machado [this message]
2014-09-12 13:00 ` Joel Brobecker
2014-09-12 13:38 ` Pedro Alves
2014-09-12 13:50 ` Joel Brobecker
2014-09-12 14:21 ` Pedro Alves
2014-09-12 15:27 ` [PATCH] after gdb_run_cmd, gdb_expect -> gdb_test_multiple/gdb_test Pedro Alves
2014-09-12 17:10 ` Joel Brobecker
2014-09-12 21:44 ` Pedro Alves
2014-09-12 22:45 ` Pedro Alves
2014-09-15 13:55 ` Joel Brobecker
[not found] <54195D36.2080001@redhat.com>
2014-09-17 12:41 ` [PATCH] [PR tdep/17379] Fix internal-error when stack pointer is invalid Ulrich Weigand
2014-09-17 13:03 ` Pedro Alves
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=1410525085-29172-1-git-send-email-emachado@linux.vnet.ibm.com \
--to=emachado@linux.vnet.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
--cc=sergiodj@redhat.com \
--cc=uweigand@de.ibm.com \
/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