This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: create a watchpoint with trace functionality
- From: Michael Snyder <msnyder at vmware dot com>
- To: martin mangard <martin at mangard dot at>
- Cc: "gdb at sourceware dot org" <gdb at sourceware dot org>
- Date: Wed, 21 Oct 2009 07:28:05 -0700
- Subject: Re: create a watchpoint with trace functionality
- References: <325d766d0910210158y47944e5es48e44929fddb3770@mail.gmail.com>
martin mangard wrote:
Hello
I'm trying to trace the value of a global status variable of an
application. This variable is changed from various code positions. I
would like to log/trace each change of this variable without stopping
the application (at least for a long time) in order to perform a
longterm test. I'm currently using a hardware-watchpoint
Is there a possibility to configure a "autocontinue" after a
watchpoint-event? Which means that the changed value is printed and
the execution continues without any user interaction (pressing "c")?
Yes, sure. See below.
Is ist possible to set a tracepoint on a change of a memory area?
A tracepoint is different from a watchpoint, and no, I don't
remember that you can do that with a tracepoint (I could be
wrong). But if you just want your "log" to be written to the
console or captured as text to a file, this is easy.
(gdb) watch ival3
Hardware watchpoint 2: ival3
(gdb) commands 2
Type commands for when breakpoint 2 is hit, one per line.
End with a line saying just "end".
> continue
> end
(gdb) continue
Continuing.
Hardware watchpoint 2: ival3
Old value = -1
New value = 0
0x080484c4 in main ()
at
/data/home/msnyder/cvs/localhost/quilt/gdb/testsuite/gdb.base/watchpoint.c:137
137 ival3 = count; ival4 = count;
Hardware watchpoint 2: ival3
Old value = 0
New value = 1
0x080484c4 in main ()
at
/data/home/msnyder/cvs/localhost/quilt/gdb/testsuite/gdb.base/watchpoint.c:137
137 ival3 = count; ival4 = count;
Hardware watchpoint 2: ival3
Old value = 1
New value = 2
0x080484c4 in main ()
at
/data/home/msnyder/cvs/localhost/quilt/gdb/testsuite/gdb.base/watchpoint.c:137
137 ival3 = count; ival4 = count;
Hardware watchpoint 2: ival3
Old value = 2
New value = 3
0x080484c4 in main ()
at
/data/home/msnyder/cvs/localhost/quilt/gdb/testsuite/gdb.base/watchpoint.c:137
137 ival3 = count; ival4 = count;
Hardware watchpoint 2: ival3
Old value = 3
New value = 4
0x080484f4 in main ()
at
/data/home/msnyder/cvs/localhost/quilt/gdb/testsuite/gdb.base/watchpoint.c:141
141 ival3 = count; ival4 = count;
Program exited normally.
(gdb)