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: Eli Zaretskii <eliz at gnu dot org>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: pedro at codesourcery dot com, gdb-patches at sourceware dot org
- Date: Thu, 04 Mar 2010 02:39:53 -0500
- Subject: Re: Watching expressions that don't involve memory (e.g., watch $regfoo)
- References: <201003040156.44957.pedro@codesourcery.com> <20100304053017.GH2832@adacore.com>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> Date: Thu, 4 Mar 2010 09:30:17 +0400
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: gdb-patches@sourceware.org
>
> > Anyone else things this is useful? Here's a 5 minute hack at it.
> > +* Watchpoints on expressions not involving memory
> > +
> > + GDB now supports watching expressions that don't involve memory.
> > + This allows, for example, watching for register changes.
> > + E.g. "watch $pc" will do the right thing.
>
> I think that this might be very useful, indeed. For instance, if
> a variable is stored in a register instead of memory.
What would be _really_ nice is if GDB would automatically put a
watchpoint on the register that hold the variable, when the debug info
tells that. In optimized programs, watching the memory alone will
frequently miss value changes.