From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17068 invoked by alias); 7 Jul 2009 12:29:03 -0000 Received: (qmail 17012 invoked by uid 22791); 7 Jul 2009 12:29:03 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-fx0-f210.google.com (HELO mail-fx0-f210.google.com) (209.85.220.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 07 Jul 2009 12:28:54 +0000 Received: by fxm6 with SMTP id 6so4999536fxm.24 for ; Tue, 07 Jul 2009 05:28:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.123.129 with SMTP id p1mr2666910far.29.1246969731955; Tue, 07 Jul 2009 05:28:51 -0700 (PDT) In-Reply-To: <1246550027.21485.30.camel@thomas> References: <8502af3c0907020810k766a9873qc32552180d5fdc64@mail.gmail.com> <1246550027.21485.30.camel@thomas> Date: Tue, 07 Jul 2009 12:29:00 -0000 Message-ID: <8502af3c0907070528i1c8cc003lc57006828eb4bde3@mail.gmail.com> Subject: Re: Problem with "watch" on a new port. From: Florent Defay To: jeremy.bennett@embecosm.com Cc: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-07/txt/msg00043.txt.bz2 Hi, Thank you very much to all for the answers. I am still in trouble with the "watch" issue. I give you a concrete example of the problem bellow. I debug main.c with the target-gdb (remote protocol) in two different ways. main.c --------- void foo () { } int main () { int a = 1; int i; for (i = 0; i < 10; i++) { if (i == 5) { a = 2; } } for (i = 0; i < 10; i++) { if (i == 5) { foo(); a = 3; } } return 0; } ----------------------------------------------------------- behavior 1 -------------- Breakpoint 1, main () at main.c:8 warning: Source file is more recent than executable. 8 int a = 1; (gdb) watch a Hardware watchpoint 2: a (gdb) c Continuing. Program received signal SIGTRAP, Trace/breakpoint trap. main () at main.c:11 11 for (i = 0; i < 10; i++) (gdb) p i $1 = 5 (gdb) p a $2 = 1 (gdb) c Continuing. Program received signal SIGTRAP, Trace/breakpoint trap. main () at main.c:11 11 for (i = 0; i < 10; i++) (gdb) p i $3 = 5 (gdb) p a $4 = 2 (gdb) c Continuing. //// nothing happens, infinite waiting ----------------------------------------------------------- behavior 2 -------------- Breakpoint 1, main () at main.c:8 8 int a = 1; (gdb) set can-use-hw-watchpoints 0 (gdb) watch a Watchpoint 2: a (gdb) c Continuing. Watchpoint 2: a Old value = 2 New value = 1 main () at main.c:11 11 for (i = 0; i < 10; i++) (gdb) c Continuing. Watchpoint 2: a Old value = 1 New value = 2 main () at main.c:11 11 for (i = 0; i < 10; i++) (gdb) p i $1 = 5 (gdb) c Continuing. Watchpoint 2 deleted because the program has left the block in which its expression is valid. 0x0000004e in foo () at main.c:4 4 } ----------------------------------------------------------- My conclusion : In behavior 1, Hardware watchpoint is used. The problem is 1- There are no info about old and new value. 2- The statement a = 3; is not detected. In behavior 2, Software watchpoint is used. The problem is 1- It cannot be a final solution because it is very slow. 2- "Watchpoint 2 deleted because the program has left the block in which its expression is valid." is not a good behavior. The call to foo has a secondary unexpected effect (it is the same behavior every time a function is called). The simulator (sid) seems to receive Z/z packets well. It may be due to a mistake in t-dep or something missing but I do not know what. Plus, step, next, breakpoints, finish work very well. Thank you. Regards, Florent.