From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24082 invoked by alias); 4 Jun 2009 17:54:44 -0000 Received: (qmail 24074 invoked by uid 22791); 4 Jun 2009 17:54:44 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 04 Jun 2009 17:54:38 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n54HsY0S012275; Thu, 4 Jun 2009 13:54:34 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n54HsW2m024917; Thu, 4 Jun 2009 13:54:33 -0400 Received: from opsy.redhat.com (vpn-12-161.rdu.redhat.com [10.11.12.161]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n54HsVG5031493; Thu, 4 Jun 2009 13:54:32 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 1D710378615; Thu, 4 Jun 2009 11:54:31 -0600 (MDT) To: Thiago Jung Bauermann Cc: gdb-patches ml Subject: Re: [RFC] Fix verification of changed values for big values. References: <1243802866.26363.35.camel@hactar> From: Tom Tromey Reply-To: tromey@redhat.com Date: Thu, 04 Jun 2009 17:54:00 -0000 In-Reply-To: <1243802866.26363.35.camel@hactar> (Thiago Jung Bauermann's message of "Sun\, 31 May 2009 17\:47\:46 -0300") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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-06/txt/msg00076.txt.bz2 >>>>> "Thiago" == Thiago Jung Bauermann writes: Thiago> Right now, GDB calls value_equal when comparing the old and new values Thiago> of a watchpoint. IMO this is not correct, since that function will call Thiago> coerce_array and effectively just compare the addresses of arrays being Thiago> watched. Thiago> This patch introduces a new value comparison function which works in the Thiago> mentioned case, and a testcase which fails without the patch and passes Thiago> with it. Ok to commit? This makes sense to me. Thiago> + return TYPE_CODE (type1) == TYPE_CODE (type2) Thiago> + && TYPE_LENGTH (type1) == TYPE_LENGTH (type2) Thiago> + && memcmp (value_contents (arg1), value_contents (arg2), Thiago> + TYPE_LENGTH (type1)) == 0; A style nit: multi-line expressions should be wrapped in parens, and the continuation lines here should be indented more deeply. Also, I think value_equal_watchpoint should be in one of the value-related files. My reasoning is that I've occasionally run across code duplication because some function like this was defined in an obscure place. Tom