From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10027 invoked by alias); 21 Oct 2006 21:42:42 -0000 Received: (qmail 10018 invoked by uid 22791); 21 Oct 2006 21:42:41 -0000 X-Spam-Check-By: sourceware.org Received: from nitzan.inter.net.il (HELO nitzan.inter.net.il) (192.114.186.20) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 21 Oct 2006 21:42:40 +0000 Received: from HOME-C4E4A596F7 (IGLD-84-228-244-62.inter.net.il [84.228.244.62]) by nitzan.inter.net.il (MOS 3.7.3a-GA) with ESMTP id EYZ77494 (AUTH halo1); Sat, 21 Oct 2006 23:42:36 +0200 (IST) Date: Sat, 21 Oct 2006 21:42:00 -0000 Message-Id: From: Eli Zaretskii To: "Rodney M. Bates" CC: gdb@sourceware.org In-reply-to: <453A61C5.5010605@wichita.edu> (rodney.bates@wichita.edu) Subject: Re: breakpoint for accessing memory location Reply-to: Eli Zaretskii References: <4537DBC6.1030807@hccnet.nl> <20061019201214.GA32332@nevyn.them.org> <4537DEDC.5000008@hccnet.nl> <453A3758.5090602@wichita.edu> <453A61C5.5010605@wichita.edu> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-10/txt/msg00181.txt.bz2 > Date: Sat, 21 Oct 2006 13:07:01 -0500 > From: "Rodney M. Bates" > CC: gdb@sourceware.org > > Well, an expression in a program is always interpreted by looking up > any unqualified identifiers according to the scope rules, at the place in the > code where the expression appears. But with a watchpoint, that place keeps > changing. p can go out of scope, come back in, or a different p could become > visible. The manual says: GDB automatically deletes watchpoints that watch local (automatic) variables, or expressions that involve such variables, when they go out of scope, that is, when the execution leaves the block in which these variables were defined. > So more example questions (same expression, different contexts): Given the above text, are the answers to any of your questions still unclear? If so, please tell what is still unclear, and why. > If the expression is illegal at the place where the program is stopped > when the watch is typed, is it rejected then and there, or kept around > in case, e.g., a p comes into scope. The expression is rejected right there and then. GDB needs to find the address of each variable that is part of the expression, and if it cannot, it refuses to set the watchpoint.