From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20448 invoked by alias); 7 Oct 2002 18:50:30 -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 20437 invoked from network); 7 Oct 2002 18:50:24 -0000 Received: from unknown (HELO mail-out2.apple.com) (17.254.0.51) by sources.redhat.com with SMTP; 7 Oct 2002 18:50:24 -0000 Received: from mailgate1.apple.com (A17-128-100-225.apple.com [17.128.100.225]) by mail-out2.apple.com (8.11.3/8.11.3) with ESMTP id g97IoLs21112 for ; Mon, 7 Oct 2002 11:50:21 -0700 (PDT) Received: from scv1.apple.com (scv1.apple.com) by mailgate1.apple.com (Content Technologies SMTPRS 4.2.5) with ESMTP id ; Mon, 7 Oct 2002 11:50:11 -0700 Received: from molly.local. (vpn-scv-x3-104.apple.com [17.219.194.104]) by scv1.apple.com (8.11.3/8.11.3) with ESMTP id g97IoKb17381; Mon, 7 Oct 2002 11:50:20 -0700 (PDT) Date: Mon, 07 Oct 2002 11:50:00 -0000 Subject: Re: [PATCH] Compare contents when evaluating an array watchpoint Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v543) Cc: gdb-patches@sources.redhat.com To: Eli Zaretskii From: Klee Dienes In-Reply-To: Message-Id: Content-Transfer-Encoding: 7bit X-SW-Source: 2002-10/txt/msg00176.txt.bz2 Sure: breakpoint.c:984 (in insert_breakpoints), and breakpoint.c:5480 (in can_use_hardware_watchpoint). Here's the relevant code from breakpoint.c:984: /* Look at each value on the value chain. */ for (; v; v = v->next) { /* If it's a memory location, and GDB actually needed its contents to evaluate the expression, then we must watch it. */ if (VALUE_LVAL (v) == lval_memory && ! VALUE_LAZY (v)) { struct type *vtype = check_typedef (VALUE_TYPE (v)); /* We only watch structs and arrays if user asked for it explicitly, never if they just happen to appear in the middle of some value chain. */ if (v == b->val_chain || (TYPE_CODE (vtype) != TYPE_CODE_STRUCT && TYPE_CODE (vtype) != TYPE_CODE_ARRAY)) { CORE_ADDR addr; int len, type; addr = VALUE_ADDRESS (v) + VALUE_OFFSET (v); len = TYPE_LENGTH (VALUE_TYPE (v)); type = hw_write; if (b->type == bp_read_watchpoint) type = hw_read; else if (b->type == bp_access_watchpoint) type = hw_access; val = target_insert_watchpoint (addr, len, type); On Monday, October 7, 2002, at 10:26 AM, Eli Zaretskii wrote: > > On Mon, 7 Oct 2002, Klee Dienes wrote: > >> My patch doesn't change the behavior >> of the trigger phase at all --- this phase has always set the trigger >> to watch the entire contents of the array. > > IIRC, that's not true: what you call ``the trigger phase'' was watching > the address of the array, not its contents. To watch the contents, you > needed to watch specific array elements. > > In other words, "watch my_array" would break when the pointer to > the first element of my_array[] changed to point to a different memory > location. If you want to watch array contents, you need to say > "watch my_array[0]", "watch my_array[1]", etc. > > Of course, it's been a while since I looked at that code, so I might be > mistaken. If so, could you please tell where's the code in the current > CVS sources which is watching the entire contents of the array?