This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Can i set a breakpoint when a member of a C struct is being assigned?
- From: Jim Blandy <jimb at codesourcery dot com>
- To: "ying lcs" <yinglcs at gmail dot com>
- Cc: gdb at sourceware dot org
- Date: Mon, 30 Jul 2007 14:16:25 -0700
- Subject: Re: Can i set a breakpoint when a member of a C struct is being assigned?
- References: <568e62a40707292020j4e53d480je8822ac6f37f4eda@mail.gmail.com>
"ying lcs" <yinglcs@gmail.com> writes:
> Can i set a breakpoint when a member of a C struct is being assigned?
>
> For example, i have a C struct in my code:
> struct myStruct{
> int type;
> };
There isn't any way to set a breakpoint on all assignments to a chosen
member of a chosen structure type, regardless of which actual object
of that type is being modified.
You can set a watchpoint on a particular member of a particular
object; see the GDB manual on 'watchpoints'.
You can, of course, set a breakpoint on a particular assignment
statement.