From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15751 invoked by alias); 3 Oct 2002 23:06:33 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 15743 invoked from network); 3 Oct 2002 23:06:32 -0000 Received: from unknown (HELO touchme.toronto.redhat.com) (216.138.202.10) by sources.redhat.com with SMTP; 3 Oct 2002 23:06:32 -0000 Received: from redhat.com (toocool.toronto.redhat.com [172.16.14.72]) by touchme.toronto.redhat.com (Postfix) with ESMTP id A4B408000E6 for ; Thu, 3 Oct 2002 19:06:31 -0400 (EDT) Message-ID: <3D9CCD77.A189328C@redhat.com> Date: Thu, 03 Oct 2002 16:06:00 -0000 From: "J. Johnston" Organization: Red Hat Inc. X-Accept-Language: en MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: Patch for gdb/mi problem 702 Content-Type: multipart/mixed; boundary="------------7030F5D140E2E3C1B4D0E31F" X-SW-Source: 2002-10/txt/msg00116.txt.bz2 This is a multi-part message in MIME format. --------------7030F5D140E2E3C1B4D0E31F Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-length: 969 The following fixes a problem with -var-assign whereby an assignment of a new value is not seen by a subsequent -var-update. The underlying varobj_update call looks to see if there is a difference between the current value and a refreshed value. Since varobj_set_value actually changes both the internal value and the actual value, varobj_update does not add the variable to the changelist. The fix involves adding a new flag: "updated" to the struct varobj which is set by varobj_set_value when the value changes and is checked by varobj_update before comparing current and refreshed values for a varobj. ChangeLog: 2002-10-03 Jeff Johnston * varobj.c (struct varobj): Add new "updated" flag. (new_variable): Default "updated" flag to 0. (varobj_set_value): Set "updated" flag to 1 if value changes. (varobj_update): Check varobj "updated" flag before comparing old and refreshed values. Fix for PR gdb/702. Approved? -- Jeff J. --------------7030F5D140E2E3C1B4D0E31F Content-Type: text/plain; charset=us-ascii; name="702.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="702.patch" Content-length: 2102 Index: varobj.c =================================================================== RCS file: /cvs/src/src/gdb/varobj.c,v retrieving revision 1.32 diff -u -r1.32 varobj.c --- varobj.c 24 Sep 2002 18:50:34 -0000 1.32 +++ varobj.c 3 Oct 2002 23:00:54 -0000 @@ -111,6 +111,9 @@ /* The format of the output for this object */ enum varobj_display_formats format; + + /* Was this variable updated via a varobj_set_value operation */ + int updated; }; /* Every variable keeps a linked list of its children, described @@ -753,6 +756,7 @@ varobj_set_value (struct varobj *var, char *expression) { struct value *val; + int error; int offset = 0; /* The argument "expression" contains the variable's new value. @@ -778,6 +782,8 @@ return 0; } + if (!my_value_equal (var->value, value, &error)) + var->updated = 1; if (!gdb_value_assign (var->value, value, &val)) return 0; value_free (var->value); @@ -893,10 +899,11 @@ /* If values are not equal, note that it's changed. There a couple of exceptions here, though. We don't want some types to be reported as "changed". */ - else if (type_changeable (*varp) - && !my_value_equal ((*varp)->value, new, &error2)) + else if (type_changeable (*varp) && + ((*varp)->updated || !my_value_equal ((*varp)->value, new, &error2))) { vpush (&result, *varp); + (*varp)->updated = 0; changed++; /* error2 replaces var->error since this new value WILL replace the old one. */ @@ -933,10 +940,12 @@ /* Update this variable */ new = value_of_child (v->parent, v->index); - if (type_changeable (v) && !my_value_equal (v->value, new, &error2)) + if (type_changeable (v) && + (v->updated || !my_value_equal (v->value, new, &error2))) { /* Note that it's changed */ vpush (&result, v); + v->updated = 0; changed++; } /* error2 replaces v->error since this new value @@ -1294,6 +1303,7 @@ var->children = NULL; var->format = 0; var->root = NULL; + var->updated = 0; return var; } --------------7030F5D140E2E3C1B4D0E31F--