From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2167 invoked by alias); 26 Jun 2008 14:27:54 -0000 Received: (qmail 2157 invoked by uid 22791); 26 Jun 2008 14:27:53 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 26 Jun 2008 14:27:34 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 903F498411; Thu, 26 Jun 2008 14:27:32 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 668A69835A; Thu, 26 Jun 2008 14:27:32 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1KBsRf-0007KB-OS; Thu, 26 Jun 2008 10:27:31 -0400 Date: Thu, 26 Jun 2008 15:01:00 -0000 From: Daniel Jacobowitz To: Jan Kratochvil Cc: gdb-patches@sourceware.org Subject: Re: [patch] Warn on constant value watchpoints Message-ID: <20080626142731.GK22726@caradoc.them.org> Mail-Followup-To: Jan Kratochvil , gdb-patches@sourceware.org References: <20080608155302.GA25486@host0.dyn.jankratochvil.net> <20080608180909.GA6199@caradoc.them.org> <20080608192755.GA16172@host0.dyn.jankratochvil.net> <20080609061414.GA19316@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080609061414.GA19316@host0.dyn.jankratochvil.net> User-Agent: Mutt/1.5.17 (2008-05-11) 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: 2008-06/txt/msg00477.txt.bz2 On Mon, Jun 09, 2008 at 08:14:14AM +0200, Jan Kratochvil wrote: > @@ -5903,7 +5903,27 @@ watch_command_1 (char *arg, int accessfl > exp_end = arg; > exp_valid_block = innermost_block; > mark = value_mark (); > - fetch_watchpoint_value (exp, &val, NULL, NULL); > + fetch_watchpoint_value (exp, &val, &val_result, NULL); > + > + /* VAL may be unset for unreachable final values. */ > + while (val_result != NULL) > + { > + if (VALUE_LVAL (val_result) == lval_memory > + || VALUE_LVAL (val_result) == lval_register) > + break; > + val_result = value_next (val_result); > + } val_result is the same as val, except possibly lazy. value_next (val_result) will always be NULL, won't it? The chain goes the other way - next from the oldest value (*val_chain argument, or the first value after the saved mark). If I'm right it seems like this patch will break "watch a + 1". Also, I don't know how useful this feature is, but what happens with "watch foo()"? > + if (val_result == NULL) > + { > + int len; > + > + len = exp_end - exp_start; > + while (len > 0 && isspace (exp_start[len - 1])) > + len--; > + error (_("Cannot watch constant value %.*s."), len, exp_start); > + } If an intermediate value could not be read, val_result may be NULL. So this will stop us watching such expressions before they become readable. > +If you watch for a change in a numerically entered address you need to > +dereference it as the address itself is just a constant number which will never > +change. @value{GDBN} refuses to create a never invokable watchpoint: never-changing? -- Daniel Jacobowitz CodeSourcery