From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17205 invoked by alias); 20 Jul 2004 14:37:23 -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 17175 invoked from network); 20 Jul 2004 14:37:21 -0000 Received: from unknown (HELO miranda.se.axis.com) (212.209.10.220) by sourceware.org with SMTP; 20 Jul 2004 14:37:21 -0000 Received: from [10.84.130.1] (ironmaiden.se.axis.com [10.84.130.1]) by miranda.se.axis.com (8.12.9/8.12.9/Debian-5local0.1) with ESMTP id i6KEbJW9031835 for ; Tue, 20 Jul 2004 16:37:19 +0200 Message-ID: <40FD2E1F.7070403@axis.com> Date: Tue, 20 Jul 2004 14:37:00 -0000 From: Orjan Friberg Organization: Axis Communications User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040616 MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: recurse.exp: watch on local variable that goes out of scope Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-07/txt/msg00251.txt.bz2 I'm having problems with recurse.exp on CRISv32 with hardware watchpoint support - a local variable which goes out of scope isn't handled the same way as on the i386 ("second instance watchpoint deleted when leaving scope"). On the i386 i386_stopped_data_address returns a proper address when I don't expect it to. Here's a recap of what I think I've understood: in order to detect when a watched local variable goes out of scope, gdb inserts a breakpoint on the instruction where the function that the variable belongs to returns to. In this case it shows up as ("maint info break"; local variable "b" is watched in recurse (a=5)): 4 hw watchpoint keep y b breakpoint already hit 2 times -56 watchpoint scope del y 0x08048403 stop only in stack frame at 0xbffff4c4 breakpoint already hit 4 times When stopped at the return statement of recurse (a=5), a continue is issued, making recurse (a=5) return and the "watchpoint scope del" breakpoint is then hit (the bp_addr argument to bpstat_stop_status == 0x08048403). Now for the confusing part: bpstat_stop_status is called with stopped_by_watchpoint == 1. This is because, at this point, i386_stopped_data_address returns the address of the local variable "b" (the address it had in recurse (a=5)), as if it were stopped due to a watchpoint hit. I would have expected i386_stopped_data_address to return 0 at this point, since it didn't stop due to a watchpoint hit. What am I missing here? Does i386_stopped_data_address retain the stopped data address from the previous hit? Thanks in advance. -- Orjan Friberg Axis Communications