This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch]: inform user that a watchpoint is hit


Doug Evans wrote:
On Fri, Aug 14, 2009 at 3:32 AM, Chandru<chandru@in.ibm.com> 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 <chandru@ilinux.vnet.ibm.com>
---

--- gdb/breakpoint.c.orig       2009-08-14 17:53:06.000000000 +0530
+++ gdb/breakpoint.c    2009-08-14 17:54:02.000000000 +0530
@@ -842,6 +842,9 @@ update_watchpoint (struct breakpoint *b,
  struct bp_location *loc;
  bpstat bs;

+  if (breakpoint_enabled (b))
+      mention(b);
+
  unlink_locations_from_global_list (b);
  for (loc = b->loc; loc;)
    {


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 <stdio.h>
#include <stdlib.h>

int value1 = -1;
int value2 = -1;

int func1 ()
{
   value1=2;
   value2=value1;
     return 0;

}


int main () { int i;

   value1 =3;
   value2 = value1;
   for (i=0; i<2; i++) {
     value1 = i;
     value2 = value1;
   }

func1();

    return 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          value1 =3;
(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 = -1
New value = 3
0x08048462 in main () at rawatch.c:21
21          value2 = value1;
(gdb) cont
...
...
...
(gdb) cont
Continuing.

Program exited normally.
(gdb) run
Starting program: /home/vrvazque/rawatch

Breakpoint 1, main () at rawatch.c:20
20          value1 =3;
(gdb) cont


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]