public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/14959] New: Software watchpoint deleted when we have a call to @plt function
@ 2012-12-14  8:12 karthikthecool at gmail dot com
  2012-12-14  8:13 ` [Bug gdb/14959] " karthikthecool at gmail dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: karthikthecool at gmail dot com @ 2012-12-14  8:12 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-01-01  5:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-14  8:12 [Bug gdb/14959] New: Software watchpoint deleted when we have a call to @plt function karthikthecool at gmail dot com
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

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).