From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8673 invoked by alias); 16 Oct 2006 00:39:35 -0000 Received: (qmail 8664 invoked by uid 22791); 16 Oct 2006 00:39:34 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Mon, 16 Oct 2006 00:39:32 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1GZGVu-00009D-5B; Sun, 15 Oct 2006 20:39:30 -0400 Date: Mon, 16 Oct 2006 00:39:00 -0000 From: Daniel Jacobowitz To: s88 Cc: gdb@sourceware.org Subject: Re: gdb breakpoint on x86 Message-ID: <20061016003930.GA525@nevyn.them.org> Mail-Followup-To: s88 , gdb@sourceware.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-10/txt/msg00106.txt.bz2 On Mon, Oct 16, 2006 at 08:12:29AM +0800, s88 wrote: > Hi all: > I'm trying to build up a simple breakpoint insertor by myself. I also > tracing the gdb source code and reference it!!! > But I feel confused about the int 3(0xcc), the function > "i386_breakpoint_from_pc" has 2 parameters, one of the parameter is a > program counter. I'm not sure the meaning of this program counter. > Does this program counter perform an ISR? Once the 0xcc trig, the > current program counter will replace by this one? No, it's the address at which the breakpoint will be placed. On i386 that doesn't matter, but on some other platforms it can affect which instruction is used as a breakpoint. > By the way, the following code can compile without any error. But the > sizeof which in the "i386_breakpoint_from_pc" derives segmentation > fault. You need to read up on memory protection. You can't modify a running program directly this way on most platforms. -- Daniel Jacobowitz CodeSourcery