From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28812 invoked by alias); 4 Oct 2010 20:45:56 -0000 Received: (qmail 28802 invoked by uid 22791); 4 Oct 2010 20:45:55 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,T_LOTS_OF_MONEY,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 04 Oct 2010 20:45:50 +0000 Received: (qmail 1512 invoked from network); 4 Oct 2010 20:45:47 -0000 Received: from unknown (HELO caradoc.them.org) (dan@127.0.0.2) by mail.codesourcery.com with ESMTPA; 4 Oct 2010 20:45:47 -0000 Date: Mon, 04 Oct 2010 20:45:00 -0000 From: Daniel Jacobowitz To: Ken Werner Cc: Ulrich Weigand , gdb-patches@sourceware.org, Joel Brobecker Subject: Re: [patch] fix pre-/post- in-/decrement Message-ID: <20101004204538.GA1052@caradoc.them.org> Mail-Followup-To: Ken Werner , Ulrich Weigand , gdb-patches@sourceware.org, Joel Brobecker References: <201010041301.o94D1QHV032611@d12av02.megacenter.de.ibm.com> <201010042146.50252.ken@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201010042146.50252.ken@linux.vnet.ibm.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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-10/txt/msg00030.txt.bz2 On Mon, Oct 04, 2010 at 09:46:50PM +0200, Ken Werner wrote: > The attached patch introduces a new function called value_non_lval that > returns a non-lval version of the given value. This function is called prior > the simple assignment, compound assignment and pre/postfix routines return. Any > comments are appreciated. I think this will have an undesired effect. Try this - it's easiest to see what's going on with set debug target 1, or else by using gdbserver and set debug remote 1 (the latter is easier for me to read). I've edited out some reads relating to the stack frame. (gdb) set $p = (int *) $sp (gdb) p *$p Sending packet: $m7fffffffdff0,4#2e...Packet received: 01000000 $4 = 1 (gdb) set *$p = 2 Sending packet: $X7fffffffdff0,4:\002\000\000\000#55...Packet received: OK (gdb) print *$p = 1 Sending packet: $X7fffffffdff0,4:\001\000\000\000#54...Packet received: OK Sending packet: $m7fffffffdff0,4#2e...Packet received: 01000000 $5 = 1 (gdb) I suspect that your patch will be called to handle the value_assign for the set command, and it will result in an unnecessary read from the target. You want the resulting value to be unwritable, but it can still be lazy; you don't need the value. Of course, those two things are not orthogonal in GDB's current representation. So I don't know how to do this. But don't break the current behavior, please - it's important both for performance and for embedded correctness. -- Daniel Jacobowitz CodeSourcery