From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22853 invoked by alias); 20 Aug 2009 01:50:18 -0000 Received: (qmail 22844 invoked by uid 22791); 20 Aug 2009 01:50:18 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from qw-out-1920.google.com (HELO qw-out-1920.google.com) (74.125.92.144) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 20 Aug 2009 01:50:10 +0000 Received: by qw-out-1920.google.com with SMTP id 5so2695521qwf.24 for ; Wed, 19 Aug 2009 18:50:08 -0700 (PDT) Received: by 10.224.82.149 with SMTP id b21mr7033355qal.323.1250733007939; Wed, 19 Aug 2009 18:50:07 -0700 (PDT) Received: from dyn-209-2-225-148.dyn.columbia.edu (dyn-209-2-225-148.dyn.columbia.edu [209.2.225.148]) by mx.google.com with ESMTPS id 8sm973777qwj.56.2009.08.19.18.50.06 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 19 Aug 2009 18:50:07 -0700 (PDT) Cc: gdb@sourceware.org Message-Id: <187FEE7D-02A2-45C5-8B19-9BB7C6AC984D@gmail.com> From: kceiwH To: Andreas Schwab In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Subject: Re: How GDB knows a breakpoint is hit? Date: Thu, 20 Aug 2009 02:21:00 -0000 References: <84D22DD1-F4AD-4985-A0EC-AF3B53774D10@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: 2009-08/txt/msg00190.txt.bz2 Thanks very much. Mao On Aug 19, 2009, at 5:09 PM, Andreas Schwab wrote: > kceiwH writes: > >> I wonder how GDB knows it should stop the inferior when a >> breakpoint is >> hit. I try to read the code but only to find how GDB creates a >> breakpoint. I thought GDB might change some instructions of >> inferior so >> that when the inferior executes the modified instructions, GDB >> should >> know. But what the function "create_breakpoint" does is to add a >> breakpoint to the list "breakpoint_chain". > > Breakpoints are only inserted immediately before the inferior is > resumed, see insert_breakpoints. > > Andreas. > > -- > Andreas Schwab, schwab@linux-m68k.org > GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 > 4ED5 > "And now for something completely different."