From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5799 invoked by alias); 28 Feb 2010 17:58:51 -0000 Received: (qmail 5782 invoked by uid 22791); 28 Feb 2010 17:58:50 -0000 X-SWARE-Spam-Status: No, hits=-7.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 28 Feb 2010 17:58:46 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1SHwjxL003980 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 28 Feb 2010 12:58:45 -0500 Received: from host0.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1SHwgS3004713 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 28 Feb 2010 12:58:44 -0500 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.3/8.14.3) with ESMTP id o1SHwf6L018624 for ; Sun, 28 Feb 2010 18:58:41 +0100 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.3/Submit) id o1SHwfsT018623 for gdb-patches@sourceware.org; Sun, 28 Feb 2010 18:58:41 +0100 Date: Sun, 28 Feb 2010 17:58:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: Re: [patch] infcall: Remove gdb_assert ($sp underflow) Message-ID: <20100228175841.GA17763@host0.dyn.jankratochvil.net> References: <20100219224805.GA9681@host0.dyn.jankratochvil.net> <20100226225249.GA15019@caradoc.them.org> <20100227004634.GA9742@host0.dyn.jankratochvil.net> <20100228143508.GC1556@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100228143508.GC1556@caradoc.them.org> User-Agent: Mutt/1.5.20 (2009-08-17) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-02/txt/msg00689.txt.bz2 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 + + * infcall.c (call_function_by_hand): Remove gdb_assert on sp and old_sp. + New comment. + 2010-02-28 Corinna Vinschen * 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 + Daniel Jacobowitz + + * gdb.base/callfuncs.exp: New tests for $spval 0 and -1. Remove return. + 2010-02-25 David S. Miller * 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} +}