From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15312 invoked by alias); 21 Oct 2009 14:34:39 -0000 Received: (qmail 15297 invoked by uid 22791); 21 Oct 2009 14:34:38 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 21 Oct 2009 14:34:33 +0000 Received: from mailhost2.vmware.com (mailhost2.vmware.com [10.16.67.167]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 49CED1366F; Wed, 21 Oct 2009 07:34:32 -0700 (PDT) Received: from [10.20.94.141] (msnyder-server.eng.vmware.com [10.20.94.141]) by mailhost2.vmware.com (Postfix) with ESMTP id 2D1238E906; Wed, 21 Oct 2009 07:34:32 -0700 (PDT) Message-ID: <4ADF1A75.7040602@vmware.com> Date: Wed, 21 Oct 2009 14:35:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20080411) MIME-Version: 1.0 To: martin mangard CC: "gdb@sourceware.org" Subject: Re: create a watchpoint with trace functionality References: <325d766d0910210158y47944e5es48e44929fddb3770@mail.gmail.com> In-Reply-To: <325d766d0910210158y47944e5es48e44929fddb3770@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed 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-10/txt/msg00332.txt.bz2 martin mangard wrote: > Hello > > I'm trying to trace the value of a global status variable of an > application. This variable is changed from various code positions. I > would like to log/trace each change of this variable without stopping > the application (at least for a long time) in order to perform a > longterm test. I'm currently using a hardware-watchpoint > > Is there a possibility to configure a "autocontinue" after a > watchpoint-event? Which means that the changed value is printed and > the execution continues without any user interaction (pressing "c")? Yes, sure. See below. > Is ist possible to set a tracepoint on a change of a memory area? A tracepoint is different from a watchpoint, and no, I don't remember that you can do that with a tracepoint (I could be wrong). But if you just want your "log" to be written to the console or captured as text to a file, this is easy. (gdb) watch ival3 Hardware watchpoint 2: ival3 (gdb) commands 2 Type commands for when breakpoint 2 is hit, one per line. End with a line saying just "end". > continue > end (gdb) continue Continuing. Hardware watchpoint 2: ival3 Old value = -1 New value = 0 0x080484c4 in main () at /data/home/msnyder/cvs/localhost/quilt/gdb/testsuite/gdb.base/watchpoint.c:137 137 ival3 = count; ival4 = count; Hardware watchpoint 2: ival3 Old value = 0 New value = 1 0x080484c4 in main () at /data/home/msnyder/cvs/localhost/quilt/gdb/testsuite/gdb.base/watchpoint.c:137 137 ival3 = count; ival4 = count; Hardware watchpoint 2: ival3 Old value = 1 New value = 2 0x080484c4 in main () at /data/home/msnyder/cvs/localhost/quilt/gdb/testsuite/gdb.base/watchpoint.c:137 137 ival3 = count; ival4 = count; Hardware watchpoint 2: ival3 Old value = 2 New value = 3 0x080484c4 in main () at /data/home/msnyder/cvs/localhost/quilt/gdb/testsuite/gdb.base/watchpoint.c:137 137 ival3 = count; ival4 = count; Hardware watchpoint 2: ival3 Old value = 3 New value = 4 0x080484f4 in main () at /data/home/msnyder/cvs/localhost/quilt/gdb/testsuite/gdb.base/watchpoint.c:141 141 ival3 = count; ival4 = count; Program exited normally. (gdb)