From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28514 invoked by alias); 30 Jul 2007 21:16:31 -0000 Received: (qmail 28505 invoked by uid 22791); 30 Jul 2007 21:16:31 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 30 Jul 2007 21:16:27 +0000 Received: (qmail 21860 invoked from network); 30 Jul 2007 21:16:25 -0000 Received: from unknown (HELO localhost) (jimb@127.0.0.2) by mail.codesourcery.com with ESMTPA; 30 Jul 2007 21:16:25 -0000 To: "ying lcs" Cc: gdb@sourceware.org Subject: Re: Can i set a breakpoint when a member of a C struct is being assigned? References: <568e62a40707292020j4e53d480je8822ac6f37f4eda@mail.gmail.com> From: Jim Blandy Date: Mon, 30 Jul 2007 21:17:00 -0000 In-Reply-To: <568e62a40707292020j4e53d480je8822ac6f37f4eda@mail.gmail.com> (ying lcs's message of "Sun, 29 Jul 2007 22:20:58 -0500") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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/msg00211.txt.bz2 "ying lcs" 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.