This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Watching expressions that don't involve memory (e.g., watch $regfoo)
- From: Pedro Alves <pedro at codesourcery dot com>
- To: Michael Snyder <msnyder at vmware dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Thu, 4 Mar 2010 02:13:19 +0000
- Subject: Re: Watching expressions that don't involve memory (e.g., watch $regfoo)
- References: <201003040156.44957.pedro@codesourcery.com> <4B8F155E.8050209@vmware.com>
On Thursday 04 March 2010 02:05:18, Michael Snyder wrote:
> I think watching registers, or expressions involving registers
> (such as $sp > 0x10000000) could be incredibly useful.
Yeah, that works.
(top-gdb) p $rsp
$1 = (void *) 0x7fffffffe040
(top-gdb) watch $rsp < 0x7fffffffe040
Watchpoint 4: $rsp < 0x7fffffffe040
(top-gdb) c
Continuing.
Watchpoint 4: $rsp < 0x7fffffffe040
Old value = 0
New value = 1
0x0000000000454fd8 in memset@plt ()
(top-gdb) bt
#0 0x0000000000454fd8 in memset@plt ()
#1 0x0000000000456659 in main (argc=1, argv=0x7fffffffe158) at ../../src/gdb/gdb.c:28
(top-gdb)
> Expressions on a varobj sound useful to watch too.
What do you mean by varobj here? If that's something
that you can "(gdb) print", it should work too. It sounds
like it opens pathway for some crazy watching :-)
> One question; what will happen if I watch a constant?
The watchpoint never triggers, as is today.
--
Pedro Alves