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: Eli Zaretskii <eliz at gnu dot org>
- To: "ying lcs" <yinglcs at gmail dot com>
- Cc: gdb at sourceware dot org
- Date: Mon, 30 Jul 2007 22:46:44 +0300
- Subject: Re: Can i set a breakpoint when a member of a C struct is being assigned?
- References: <568e62a40707292020j4e53d480je8822ac6f37f4eda@mail.gmail.com>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> Date: Sun, 29 Jul 2007 22:20:58 -0500
> From: "ying lcs" <yinglcs@gmail.com>
>
> 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;
> };
>
> How can I break my debugging program when I have code like this:
>
> myStruct* p;
>
> p->type = 10;
Like this:
(gdb) watch p->type
(If `p' is a local (as opposed to static) variable, you need to do
this when `p' is in scope.