From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: Re: [patch] infcall: Remove gdb_assert ($sp underflow)
Date: Sun, 28 Feb 2010 17:58:00 -0000 [thread overview]
Message-ID: <20100228175841.GA17763@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <20100228143508.GC1556@caradoc.them.org>
On Sun, 28 Feb 2010 15:35:09 +0100, Daniel Jacobowitz wrote:
> On Sat, Feb 27, 2010 at 01:46:34AM +0100, Jan Kratochvil wrote:
> > + gdb_test {sp == 0: call doubleit (1)}
>
> Except what does this do? I've never seen this syntax before, I'm
> surprised that it works.
It generated false PASS - not testing the internal error at all.
Undefined command: "sp". Try "help".
Thanks for catching it.
> I think the patch is otherwise OK.
Checked-in.
Thanks,
Jan
http://sourceware.org/ml/gdb-cvs/2010-02/msg00222.html
--- src/gdb/ChangeLog 2010/02/28 15:04:10 1.11406
+++ src/gdb/ChangeLog 2010/02/28 17:56:36 1.11407
@@ -1,3 +1,8 @@
+2010-02-28 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * infcall.c (call_function_by_hand): Remove gdb_assert on sp and old_sp.
+ New comment.
+
2010-02-28 Corinna Vinschen <vinschen@redhat.com>
* Makefile.in (SUBDIR_MI_OBS): Move mi-common.o from here...
--- src/gdb/infcall.c 2010/01/28 22:07:58 1.126
+++ src/gdb/infcall.c 2010/02/28 17:56:36 1.127
@@ -518,10 +518,9 @@
/* Stack grows up. */
sp = gdbarch_frame_align (gdbarch, old_sp + 1);
}
- gdb_assert ((gdbarch_inner_than (gdbarch, 1, 2)
- && sp <= old_sp)
- || (gdbarch_inner_than (gdbarch, 2, 1)
- && sp >= old_sp));
+ /* SP may have underflown address zero here from OLD_SP. Memory access
+ functions will probably fail in such case but that is a target's
+ problem. */
}
else
/* FIXME: cagney/2002-09-18: Hey, you loose!
--- src/gdb/testsuite/ChangeLog 2010/02/26 05:50:35 1.2154
+++ src/gdb/testsuite/ChangeLog 2010/02/28 17:56:37 1.2155
@@ -1,3 +1,8 @@
+2010-02-28 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Daniel Jacobowitz <dan@codesourcery.com>
+
+ * gdb.base/callfuncs.exp: New tests for $spval 0 and -1. Remove return.
+
2010-02-25 David S. Miller <davem@davemloft.net>
* gdb.base/catch-syscall.exp: Allow to run on sparc*-*-linux and
--- src/gdb/testsuite/gdb.base/callfuncs.exp 2010/01/01 07:32:00 1.31
+++ src/gdb/testsuite/gdb.base/callfuncs.exp 2010/02/28 17:56:37 1.32
@@ -469,5 +469,17 @@
fail "nested call dummies preserve register contents"
}
-return 0
+# GDB should not crash by internal error on $sp underflow during the inferior
+# call. It is OK it will stop on some: Cannot access memory at address 0x$hex.
+if {![target_info exists gdb,nosignals] && ![istarget "*-*-uclinux*"]} {
+ gdb_test {set $old_sp = $sp}
+
+ gdb_test {set $sp = 0}
+ gdb_test "call doubleit (1)" "" "sp == 0: call doubleit (1)"
+
+ gdb_test {set $sp = -1}
+ gdb_test "call doubleit (1)" "" "sp == -1: call doubleit (1)"
+
+ gdb_test {set $sp = $old_sp}
+}
prev parent reply other threads:[~2010-02-28 17:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-19 22:48 [patch] infcall: Remove gdb_assert ($sp overflow) Jan Kratochvil
2010-02-26 22:45 ` Tom Tromey
2010-02-27 1:19 ` [patch] infcall: Remove gdb_assert ($sp underflow) Jan Kratochvil
2010-02-28 10:53 ` [patch] infcall: Remove gdb_assert ($sp overflow) Joel Brobecker
2010-02-26 22:53 ` Daniel Jacobowitz
2010-02-27 0:46 ` [patch] infcall: Remove gdb_assert ($sp underflow) Jan Kratochvil
2010-02-28 14:35 ` Daniel Jacobowitz
2010-02-28 17:58 ` Jan Kratochvil [this message]
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=20100228175841.GA17763@host0.dyn.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--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