From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9925 invoked by alias); 26 Aug 2009 20:08:38 -0000 Received: (qmail 9917 invoked by uid 22791); 26 Aug 2009 20:08:38 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1-old.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 26 Aug 2009 20:08:31 +0000 Received: from int-mx04.intmail.prod.int.phx2.redhat.com ([10.11.47.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n7QK8SuR000887 for ; Wed, 26 Aug 2009 16:08:28 -0400 Received: from host0.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7QK8KcK009941 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 26 Aug 2009 16:08:27 -0400 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 n7QK8JUH007889; Wed, 26 Aug 2009 22:08:19 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.3/Submit) id n7QK8DsM007877; Wed, 26 Aug 2009 22:08:13 +0200 Date: Wed, 26 Aug 2009 20:08:00 -0000 From: Jan Kratochvil To: Vladimir Prus Cc: gdb-patches@sources.redhat.com Subject: Re: [patch] MI: Error out on -var-create invalid FRAME-ADDR Message-ID: <20090826200813.GA7815@host0.dyn.jankratochvil.net> References: <20090810162949.GA9704@host0.dyn.jankratochvil.net> <20090810170045.GA15882@host0.dyn.jankratochvil.net> <200908130942.55574.vladimir@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200908130942.55574.vladimir@codesourcery.com> User-Agent: Mutt/1.5.19 (2009-01-05) 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: 2009-08/txt/msg00460.txt.bz2 On Thu, 13 Aug 2009 07:42:54 +0200, Vladimir Prus wrote: > I'd prefer error for all new code. Thanks! Attached, OK to check-in? Regression-tested on {x86_64,i686}-fedora11-linux-gnu. Thanks, Jan gdb/ 2009-08-26 Jan Kratochvil * varobj.c (varobj_create): Error if the specified frame was not found and it is needed. gdb/testsuite/ 2009-08-26 Jan Kratochvil * gdb.mi/mi2-var-cmd.exp (create variable with invalid FRAME-ADDR): New. --- ./gdb/varobj.c 14 Aug 2009 00:32:32 -0000 1.146 +++ ./gdb/varobj.c 25 Aug 2009 14:25:48 -0000 @@ -565,8 +565,15 @@ varobj_create (char *objname, we must select the appropriate frame before parsing the expression, otherwise the value will not be current. Since select_frame is so benign, just call it for all cases. */ - if (innermost_block && fi != NULL) + if (innermost_block) { + /* User could specify explicit FRAME-ADDR which was not found but + EXPRESSION is frame specific and we would not be able to evaluate + it correctly next time. With VALID_BLOCK set we must also set + FRAME and THREAD_ID. */ + if (fi == NULL) + error (_("Failed to find the specified frame")); + var->root->frame = get_frame_id (fi); var->root->thread_id = pid_to_thread_id (inferior_ptid); old_fi = get_selected_frame (NULL); --- ./gdb/testsuite/gdb.mi/mi2-var-cmd.exp 7 Jul 2009 09:25:38 -0000 1.23 +++ ./gdb/testsuite/gdb.mi/mi2-var-cmd.exp 25 Aug 2009 14:25:50 -0000 @@ -126,6 +126,11 @@ mi_gdb_test "-var-create int * int" \ "&\"Attempt to use a type name as an expression.\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \ "create int" +# The number 0 must be an invalid frame address and linteger a local variable. +mi_gdb_test "-var-create invalidframe 0 linteger" \ + "\\^error,msg=\"Failed to find the specified frame\"" \ + "create variable with invalid FRAME-ADDR" + ##### ##### # #