From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26689 invoked by alias); 18 Aug 2009 17:10:04 -0000 Received: (qmail 26633 invoked by uid 22791); 18 Aug 2009 17:10:02 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,FB_WORD1_END_DOLLAR,J_CHICKENPOX_13,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.45.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 18 Aug 2009 17:09:53 +0000 Received: from wpaz21.hot.corp.google.com (wpaz21.hot.corp.google.com [172.24.198.85]) by smtp-out.google.com with ESMTP id n7IH9p57020320 for ; Tue, 18 Aug 2009 10:09:51 -0700 Received: from ywh40 (ywh40.prod.google.com [10.192.8.40]) by wpaz21.hot.corp.google.com with ESMTP id n7IH9ZFK014114 for ; Tue, 18 Aug 2009 10:09:49 -0700 Received: by ywh40 with SMTP id 40so5673464ywh.14 for ; Tue, 18 Aug 2009 10:09:49 -0700 (PDT) MIME-Version: 1.0 Received: by 10.150.207.14 with SMTP id e14mr8461328ybg.149.1250615388931; Tue, 18 Aug 2009 10:09:48 -0700 (PDT) In-Reply-To: <4A869488.2060407@in.ibm.com> References: <200908141602.50465.chandru@in.ibm.com> <4A869488.2060407@in.ibm.com> Date: Tue, 18 Aug 2009 17:31:00 -0000 Message-ID: Subject: Re: [patch]: inform user that a watchpoint is hit From: Doug Evans To: Chandru Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true 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: 2009-08/txt/msg00285.txt.bz2 On Sat, Aug 15, 2009 at 3:57 AM, Chandru wrote: > Doug Evans wrote: >> >> On Fri, Aug 14, 2009 at 3:32 AM, Chandru wrote: >> >>> >>> When a program is restarted within gdb, the initial breakpoint hit >>> messages are >>> not outputted on to the screen. Inform the user that a watchpoint has >>> been hit >>> >>> Signed-off-by: Chandru Siddalingappa >>> --- >>> >>> --- gdb/breakpoint.c.orig =A0 =A0 =A0 2009-08-14 17:53:06.000000000 +05= 30 >>> +++ gdb/breakpoint.c =A0 =A02009-08-14 17:54:02.000000000 +0530 >>> @@ -842,6 +842,9 @@ update_watchpoint (struct breakpoint *b, >>> =A0struct bp_location *loc; >>> =A0bpstat bs; >>> >>> + =A0if (breakpoint_enabled (b)) >>> + =A0 =A0 =A0mention(b); >>> + >>> =A0unlink_locations_from_global_list (b); >>> =A0for (loc =3D b->loc; loc;) >>> =A0 =A0{ >>> >>> >> >> Hi. >> If we're stopping because of a watchpoint and not reporting it, that's >> bad. >> But it seems odd that this is happening, and simple experiments don't >> reveal anything. >> Do you have a testcase? >> > > yes, > > The steps performed to reproduce are: > > 1) Compile the following program with debug info > 2) Run the program. > 3) Set a watchpoint for "value1" variable. > 4) Run the test and do some checks. 5) Program exits. Now restart the > program execution > 6) Expect to see the message of hitting the watchpoint for value1 in main= () > line 20. > > #include > #include > > int value1 =3D -1; > int value2 =3D -1; > > int func1 () > { > =A0 value1=3D2; > =A0 value2=3Dvalue1; > =A0 =A0 return 0; > > } > > > int main () > { > =A0 int i; > > =A0 value1 =3D3; > =A0 value2 =3D value1; > =A0 for (i=3D0; i<2; i++) { > =A0 =A0 value1 =3D i; > =A0 =A0 value2 =3D value1; > =A0 } > > =A0 func1(); > > =A0 =A0return 0; > } > > > --------------- > > (gdb) break main > Breakpoint 1 at 0x8048453: file rawatch.c, line 20. > (gdb) run > Starting program: /home/vrvazque/rawatch > > Breakpoint 1, main () at rawatch.c:20 > 20 =A0 =A0 =A0 =A0 =A0value1 =3D3; > (gdb) rwatch value1 > Hardware read watchpoint 2: value1 > (gdb) awatch value1 > Hardware access (read/write) watchpoint 3: value1 > (gdb) cont > Continuing. > Hardware access (read/write) watchpoint 3: value1 > > Old value =3D -1 > New value =3D 3 > 0x08048462 in main () at rawatch.c:21 > 21 =A0 =A0 =A0 =A0 =A0value2 =3D value1; > (gdb) cont > ... > ... > ... > (gdb) cont > Continuing. > > Program exited normally. > (gdb) run > Starting program: /home/vrvazque/rawatch > > Breakpoint 1, main () at rawatch.c:20 > 20 =A0 =A0 =A0 =A0 =A0value1 =3D3; > (gdb) cont > > Thanks for the testcase! Here's what I see with current cvs head: [target =3D amd64-linux] gdb$ gcc -g chandru.c gdb$ ./gdb -nx a.out GNU gdb (GDB) 6.8.50.20090818-cvs Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux". For bug reporting instructions, please see: ... (gdb) b main Breakpoint 1 at 0x400471: file chandru.c, line 20. (gdb) r Starting program: /usr/local/g3/gnu/sourceware/dn/build/obj64/gdb/a.out Breakpoint 1, main () at chandru.c:20 20 value1 =3D3; (gdb) rwatch value1 Hardware read watchpoint 2: value1 (gdb) awatch value1 Hardware access (read/write) watchpoint 3: value1 (gdb) c Continuing. Hardware access (read/write) watchpoint 3: value1 Old value =3D -1 New value =3D 3 0x0000000000400481 in main () at chandru.c:21 21 value2 =3D value1; (gdb) c Continuing. Hardware access (read/write) watchpoint 3: value1 Old value =3D 3 New value =3D 0 main () at chandru.c:24 24 value2 =3D value1; (gdb) Continuing. Hardware read watchpoint 2: value1 Value =3D 0 Hardware access (read/write) watchpoint 3: value1 Value =3D 0 0x000000000040049f in main () at chandru.c:24 24 value2 =3D value1; (gdb) Continuing. Hardware access (read/write) watchpoint 3: value1 Old value =3D 0 New value =3D 1 main () at chandru.c:24 24 value2 =3D value1; (gdb) Continuing. Hardware read watchpoint 2: value1 Value =3D 1 Hardware access (read/write) watchpoint 3: value1 Value =3D 1 0x000000000040049f in main () at chandru.c:24 24 value2 =3D value1; (gdb) Continuing. Hardware access (read/write) watchpoint 3: value1 Old value =3D 1 New value =3D 2 func1 () at chandru.c:10 10 value2=3Dvalue1; (gdb) Continuing. Hardware read watchpoint 2: value1 Value =3D 2 Hardware access (read/write) watchpoint 3: value1 Value =3D 2 0x000000000040045c in func1 () at chandru.c:10 10 value2=3Dvalue1; (gdb) Continuing. Program exited normally. (gdb) r Starting program: /usr/local/g3/gnu/sourceware/dn/build/obj64/gdb/a.out Breakpoint 1, main () at chandru.c:20 20 value1 =3D3; (gdb) i b Num Type Disp Enb Address What 1 breakpoint keep y 0x0000000000400471 in main at chandru.c:20 breakpoint already hit 1 time 2 read watchpoint keep y value1 3 acc watchpoint keep y value1 (gdb) c Continuing. Hardware access (read/write) watchpoint 3: value1 Old value =3D -1 New value =3D 3 0x0000000000400481 in main () at chandru.c:21 21 value2 =3D value1; (gdb) So in cvs head I'm not seeing a problem (though maybe there's more needed to recreate it). Which version of gdb are you using? [Also, I haven't researched this, but maybe there's some overlap here with http://sourceware.org/ml/gdb-patches/2009-08/msg00254.html. Dunno. Doesn't seem like it but thought I'd point it out.]