public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "karthikthecool at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/14959] New: Software watchpoint deleted when we have a call to @plt function
Date: Fri, 14 Dec 2012 08:12:00 -0000	[thread overview]
Message-ID: <bug-14959-4717@http.sourceware.org/bugzilla/> (raw)

http://sourceware.org/bugzilla/show_bug.cgi?id=14959

             Bug #: 14959
           Summary: Software watchpoint deleted when we have a call to
                    @plt function
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: critical
          Priority: P2
         Component: gdb
        AssignedTo: unassigned@sourceware.org
        ReportedBy: karthikthecool@gmail.com
    Classification: Unclassified


Hi All,
I was trying to debug the following program in GDB -

#include <stdio.h>
int global = 0;

void func2()
{
  global = 0;
  printf("global = %d  \n",global);
}

int main()
{
  int q = 0;
  func2();
  q = 1;
  return 0;
}

When we try to set a software watchpoint on q and execute the program. The
watchpoint gets deleted as soon as a call to printf is made.

Debugging session snippet - 

(gdb) b main 
Breakpoint 1 at 0x8048427: file test.c, line 13.
(gdb) r
Starting program: /home/kv.bhat/OpenSourceProject/a.out 

Breakpoint 1, main () at test.c:13
13      int q = 0;
(gdb) set can-use-hw-watchpoints 0
(gdb) watch q
Watchpoint 2: q
(gdb) n
Watchpoint 2: q

Old value = -1208201228
New value = 0
main () at test.c:14
14      func2();
(gdb) c
Continuing.

Watchpoint 2 deleted because the program has left the block in
which its expression is valid.
0xb7fedbdb in ?? () from /lib/ld-linux.so.2
(gdb) c
Continuing.
global = 0  

Program exited normally.
(gdb) Quit


Call to prtinf@plt function is resulting in watch point getting deleted -

Dump of assembler code for function func2:
   0x080483e4 <+0>:    push   %ebp
   0x080483e5 <+1>:    mov    %esp,%ebp
   0x080483e7 <+3>:    push   %ebx
   0x080483e8 <+4>:    sub    $0x14,%esp
   0x080483eb <+7>:    call   0x8048443 <__i686.get_pc_thunk.bx>
   0x080483f0 <+12>:    add    $0x1c04,%ebx
   0x080483f6 <+18>:    movl   $0x0,0x28(%ebx)
   0x08048400 <+28>:    mov    0x28(%ebx),%edx
   0x08048406 <+34>:    lea    -0x1ad4(%ebx),%eax
   0x0804840c <+40>:    mov    %edx,0x4(%esp)
   0x08048410 <+44>:    mov    %eax,(%esp)
=> 0x08048413 <+47>:    call   0x8048300 <printf@plt>
   0x08048418 <+52>:    add    $0x14,%esp
   0x0804841b <+55>:    pop    %ebx
   0x0804841c <+56>:    pop    %ebp
   0x0804841d <+57>:    ret    
End of assembler dump.
(gdb) ni

Watchpoint 2 deleted because the program has left the block in
which its expression is valid.
0xb7fedbdb in ?? () from /lib/ld-linux.so.2

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


             reply	other threads:[~2012-12-14  8:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-14  8:12 karthikthecool at gmail dot com [this message]
2012-12-14  8:13 ` [Bug gdb/14959] " karthikthecool at gmail dot com
2012-12-14  9:21 ` qiyao at gcc dot gnu.org
2013-03-24 15:02 ` SztfG at yandex dot ru
2013-03-24 15:02 ` SztfG at yandex dot ru
2013-03-24 15:04 ` SztfG at yandex dot ru
2013-03-24 15:21 ` jan.kratochvil at redhat dot com
2013-03-25 12:23 ` SztfG at yandex dot ru
2013-03-25 12:30 ` jan.kratochvil at redhat dot com
2023-12-31 15:43 ` ssbssa at sourceware dot org
2024-01-01  5:57 ` jan at jankratochvil dot net

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=bug-14959-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).