From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7597 invoked by alias); 30 Jul 2007 19:47:16 -0000 Received: (qmail 7589 invoked by uid 22791); 30 Jul 2007 19:47:16 -0000 X-Spam-Check-By: sourceware.org Received: from romy.inter.net.il (HELO romy.inter.net.il) (213.8.233.24) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 30 Jul 2007 19:47:11 +0000 Received: from HOME-C4E4A596F7 (IGLD-83-130-217-159.inter.net.il [83.130.217.159]) by romy.inter.net.il (MOS 3.7.3-GA) with ESMTP id IMV84763 (AUTH halo1); Mon, 30 Jul 2007 22:46:40 +0300 (IDT) Date: Mon, 30 Jul 2007 21:16:00 -0000 Message-Id: From: Eli Zaretskii To: "ying lcs" CC: gdb@sourceware.org In-reply-to: <568e62a40707292020j4e53d480je8822ac6f37f4eda@mail.gmail.com> (yinglcs@gmail.com) Subject: Re: Can i set a breakpoint when a member of a C struct is being assigned? Reply-to: Eli Zaretskii References: <568e62a40707292020j4e53d480je8822ac6f37f4eda@mail.gmail.com> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-07/txt/msg00210.txt.bz2 > Date: Sun, 29 Jul 2007 22:20:58 -0500 > From: "ying lcs" > > 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.