From: Michael Snyder <msnyder@vmware.com>
To: martin mangard <martin@mangard.at>
Cc: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: create a watchpoint with trace functionality
Date: Wed, 21 Oct 2009 14:35:00 -0000 [thread overview]
Message-ID: <4ADF1A75.7040602@vmware.com> (raw)
In-Reply-To: <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)
next prev parent reply other threads:[~2009-10-21 14:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-21 13:37 martin mangard
2009-10-21 14:35 ` Michael Snyder [this message]
2009-10-21 14:55 ` Nicholas Mc Guire
2009-10-25 12:57 ` Michael Snyder
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=4ADF1A75.7040602@vmware.com \
--to=msnyder@vmware.com \
--cc=gdb@sourceware.org \
--cc=martin@mangard.at \
/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