Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Chandru <chandru@in.ibm.com>
Cc: Doug Evans <dje@google.com>, gdb-patches@sourceware.org
Subject: Re: [patch]: inform user that a watchpoint is hit
Date: Wed, 19 Aug 2009 13:03:00 -0000	[thread overview]
Message-ID: <20090819081532.GA7264@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <4A8BB035.6030601@in.ibm.com>

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)
$ _


  reply	other threads:[~2009-08-19  8:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-14 13:15 Chandru
2009-08-15 10:57 ` Doug Evans
2009-08-15 12:22   ` Chandru
2009-08-18 17:31     ` Doug Evans
2009-08-19  8:05       ` Chandru
2009-08-19 13:03         ` Jan Kratochvil [this message]
2009-08-24 11:27           ` Chandru
2009-08-27  7:45             ` Chandru
2009-08-27  8:26               ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090819081532.GA7264@host0.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=chandru@in.ibm.com \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox