From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23090 invoked by alias); 4 Aug 2017 13:58:21 -0000 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 Received: (qmail 22084 invoked by uid 89); 4 Aug 2017 13:58:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=moreover, Moreover, Hx-languages-length:1427 X-HELO: mailapp01.imgtec.com Received: from mailapp01.imgtec.com (HELO mailapp01.imgtec.com) (195.59.15.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 04 Aug 2017 13:58:19 +0000 Received: from HHMAIL01.hh.imgtec.org (unknown [10.100.10.19]) by Forcepoint Email with ESMTPS id 0F2DEE9908950; Fri, 4 Aug 2017 14:58:13 +0100 (IST) Received: from [10.20.78.21] (10.20.78.21) by HHMAIL01.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server id 14.3.294.0; Fri, 4 Aug 2017 14:58:15 +0100 Date: Fri, 04 Aug 2017 13:58:00 -0000 From: "Maciej W. Rozycki" To: Simon Marchi CC: , Yao Qi , Joel Brobecker Subject: Re: [PATCH] mem-break: Fix breakpoint insertion location In-Reply-To: <172ea7a987fae99d7438bee77a704c76@polymtl.ca> Message-ID: References: <172ea7a987fae99d7438bee77a704c76@polymtl.ca> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-SW-Source: 2017-08/txt/msg00075.txt.bz2 On Fri, 4 Aug 2017, Simon Marchi wrote: > On 2017-08-01 18:36, Maciej W. Rozycki wrote: > > Fix a commit cd6c3b4ffc4e ("New gdbarch methods breakpoint_kind_from_pc > > and sw_breakpoint_from_kind") regression and restore the use of > > ->placed_size rather than ->reqstd_address as the location for a memory > > breakpoint to be inserted at. Previously `gdbarch_breakpoint_from_pc' > > was used that made that adjustment in `default_memory_insert_breakpoint' > > from the preinitialized value, however with the said commit that call is > > gone, so the passed ->placed_size has to be used for the initialization. [...] > IIUC, we end up writing the good breakpoint kind, but at the wrong address? > For example, if the requested address is 0x1001, it means that there should be > a micro/compressed MIPS breakpoint at address 0x1000, but that bug caused the > breakpoint to be written at address 0x1001 instead. Is that right? Exactly! Moreover, as the breakpoint is removed the original instruction bytes will be written back to 0x1000, further corrupting the executable, as `default_memory_remove_breakpoint' already correctly uses `->placed_address'. I can see now that I incorrectly wrote `->placed_size' across the patch description where I meant `->placed_address'. I'll correct that and repost the patch with PR annotation additionally included. Maciej