From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12398 invoked by alias); 29 Oct 2008 21:02:52 -0000 Received: (qmail 12329 invoked by uid 22791); 29 Oct 2008 21:02:50 -0000 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 29 Oct 2008 21:02:47 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 48D812A96C7; Wed, 29 Oct 2008 17:02:45 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id jyR4uBRzzmFr; Wed, 29 Oct 2008 17:02:45 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 160C42A96BF; Wed, 29 Oct 2008 17:02:45 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id D4B50E7ACD; Wed, 29 Oct 2008 14:02:42 -0700 (PDT) Date: Thu, 30 Oct 2008 01:51:00 -0000 From: Joel Brobecker To: Jan Kratochvil Cc: gdb-patches@sourceware.org Subject: Re: [patch] ia64: Fix breakpoints memory shadow Message-ID: <20081029210242.GA3635@adacore.com> References: <20081028172816.GA1284@host0.dyn.jankratochvil.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20081028172816.GA1284@host0.dyn.jankratochvil.net> User-Agent: Mutt/1.4.2.2i 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/msg00694.txt.bz2 Hi Jan, > 2008-10-28 Jan Kratochvil > > Fix automatic restoration of breakpoints memory for ia64. > * ia64-tdep.c (ia64_memory_insert_breakpoint): New comment part for > SHADOW_CONTENTS content. Remova variable instr. New variable cleanup. > Force automatic breakpoints restoration. PLACED_SIZE and SHADOW_LEN > are now set larger, to BUNDLE_LEN - 2. > (ia64_memory_remove_breakpoint): Rename variables bundle to bundle_mem > and instr to instr_saved. New variables bundle_saved and > instr_breakpoint. Comment new reasons why we need to disable automatic > restoration of breakpoints. Assert PLACED_SIZE and SHADOW_LEN. New > check of the original memory content. > (ia64_breakpoint_from_pc): Array breakpoint extended to BUNDLE_LEN. > Sanity check the PCPTR parameter SLOTNUM value. New #if check on > BREAKPOINT_MAX vs. BUNDLE_LEN. Increase LENPTR to BUNDLE_LEN - 2. 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. > +# 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? -- Joel