From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27795 invoked by alias); 30 Jan 2012 05:54:45 -0000 Received: (qmail 27785 invoked by uid 22791); 30 Jan 2012 05:54:44 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-vx0-f169.google.com (HELO mail-vx0-f169.google.com) (209.85.220.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 30 Jan 2012 05:54:31 +0000 Received: by vcbfl11 with SMTP id fl11so2886106vcb.0 for ; Sun, 29 Jan 2012 21:54:30 -0800 (PST) Received: by 10.220.106.208 with SMTP id y16mr3983396vco.3.1327902870227; Sun, 29 Jan 2012 21:54:30 -0800 (PST) MIME-Version: 1.0 Received: by 10.220.3.130 with HTTP; Sun, 29 Jan 2012 21:54:10 -0800 (PST) In-Reply-To: <4F25EA26.8020901@adacore.com> References: <20120129165303.GA18465@host2.jankratochvil.net> <4F25EA26.8020901@adacore.com> From: Kevin Pouget Date: Mon, 30 Jan 2012 05:54:00 -0000 Message-ID: Subject: Re: software breakpoint in gdb To: Robert Dewar Cc: Jan Kratochvil , Xin Tong , gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 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: 2012-01/txt/msg00112.txt.bz2 On Mon, Jan 30, 2012 at 1:53 AM, Robert Dewar wrote: > On 1/29/2012 11:53 AM, Jan Kratochvil wrote: >> >> On Sun, 29 Jan 2012 17:48:30 +0100, Xin Tong wrote: >>> >>> What if the interrupt instruction is bigger than breakpointed >>> instruction ? >> >> >> I do not know about such architecture, it probably does not exist. > > > It sure would be a disastrous mistake to make in any architectural > design. the x86 of course has a one byte interrupt instruction > precisely for this purpose. Hello, I would be curious about why it would be "a disastrous mistake". Please correct me if I'm wrong in my understanding: - gdb sets a breakpoint at a given PC, save corresponding instruction, instructionS or part of instruction, - when the OS hits the breakpoint, GDB receives a SIGTRAP, - GDB rewrites the original memory content and moves back the PC to the BP address - GDB continues the inferior step-by-step, *until the PCs steps out of the breakpoint area* -- one step only if not(interrupt instruction is bigger than breakpointed instruction) - GDB re-set the breakpoint inst at the BP address, and continues the execution so, is it doing 2 steps to jump over the breakpoint which is complicated? Thnaks, Kevin