From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8719 invoked by alias); 10 May 2007 22:05:55 -0000 Received: (qmail 8708 invoked by uid 22791); 10 May 2007 22:05:54 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate7.de.ibm.com (HELO mtagate7.de.ibm.com) (195.212.29.156) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 10 May 2007 22:05:48 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate7.de.ibm.com (8.13.8/8.13.8) with ESMTP id l4AM5jiB124030 for ; Thu, 10 May 2007 22:05:45 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v8.3) with ESMTP id l4AM5j3m3776534 for ; Fri, 11 May 2007 00:05:45 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l4AM5j8T032750 for ; Fri, 11 May 2007 00:05:45 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id l4AM5j9e032747; Fri, 11 May 2007 00:05:45 +0200 Message-Id: <200705102205.l4AM5j9e032747@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Fri, 11 May 2007 00:05:45 +0200 Subject: Re: [rfc] [4/4] SPU overlay support: Bugfix in remove_breakpoint To: drow@false.org (Daniel Jacobowitz) Date: Thu, 10 May 2007 22:05:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <20070510215148.GB3187@caradoc.them.org> from "Daniel Jacobowitz" at May 10, 2007 05:51:48 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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: 2007-05/txt/msg00176.txt.bz2 Daniel Jacobowitz wrote: > On Tue, May 08, 2007 at 12:27:05AM +0200, Ulrich Weigand wrote: > > However, for *software* breakpoints this looks definitely > > wrong to me. So the patch below restores the old behaviour > > for those: the shadow contents are restored only if the > > section is still mapped. > > > > Any comments? I plan on committing this after the rest of > > the SPU overlay support patches. > > I think that there's two reasonable overlay manager behaviors, > depending on the different sorts of systems that might want overlays. > If the source of the overlay comes from ROM, or from some other > read-only source, then your patch is clearly right. If it comes from > RAM, then some systems may save the overlay (e.g. if it contained > data) - and thus save the breakpoint. I can't see any way around this > unless the overlay manager warns GDB before it unmaps the breakpoint. Even in the case of read-write overlay sections that were saved by the overlay manager, "restoring" a breakpoint at the *VMA* in a non-present overlay would be wrong. At this memory location, some *other* overlay section may already be swapped in, and the restore would clobber unrelated code (and still leave the breakpoint instruction in the swapped out backing store). The way to handle read-write overlay managers is to arrange for the LMA to point to the backing-store RAM address where the overlay has been swapped to, and remove the swapped-out breakpoint at the *LMA* address. The existing code already handles that correctly (assuming overlay_events_enabled is false, as it should be for read-write overlay managers). Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com