From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7185 invoked by alias); 24 Oct 2007 18:02:50 -0000 Received: (qmail 7171 invoked by uid 22791); 24 Oct 2007 18:02:48 -0000 X-Spam-Check-By: sourceware.org Received: from igw3.br.ibm.com (HELO igw3.br.ibm.com) (32.104.18.26) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 24 Oct 2007 18:02:44 +0000 Received: from mailhub1.br.ibm.com (unknown [9.18.232.109]) by igw3.br.ibm.com (Postfix) with ESMTP id B9A4F3902FB for ; Wed, 24 Oct 2007 15:56:17 -0200 (BRDT) Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.18.232.46]) by mailhub1.br.ibm.com (8.13.8/8.13.8/NCO v8.5) with ESMTP id l9OI2XYh1007756 for ; Wed, 24 Oct 2007 16:02:40 -0200 Received: from d24av01.br.ibm.com (loopback [127.0.0.1]) by d24av01.br.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l9OI2UuY030713 for ; Wed, 24 Oct 2007 15:02:30 -0300 Received: from [9.18.238.24] ([9.18.238.24]) by d24av01.br.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id l9OI2SbY030522; Wed, 24 Oct 2007 15:02:30 -0300 Subject: Re: [rfc, rfa/doc] Multi-threaded watchpoint improvements From: Luis Machado Reply-To: luisgpm@linux.vnet.ibm.com To: Daniel Jacobowitz Cc: gdb-patches@sourceware.org In-Reply-To: <20071024164712.GB4025@caradoc.them.org> References: <20070916183949.GA23966@caradoc.them.org> <20071001002015.GA15835@caradoc.them.org> <1193241369.4316.4.camel@localhost> <20071024154640.GA949@caradoc.them.org> <1193246520.4316.16.camel@localhost> <20071024164712.GB4025@caradoc.them.org> Content-Type: text/plain Date: Wed, 24 Oct 2007 18:08:00 -0000 Message-Id: <1193252544.4316.19.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-10/txt/msg00594.txt.bz2 Ok, This is the event log without the patch applied. I can see that it does have additional creation events occuring in the background, different than what occurs with the patch. Same source code, same compile flags. == code == (gdb) set debug event 1 (gdb) start breakpoint_create_event Breakpoint 1 at 0x10000738: file testsuite/gdb.base/watch-thread_num.c, line 39. Starting program: /home/luis/src/gdb/gdb-head/git/gdb/test [Thread debugging using libthread_db enabled] [New Thread 0x400000257c0 (LWP 4236)] [Switching to Thread 0x400000257c0 (LWP 4236)] breakpoint_delete_event main () at testsuite/gdb.base/watch-thread_num.c:39 39 for (i = 0; i < NUM; i++) (gdb) watch i During symbol reading, incomplete CFI data; unspecified registers (e.g., r0) at 0x10000738. breakpoint_create_event Hardware watchpoint 2: i (gdb) n 41 res = pthread_create(&threads[i], (gdb) [New Thread 0x40000a26240 (LWP 4239)] breakpoint_delete_event 39 for (i = 0; i < NUM; i++) (gdb) breakpoint_create_event Hardware watchpoint 2: i Old value = 0 New value = 1 0x0000000010000788 in main () at testsuite/gdb.base/watch-thread_num.c:39 39 for (i = 0; i < NUM; i++) (gdb) 41 res = pthread_create(&threads[i], (gdb) [New Thread 0x40001226240 (LWP 4240)] breakpoint_delete_event 39 for (i = 0; i < NUM; i++) (gdb) breakpoint_create_event Hardware watchpoint 2: i Old value = 1 New value = 2 0x0000000010000788 in main () at testsuite/gdb.base/watch-thread_num.c:39 39 for (i = 0; i < NUM; i++) (gdb) n 41 res = pthread_create(&threads[i], (gdb) [New Thread 0x40001a26240 (LWP 4241)] breakpoint_delete_event 39 for (i = 0; i < NUM; i++) (gdb) breakpoint_create_event Hardware watchpoint 2: i Old value = 2 New value = 3 0x0000000010000788 in main () at testsuite/gdb.base/watch-thread_num.c:39 39 for (i = 0; i < NUM; i++) (gdb) On Wed, 2007-10-24 at 12:47 -0400, Daniel Jacobowitz wrote: > On Wed, Oct 24, 2007 at 02:22:00PM -0300, Luis Machado wrote: > > Hi Daniel, > > > > This is what i get while trying to use a hardware watchpoint to monitor > > an int variable "i" that changes during a for statement (attached). Upon > > further investigation, it seems GDB is only calling > > "breakpoint_delete_event". I don't see GDB calling > > "breakpoint_create_event" anywhere except in the momment i created the > > watchpoint up there, so i presume that's the reason it's not triggering. > > That's the only time it is supposed to be called; it's the event at > the creation of a breakpoint. THe user creates it, it lives until it > is deleted. > > > (gdb) watch i > > During symbol reading, incomplete CFI data; unspecified registers (e.g., > > r0) at 0x10000738. > > breakpoint_create_event (CREATED!) > > Hardware watchpoint 2: i > > (gdb) n > > 41 res = pthread_create(&threads[i], > > (gdb) > > [New Thread 0x40000a26240 (LWP 3290)] > > breakpoint_delete_event (DELETED! After this point, no more creations.) > > GDB has stopped for some reason and checked whether the watchpoint on > i is still in scope. It thinks it isn't. This may be an unwinder > problem. Since the scope is gone, the watchpoint is deleted. > > When you have a problem with watchpoints it's useful to remember that > watchpoints on local variables are by far the most complicated kind. > See if they still work on a global variable or a memory location. > -- Luis Machado IBM Linux Technology Center e-mail: luisgpm@linux.vnet.ibm.com