From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2421 invoked by alias); 14 Feb 2007 23:06:01 -0000 Received: (qmail 2409 invoked by uid 22791); 14 Feb 2007 23:06:00 -0000 X-Spam-Check-By: sourceware.org Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.8) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 14 Feb 2007 23:05:54 +0000 Received: from kahikatea.snap.net.nz (201.62.255.123.dynamic.snap.net.nz [123.255.62.201]) by viper.snap.net.nz (Postfix) with ESMTP id 6AD3A3D95AE for ; Thu, 15 Feb 2007 12:05:50 +1300 (NZDT) Received: by kahikatea.snap.net.nz (Postfix, from userid 500) id B6B954F6E0; Thu, 15 Feb 2007 12:05:48 +1300 (NZDT) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17875.38347.137214.962583@kahikatea.snap.net.nz> Date: Wed, 14 Feb 2007 23:06:00 -0000 To: gdb-patches@sourceware.org Subject: [PATCH] varobj.c X-Mailer: VM 7.19 under Emacs 22.0.93.10 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: 2007-02/txt/msg00191.txt.bz2 Following Denis' patch, this patch makes GDB throw a user error if a non root variable is used for -var-update. Currently GDB does: (gdb) -var-update var1.1 ^done,changelist=[{name="var1.1",in_scope="false"}] (gdb) even though the expression that var1.1 represents may be inscope and have changed value. with this change: (gdb) -var-update var1.1 &"Only root variables can be updated\n" ^error,msg="Only root variables can be updated" (gdb) It also uses an assert if changelist is NULL. I'm not sure how changelist could be NULL, but if it is GDB has really lost the plot. -- Nick http://www.inet.net.nz/~nickrob 2007-02-15 Nick Roberts * varobj.c (varobj_update): Remove unused local. Use gdb_assert to check changelist is non-NULL. Call error if the frontend tries to update a non-root variable. * varobj.h (enum varobj_update_error): Delete WRONG_PARAM value. *** varobj.h 13 Feb 2007 21:31:43 +1300 1.8 --- varobj.h 15 Feb 2007 11:38:47 +1300 *************** enum varobj_update_error *** 45,51 **** NOT_IN_SCOPE = -1, /* varobj not in scope, can not be updated. */ TYPE_CHANGED = -2, /* varobj type has changed. */ INVALID = -3, /* varobj is not valid anymore. */ - WRONG_PARAM = -4 /* function is called with wrong arguments. */ }; /* String representations of gdb's format codes (defined in varobj.c) */ --- 45,50 ---- *** varobj.c 13 Feb 2007 21:31:43 +1300 1.84 --- varobj.c 15 Feb 2007 11:46:07 +1300 *************** int *** 1037,1043 **** varobj_update (struct varobj **varp, struct varobj ***changelist) { int changed = 0; - int error = 0; int type_changed; int i; int vleft; --- 1037,1042 ---- *************** varobj_update (struct varobj **varp, str *** 1051,1063 **** struct frame_info *fi; /* sanity check: have we been passed a pointer? */ ! if (changelist == NULL) ! return WRONG_PARAM; - /* Only root variables can be updated... */ if (!is_root_p (*varp)) ! /* Not a root var. */ ! return WRONG_PARAM; if (!(*varp)->root->is_valid) return INVALID; --- 1050,1059 ---- struct frame_info *fi; /* sanity check: have we been passed a pointer? */ ! gdb_assert (changelist); if (!is_root_p (*varp)) ! error (_("Only root variables can be updated")); if (!(*varp)->root->is_valid) return INVALID;