This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Can i set a breakpoint when a member of a C struct is being assigned?


> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]