Re: gdb break
- From: sinbad <sinbad.sinbad@xxxxxxxxx>
- Date: Tue, 29 Apr 2008 22:23:31 -0700 (PDT)
On Mar 15, 9:40 pm, Paul Pluzhnikov <ppluzhnikov-...@xxxxxxxxx> wrote:
sinbad<sinbad.sin...@xxxxxxxxx> writes:
how to make gdb to break ,with the change in some memory location.
You'll do well to read this:
http://catb.org/esr/faqs/smart-questions.html
and ask a smarter question next time.
i triedwatchpointbut it's not working.
Since you didn't tell us what exactly you did, we can't tell you
what you did wrong. Gdb watchpoints work just fine. They are even
fast on some platforms.
is there anyother way
No.
Here are precise instructions:
Suppose you have a global variable "count" and you want gdb to stop
every time it is updated.
$ cat t.c
#include <stdio.h>
int count;
int incr()
{
return count++;
}
int main()
{
int i;
while ((i = incr()) < 5)
printf("%d\n", i);
return 0;}
$ gcc -g t.c && gdb -q ./a.out
Using host libthread_db library "/lib/tls/libthread_db.so.1".
(gdb) p &count
$1 = (int *) 0x804959c
(gdb) watch *$1
Hardwarewatchpoint1: *$1
(gdb) r
Hardwarewatchpoint1: *$1
Hardwarewatchpoint1: *$1
Hardwarewatchpoint1: *$1
Old value = 0
New value = 1
incr () at t.c:7
7 }
(gdb) bt
#0 incr () at t.c:7
#1 0x08048395 in main () at t.c:12
(gdb) c
0
Hardwarewatchpoint1: *$1
Old value = 1
New value = 2
incr () at t.c:7
7 }
... etc ...
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
hi ,
I am getting the following error, while i tried to set watchpoint like
above.
"Can't clear hardware watchpoints without the 'Z2' (write-watchpoint)
packet."
btw i am doing remote debugging.
thanks
sinbad
.
- Prev by Date: Re: sharing memory map between processes (same parent)
- Next by Date: Re: TCP connect in Non Blocking Mode
- Previous by thread: q: code that generates printf() statement to dump C struct contents
- Next by thread: fork multiple shells
- Index(es):
Relevant Pages
|
|