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


On Wed, 19 Aug 2009 09:56:37 +0200, Chandru wrote:
> What I was referring to was the messages like the following to be outputted
> on the screen with the patch applied..
>
> Program exited normally.
> (gdb) r
> Starting program: /home/chandru/r
> Hardware access (read/write) watchpoint 2: value1
> Hardware read watchpoint 3: value1
> Hardware access (read/write) watchpoint 2: value1
> Hardware read watchpoint 3: value1
> Hardware access (read/write) watchpoint 2: value1
> Hardware read watchpoint 3: value1
> Hardware access (read/write) watchpoint 2: value1
> Hardware read watchpoint 3: value1
> Hardware access (read/write) watchpoint 2: value1
> Hardware read watchpoint 3: value1
> Hardware access (read/write) watchpoint 2: value1
> Hardware read watchpoint 3: value1
>
> Breakpoint 1, main () at rwatch.c:20
> 20          value1 =3;
> (gdb)
>
> I was using a distribution supplied gdb-6.8.50 and found that upstream
> gdb shows the same behaviour.  gdb-6.6 outputs these messages
> without the patch when a program is restarted.

This is not reproducible for me.
* Which distribution?
* Which exact NVR (name-version-release) of the distribution package?
* The URL http://sourceware.org/ml/gdb-patches/2009-08/msg00254.html was
  referring to 4 patches, do you have all of them applied?
  (but these 4 patches have no effect on this testcase for me, shown as
  "archer-jankratochvil-watchpoint" below)
* Please provide both the testcase and complete GDB run screenshot in the same
  mail.  Once you refer to "rawatch.c", second time "rwatch.c".
  When you provide a screenshot refer to all the exact versions and possible
  patches applied to it.
* Provide the architecture in use (x86_64? i686? could it be ppc64?).
* Provide even the compiler version used.
* Provide the kernel version in use due to various ptrace syscall bugsin the
  past and present (asking primarily for the possibility of ppc64 in use and
  the watchpoints on it).


Thanks,
Jan

$ cat >rwatch.c
#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;
}
$ gcc -o rwatch rwatch.c -Wall -g
$ ~/redhat/gdb-clean/gdb/gdb -nx ./rwatch
GNU gdb (GDB) 6.8.50.20090819-cvs
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
(gdb) break main
Breakpoint 1 at 0x4004a5: file rwatch.c, line 20.
(gdb) run
Starting program: /home/jkratoch/t/rwatch 

Breakpoint 1, main () at rwatch.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
0x00000000004004b5 in main () at rwatch.c:21
21	   value2 = value1;
(gdb) 
Continuing.
Hardware access (read/write) watchpoint 3: value1

Old value = 3
New value = 0
main () at rwatch.c:24
24	     value2 = value1;
(gdb) 
Continuing.
Hardware read watchpoint 2: value1

Value = 0
Hardware access (read/write) watchpoint 3: value1

Value = 0
0x00000000004004d3 in main () at rwatch.c:24
24	     value2 = value1;
(gdb) 
Continuing.
Hardware access (read/write) watchpoint 3: value1

Old value = 0
New value = 1
main () at rwatch.c:24
24	     value2 = value1;
(gdb) 
Continuing.
Hardware read watchpoint 2: value1

Value = 1
Hardware access (read/write) watchpoint 3: value1

Value = 1
0x00000000004004d3 in main () at rwatch.c:24
24	     value2 = value1;
(gdb) 
Continuing.
Hardware access (read/write) watchpoint 3: value1

Old value = 1
New value = 2
func1 () at rwatch.c:10
10	   value2=value1;
(gdb) 
Continuing.
Hardware read watchpoint 2: value1

Value = 2
Hardware access (read/write) watchpoint 3: value1

Value = 2
0x0000000000400490 in func1 () at rwatch.c:10
10	   value2=value1;
(gdb) 
Continuing.

Program exited normally.
(gdb) run
Starting program: /home/jkratoch/t/rwatch 

Breakpoint 1, main () at rwatch.c:20
20	   value1 =3;
(gdb) c
Continuing.
Hardware access (read/write) watchpoint 3: value1

Old value = -1
New value = 3
0x00000000004004b5 in main () at rwatch.c:21
21	   value2 = value1;
(gdb) q
A debugging session is active.

	Inferior 2 [process 7180] will be killed.

Quit anyway? (y or n) y
$ ~/redhat/archer-jankratochvil-watchpoint/gdb/gdb -nx ./rwatch
GNU gdb (GDB) 6.8.50.20090818-cvs
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
(gdb) break main
Breakpoint 1 at 0x4004a5: file rwatch.c, line 20.
(gdb) run
Starting program: /home/jkratoch/t/rwatch 

Breakpoint 1, main () at rwatch.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
0x00000000004004b5 in main () at rwatch.c:21
21	   value2 = value1;
(gdb) 
Continuing.
Hardware access (read/write) watchpoint 3: value1

Old value = 3
New value = 0
main () at rwatch.c:24
24	     value2 = value1;
(gdb) 
Continuing.
Hardware read watchpoint 2: value1

Value = 0
Hardware access (read/write) watchpoint 3: value1

Value = 0
0x00000000004004d3 in main () at rwatch.c:24
24	     value2 = value1;
(gdb) 
Continuing.
Hardware access (read/write) watchpoint 3: value1

Old value = 0
New value = 1
main () at rwatch.c:24
24	     value2 = value1;
(gdb) 
Continuing.
Hardware read watchpoint 2: value1

Value = 1
Hardware access (read/write) watchpoint 3: value1

Value = 1
0x00000000004004d3 in main () at rwatch.c:24
24	     value2 = value1;
(gdb) 
Continuing.
Hardware access (read/write) watchpoint 3: value1

Old value = 1
New value = 2
func1 () at rwatch.c:10
10	   value2=value1;
(gdb) 
Continuing.
Hardware read watchpoint 2: value1

Value = 2
Hardware access (read/write) watchpoint 3: value1

Value = 2
0x0000000000400490 in func1 () at rwatch.c:10
10	   value2=value1;
(gdb) 
Continuing.

Program exited normally.
(gdb) run
Starting program: /home/jkratoch/t/rwatch 

Breakpoint 1, main () at rwatch.c:20
20	   value1 =3;
(gdb) cont
Continuing.
Hardware access (read/write) watchpoint 3: value1

Old value = -1
New value = 3
0x00000000004004b5 in main () at rwatch.c:21
21	   value2 = value1;
(gdb) q
A debugging session is active.

	Inferior 2 [process 7244] will be killed.

Quit anyway? (y or n) y
$ readelf -wi rwatch|grep producer
    < c>   DW_AT_producer    : (indirect string, offset: 0x1c): GNU C 4.4.0 20090506 (Red Hat 4.4.0-4)	
$ rpm -q gcc
gcc-4.4.0-4.x86_64
$ cat /proc/version 
Linux version 2.6.29.5-191.fc11.x86_64 (mockbuild@x86-5.fedora.phx.redhat.com) (gcc version 4.4.0 20090506 (Red Hat 4.4.0-4) (GCC) ) #1 SMP Tue Jun 16 23:23:21 EDT 2009
$ rpm -q kernel
kernel-2.6.29.5-191.fc11.x86_64
$ cat /etc/fedora-release 
Fedora release 11 (Leonidas)
$ _


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