This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/14959] New: Software watchpoint deleted when we have a callto @plt function
- From: "karthikthecool at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Fri, 14 Dec 2012 08:12:04 +0000
- Subject: [Bug gdb/14959] New: Software watchpoint deleted when we have a callto @plt function
- Auto-submitted: auto-generated
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.