From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19685 invoked by alias); 30 Oct 2008 22:06:52 -0000 Received: (qmail 19448 invoked by uid 22791); 30 Oct 2008 22:06:50 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 30 Oct 2008 22:04:50 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m9UEmtAe029477; Thu, 30 Oct 2008 10:48:55 -0400 Received: from pobox.stuttgart.redhat.com (pobox.stuttgart.redhat.com [172.16.2.10]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m9UEmsF0014076; Thu, 30 Oct 2008 10:48:54 -0400 Received: from host0.dyn.jankratochvil.net (sebastian-int.corp.redhat.com [172.16.52.221]) by pobox.stuttgart.redhat.com (8.13.1/8.13.1) with ESMTP id m9UEmqEr004808; Thu, 30 Oct 2008 10:48:53 -0400 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.3/8.14.2) with ESMTP id m9UEmfEr028951; Thu, 30 Oct 2008 15:48:41 +0100 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.2/Submit) id m9UEmfGe028946; Thu, 30 Oct 2008 15:48:41 +0100 Date: Fri, 31 Oct 2008 00:03:00 -0000 From: Jan Kratochvil To: Joel Brobecker Cc: gdb-patches@sourceware.org Subject: Re: [patch] ia64: Fix breakpoints memory shadow Message-ID: <20081030144841.GA26606@host0.dyn.jankratochvil.net> References: <20081028172816.GA1284@host0.dyn.jankratochvil.net> <20081029210242.GA3635@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20081029210242.GA3635@adacore.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-10/txt/msg00715.txt.bz2 Hi Joel, On Wed, 29 Oct 2008 22:02:42 +0100, Joel Brobecker wrote: > I understand the overall idea, but I don't understand the logic behind > saving BUNDLE_LEN - 2 bytes (14 bytes, then) of the bundle at bundle > address + slotnum. It looks like this introduces extra complexity. > > Instead, would it be possible to save the entire bundle, when > inserting the breakpoint? When comes time to remove it, we would > only need to read the whole bundle, extract the original insn from > our saved bundle, and then push it back into the target bundle. I agree your proposal would be better but we have to comply with the current `struct bp_target_info' layout which is being intepreted outside of ia64-tdep.c - in breakpoint_restore_shadows. If we would like to store the whole bundle to SHADOW_CONTENTS we would have to store already the base address (`address & ~0x0f') into PLACED_ADDRESS. In such case there is no other place where to store SLOTNUM (`adress & 0x0f', value in the range <0..2>). We need to know SLOTNUM in ia64_memory_remove_breakpoint. ia64 16-byte bundle layout: | 5 bits | slot 0 with 41 bits | slot 1 with 41 bits | slot 2 with 41 bits | (A) The current way of the patch: original PC placed_address placed_size required covered == bp_tgt->shadow_len required \subset covered 0xABCDE0 0xABCDE0 0xE <0x0...0x5> <0x0..0xD> 0xABCDE1 0xABCDE1 0xE <0x5...0xA> <0x1..0xE> 0xABCDE2 0xABCDE2 0xE <0xA...0xF> <0x2..0xF> (B) Another way would be (converting `original PC' -> `placed_address' in ia64_breakpoint_from_pc): original PC placed_address placed_size required covered == bp_tgt->shadow_len 0xABCDE0 0xABCDE0 0x6 <0x0...0x5> <0x0..0x5> 0xABCDE1 0xABCDE5 0x6 <0x5...0xA> <0x5..0xA> 0xABCDE2 0xABCDEA 0x6 <0xA...0xF> <0xA..0xF> `objdump -d' and some other tools show a bit unjustified offsets: original PC byte where starts the instruction objdump offset 0xABCDE0 0xABCDE0 0xABCDE0 0xABCDE1 0xABCDE5 0xABCDE6 0xABCDE2 0xABCDEA 0xABCDEC I can freely change the current (A) way for (B) but I found the code easier this way. (B) would be more minimal/effective but sure it does not matter. > > +# We need to start the inferior to place the breakpoints in the memory at all. > > +if { [gdb_start_cmd] < 0 } { > > + untested start > > + return -1 > > +} > > +gdb_test "" "main \\(\\) at .*" "start" > > Why not use runto_main here? I will change it in the final patch together with a note in gdb.base/start.exp that it is there to test gdb_start_cmd, not to start a program. Thanks, Jan